build Bootstrap for verification testing (#4795)
authorAlex Lam S.L <alexlamsl@gmail.com>
Wed, 17 Mar 2021 14:34:17 +0000 (14:34 +0000)
committerGitHub <noreply@github.com>
Wed, 17 Mar 2021 14:34:17 +0000 (22:34 +0800)
.github/workflows/build.yml
test/release/acorn.sh
test/release/bootstrap.sh [new file with mode: 0755]
test/release/buble.sh
test/release/butternut.sh
test/release/mathjs.sh
test/release/rollup-es.sh
test/release/rollup-ts.sh
test/release/sucrase.sh
test/release/web-tooling-benchmark.sh

index 5522cd3..ed6c289 100644 (file)
@@ -9,10 +9,21 @@ jobs:
       fail-fast: false
       matrix:
         options: [ '-mb braces', '--ie8 -c', '-mc', '--toplevel -mc passes=3,pure_getters,unsafe' ]
-        script: [ acorn.sh, buble.sh, butternut.sh, mathjs.sh, rollup-es.sh, rollup-ts.sh, sucrase.sh, web-tooling-benchmark.sh ]
+        script:
+          - acorn.sh
+          - bootstrap.sh
+          - buble.sh
+          - butternut.sh
+          - mathjs.sh
+          - rollup-es.sh
+          - rollup-ts.sh
+          - sucrase.sh
+          - web-tooling-benchmark.sh
         include:
           - node: '14'
             script: acorn.sh
+          - node: '14'
+            script: bootstrap.sh
           - node: '14'
             script: buble.sh
           - node: '14'
index 1adaa9c..f6fdb6a 100755 (executable)
@@ -7,7 +7,7 @@ minify_in_situ() {
     ARGS="$UGLIFY_OPTIONS --validate --in-situ"
     DIRS="$1"
     echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
-    for i in `find $DIRS -name '*.js'`
+    for i in `find $DIRS -type f -name '*.js'`
     do
         ARGS="$ARGS $i"
     done
diff --git a/test/release/bootstrap.sh b/test/release/bootstrap.sh
new file mode 100755 (executable)
index 0000000..32c77f4
--- /dev/null
@@ -0,0 +1,182 @@
+#!/bin/sh
+
+alias uglify-js=$PWD/bin/uglifyjs
+UGLIFY_OPTIONS=$@
+
+minify_in_situ() {
+    ARGS="$UGLIFY_OPTIONS --validate --in-situ"
+    DIRS="$1"
+    echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
+    for i in `find $DIRS -type f -name '*.js'`
+    do
+        ARGS="$ARGS $i"
+    done
+    uglify-js $ARGS
+}
+
+rm -rf tmp/bootstrap \
+&& git clone --depth 1 --branch v5.0.0-beta2 https://github.com/twbs/bootstrap.git tmp/bootstrap \
+&& cd tmp/bootstrap \
+&& rm -rf .git/hooks \
+&& patch -p1 <<EOF
+--- a/.babelrc.js
++++ /dev/null
+@@ -1,12 +0,0 @@
+-module.exports = {
+-  presets: [
+-    [
+-      '@babel/preset-env',
+-      {
+-        loose: true,
+-        bugfixes: true,
+-        modules: false
+-      }
+-    ]
+-  ]
+-};
+--- a/.gitattributes
++++ b/.gitattributes
+@@ -5,0 +6 @@
++*.png binary
+--- a/build/build-plugins.js
++++ b/build/build-plugins.js
+@@ -14 +13,0 @@ const rollup = require('rollup')
+-const { babel } = require('@rollup/plugin-babel')
+@@ -19,6 +17,0 @@ const plugins = [
+-  babel({
+-    // Only transpile our source code
+-    exclude: 'node_modules/**',
+-    // Include the helpers in each file, at most one copy of each
+-    babelHelpers: 'bundled'
+-  })
+--- a/build/rollup.config.js
++++ b/build/rollup.config.js
+@@ -4 +3,0 @@ const path = require('path')
+-const { babel } = require('@rollup/plugin-babel')
+@@ -15,6 +13,0 @@ const plugins = [
+-  babel({
+-    // Only transpile our source code
+-    exclude: 'node_modules/**',
+-    // Include the helpers in the bundle, at most one copy of each
+-    babelHelpers: 'bundled'
+-  })
+--- a/js/tests/integration/rollup.bundle.js
++++ b/js/tests/integration/rollup.bundle.js
+@@ -3 +2,0 @@
+-const { babel } = require('@rollup/plugin-babel')
+@@ -18,4 +16,0 @@ module.exports = {
+-    babel({
+-      exclude: 'node_modules/**',
+-      babelHelpers: 'bundled'
+-    })
+--- a/js/tests/karma.conf.js
++++ b/js/tests/karma.conf.js
+@@ -7,2 +6,0 @@ const ip = require('ip')
+-const { babel } = require('@rollup/plugin-babel')
+-const istanbul = require('rollup-plugin-istanbul')
+@@ -84,13 +81,0 @@ const conf = {
+-      istanbul({
+-        exclude: [
+-          'node_modules/**',
+-          'js/tests/unit/**/*.spec.js',
+-          'js/tests/helpers/**/*.js'
+-        ]
+-      }),
+-      babel({
+-        // Only transpile our source code
+-        exclude: 'node_modules/**',
+-        // Inline the required helpers in each file
+-        babelHelpers: 'inline'
+-      }),
+@@ -142 +126,0 @@ if (BROWSERSTACK) {
+-    'karma-coverage-istanbul-reporter'
+@@ -144 +127,0 @@ if (BROWSERSTACK) {
+-  reporters.push('coverage-istanbul')
+--- a/package.json
++++ b/package.json
+@@ -23 +23 @@
+-    "start": "npm-run-all --parallel watch docs-serve",
++    "start": "npm-run-all --parallel watch",
+@@ -28,3 +27,0 @@
+-    "css-lint": "npm-run-all --continue-on-error --parallel css-lint-*",
+-    "css-lint-stylelint": "stylelint \"**/*.{css,scss}\" --cache --cache-location .cache/.stylelintcache --rd",
+-    "css-lint-vars": "fusv scss/ site/assets/scss/",
+@@ -44 +40,0 @@
+-    "js-lint": "eslint --cache --cache-location .cache/.eslintcache --report-unused-disable-directives .",
+@@ -46,3 +42,3 @@
+-    "js-minify-standalone": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.js.map,includeSources,url=bootstrap.min.js.map\" --output dist/js/bootstrap.min.js dist/js/bootstrap.js",
+-    "js-minify-standalone-esm": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.esm.js.map,includeSources,url=bootstrap.esm.min.js.map\" --output dist/js/bootstrap.esm.min.js dist/js/bootstrap.esm.js",
+-    "js-minify-bundle": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.bundle.js.map,includeSources,url=bootstrap.bundle.min.js.map\" --output dist/js/bootstrap.bundle.min.js dist/js/bootstrap.bundle.js",
++    "js-minify-standalone": "../../bin/uglifyjs --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.js.map,includeSources,url=bootstrap.min.js.map\" --output dist/js/bootstrap.min.js dist/js/bootstrap.js",
++    "js-minify-standalone-esm": "../../bin/uglifyjs --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.esm.js.map,includeSources,url=bootstrap.esm.min.js.map\" --output dist/js/bootstrap.esm.min.js dist/js/bootstrap.esm.js",
++    "js-minify-bundle": "../../bin/uglifyjs --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.bundle.js.map,includeSources,url=bootstrap.bundle.min.js.map\" --output dist/js/bootstrap.bundle.min.js dist/js/bootstrap.bundle.js",
+@@ -56,25 +52 @@
+-    "lint": "npm-run-all --parallel js-lint css-lint lockfile-lint",
+-    "docs": "npm-run-all docs-build docs-lint",
+-    "docs-build": "hugo --cleanDestinationDir",
+-    "docs-compile": "npm run docs-build",
+-    "docs-linkinator": "linkinator _gh_pages --recurse --silent --skip \"^(?!http://localhost)\"",
+-    "docs-vnu": "node build/vnu-jar.js",
+-    "docs-lint": "npm-run-all --parallel docs-vnu docs-linkinator",
+-    "docs-serve": "hugo server --port 9001 --disableFastRender",
+-    "docs-serve-only": "npx sirv-cli _gh_pages --port 9001",
+-    "lockfile-lint": "lockfile-lint --allowed-hosts npm --allowed-schemes https: --empty-hostname false --type npm --path package-lock.json",
+-    "update-deps": "ncu -u -x karma-browserstack-launcher,terser && npm update && echo Manually update site/assets/js/vendor",
+-    "release": "npm-run-all dist release-sri docs-build release-zip*",
+-    "release-sri": "node build/generate-sri.js",
+-    "release-version": "node build/change-version.js",
+-    "release-zip": "cross-env-shell \"rm -rf bootstrap-\$npm_package_version-dist && cp -r dist/ bootstrap-\$npm_package_version-dist && zip -r9 bootstrap-\$npm_package_version-dist.zip bootstrap-\$npm_package_version-dist && rm -rf bootstrap-\$npm_package_version-dist\"",
+-    "release-zip-examples": "node build/zip-examples.js",
+-    "dist": "npm-run-all --parallel css js",
+-    "test": "npm-run-all lint dist js-test docs-build docs-lint",
+-    "netlify": "cross-env-shell HUGO_BASEURL=\$DEPLOY_PRIME_URL npm-run-all dist release-sri docs-build",
+-    "watch": "npm-run-all --parallel watch-*",
+-    "watch-css-main": "nodemon --watch scss/ --ext scss --exec \"npm-run-all css-lint css-compile css-prefix\"",
+-    "watch-css-dist": "nodemon --watch dist/css/ --ext css --ignore \"dist/css/*.rtl.*\" --exec \"npm run css-rtl\"",
+-    "watch-css-docs": "nodemon --watch site/assets/scss/ --ext scss --exec \"npm run css-lint\"",
+-    "watch-js-main": "nodemon --watch js/src/ --ext js --exec \"npm-run-all js-lint js-compile\"",
+-    "watch-js-docs": "nodemon --watch site/assets/js/ --ext js --exec \"npm run js-lint\""
++    "dist": "npm run css && npm run js"
+@@ -103,3 +74,0 @@
+-    "@babel/cli": "^7.12.13",
+-    "@babel/core": "^7.12.13",
+-    "@babel/preset-env": "^7.12.13",
+@@ -107 +75,0 @@
+-    "@rollup/plugin-babel": "^5.2.3",
+@@ -115,4 +82,0 @@
+-    "eslint": "^7.19.0",
+-    "eslint-config-xo": "^0.34.0",
+-    "eslint-plugin-import": "^2.22.1",
+-    "eslint-plugin-unicorn": "^27.0.0",
+@@ -122 +85,0 @@
+-    "hugo-bin": "^0.68.0",
+@@ -128 +90,0 @@
+-    "karma-coverage-istanbul-reporter": "^3.0.3",
+@@ -134,2 +95,0 @@
+-    "linkinator": "^2.13.4",
+-    "lockfile-lint": "^4.3.7",
+@@ -141 +100,0 @@
+-    "rollup-plugin-istanbul": "^3.0.0",
+@@ -144,5 +103 @@
+-    "shelljs": "^0.8.4",
+-    "stylelint": "^13.9.0",
+-    "stylelint-config-twbs-bootstrap": "^2.1.0",
+-    "terser": "5.1.0",
+-    "vnu-jar": "21.2.5"
++    "shelljs": "^0.8.4"
+@@ -155,3 +109,0 @@
+-  "hugo-bin": {
+-    "buildTags": "extended"
+-  },
+EOF
+ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
+rm -rf node_modules \
+&& npm ci \
+&& minify_in_situ "node_modules/@popperjs/core" \
+&& rm -rf dist/js/* \
+&& minify_in_situ "build" \
+&& minify_in_situ "js" \
+&& minify_in_situ "site" \
+&& npm run dist \
+&& minify_in_situ "dist" \
+&& npm run js-test
index 4bcec66..d997b0f 100755 (executable)
@@ -7,7 +7,7 @@ minify_in_situ() {
     ARGS="$UGLIFY_OPTIONS --validate --in-situ"
     DIRS="$1"
     echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
-    for i in `find $DIRS -name '*.js'`
+    for i in `find $DIRS -type f -name '*.js'`
     do
         ARGS="$ARGS $i"
     done
index 8e1ef71..bb79a29 100755 (executable)
@@ -7,7 +7,7 @@ minify_in_situ() {
     ARGS="$UGLIFY_OPTIONS --validate --in-situ"
     DIRS="$1"
     echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
-    for i in `find $DIRS -name '*.js'`
+    for i in `find $DIRS -type f -name '*.js'`
     do
         ARGS="$ARGS $i"
     done
index e245db5..5779ad2 100755 (executable)
@@ -7,11 +7,11 @@ minify_in_situ() {
     ARGS="$UGLIFY_OPTIONS --validate --in-situ"
     DIRS="$1"
     echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
-    for i in `find $DIRS -name '*.js'`
+    for i in `find $DIRS -type f -name '*.js'`
     do
         ARGS="$ARGS $i"
     done
-    for i in `find $DIRS -name '*.mjs'`
+    for i in `find $DIRS -type f -name '*.mjs'`
     do
         ARGS="$ARGS $i"
     done
index 3ff8b70..b38661b 100755 (executable)
@@ -7,7 +7,7 @@ minify_in_situ() {
     ARGS="$UGLIFY_OPTIONS --validate --in-situ"
     DIRS="$1"
     echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
-    for i in `find $DIRS -name '*.js'`
+    for i in `find $DIRS -type f -name '*.js'`
     do
         ARGS="$ARGS $i"
     done
index d3c078f..c80e4d1 100755 (executable)
@@ -7,12 +7,12 @@ minify_in_situ() {
     ARGS="$UGLIFY_OPTIONS --validate --in-situ"
     DIRS="$1"
     echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
-    for i in `find $DIRS -name '*.js'`
+    for i in `find $DIRS -type f -name '*.js'`
     do
         ARGS="$ARGS $i"
     done
     uglify-js $ARGS
-    for i in `find $DIRS -name '*.ts' | grep -v '\.d\.ts'`
+    for i in `find $DIRS -type f -name '*.ts' | grep -v '\.d\.ts'`
     do
         echo "$i"
         node_modules/.bin/esbuild --loader=ts --target=node14 < "$i" \
@@ -34,8 +34,10 @@ rm -rf tmp/rollup \
 -    "prepublishOnly": "pinst --disable && npm ci && npm run lint:nofix && npm run security && npm run build:bootstrap && npm run test:all",
 --- a/test/cli/index.js
 +++ b/test/cli/index.js
-@@ -13,0 +14 @@ sander.rimrafSync(__dirname, 'node_modules');
+@@ -13,0 +14,3 @@ sander.rimrafSync(__dirname, 'node_modules');
++sander.rimrafSync(__dirname, 'samples', 'watch', 'bundle-error');
 +sander.rimrafSync(__dirname, 'samples', 'watch', 'watch-config-error');
++sander.rimrafSync(__dirname, 'samples', 'watch', 'watch-config-initial-error');
 EOF
 ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
 npm install esbuild-wasm@0.8.56 \
index 0576c16..c293f3c 100755 (executable)
@@ -7,16 +7,16 @@ minify_in_situ() {
     ARGS="$UGLIFY_OPTIONS --validate --in-situ"
     DIRS="$1"
     echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
-    for i in `find $DIRS -name '*.js'`
+    for i in `find $DIRS -type f -name '*.js'`
     do
         ARGS="$ARGS $i"
     done
-    for i in `find $DIRS -name '*.mjs'`
+    for i in `find $DIRS -type f -name '*.mjs'`
     do
         ARGS="$ARGS $i"
     done
     uglify-js $ARGS
-    for i in `find $DIRS -name '*.ts' | grep -v '\.d\.ts'`
+    for i in `find $DIRS -type f -name '*.ts' | grep -v '\.d\.ts'`
     do
         echo "$i"
         node_modules/.bin/esbuild --loader=ts --target=node14 < "$i" \
index cf089db..d7218d3 100755 (executable)
@@ -7,7 +7,7 @@ minify_in_situ() {
     ARGS="$UGLIFY_OPTIONS --validate --in-situ"
     DIRS="$1"
     echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
-    for i in `find $DIRS -name '*.js'`
+    for i in `find $DIRS -type f -name '*.js'`
     do
         ARGS="$ARGS $i"
     done