Files
swagger-ui/flavors/swagger-ui-react/release/run.sh
Tim Lai 07d346b516 feat(build): webpack@5 and webpack-dev-server@4 (#7826)
SwaggerUI is now built using `webpack@5`, with dev support for `webpack-dev-server@4`
- ES Module output bundle path now points to `swagger-ui-es-bundle-core`, which does not include dependencies
- No change to CommonJS output bundle or path
- Now uses Asset Modules, which replaces `file-loader`, `raw-loader`, and `url-loader`
- Removed unused rules/loaders for `.woff | .woff2 | .ttf | .eot` fonts and html
- Node polyfills are no longer bundled with `webpack@5`, and must be loaded separately and/or use `resolve.fallback`. 
As an example, SwaggerUI loads `process`, `buffer`, and `stream-browserify` as `devDependencies` in order to build development and production bundles.

SwaggerUI-React
- Now imports `swagger-ui-es-bundle-core`, and similarly outputs `swagger-ui-es-bundle-core` to its `dist` directory

Dev notes:
- Order of execution matters for the production npm build scripts. `build-stylesheets` needs to get built first, 
then cleanup of any empty artifacts, before building the various production bundles
- `Dev-helpers` now relies on `HTMLWebpackPlugin` to inject css and bundle files
2022-03-01 12:08:50 -08:00

39 lines
1.2 KiB
Bash
Executable File

# Deploy `swagger-ui-react` to npm.
# https://www.peterbe.com/plog/set-ex
set -ex
# Parameter Expansion: http://stackoverflow.com/questions/6393551/what-is-the-meaning-of-0-in-a-bash-script
cd "${0%/*}"
mkdir -p ../dist
# Copy UI's dist files to our directory
cp ../../../dist/swagger-ui-es-bundle-core.js ../dist
cp ../../../dist/swagger-ui-es-bundle-core.js.map ../dist
cp ../../../dist/swagger-ui.css ../dist
cp ../../../dist/swagger-ui.css.map ../dist
# Create a releasable package manifest
node create-manifest.js > ../dist/package.json
# Transpile our top-level component
../../../node_modules/.bin/cross-env BABEL_ENV=commonjs ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/commonjs.js
../../../node_modules/.bin/cross-env BABEL_ENV=es ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/index.js
# Copy our README into the dist folder for npm
cp ../README.md ../dist
# Copy LICENSE & NOTICE into the dist folder for npm
cp ../../../LICENSE ../dist
cp ../../../NOTICE ../dist
# Run the release from the dist folder
cd ../dist
if [ "$PUBLISH_FLAVOR_REACT" = "true" ] ; then
npm publish .
else
npm pack .
fi