diff --git a/babel.config.js b/babel.config.js index a216d0b7b..30e555b7d 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,7 +1,6 @@ const path = require('path'); const defaultPresets = [ - '@babel/preset-react', [ '@babel/preset-env', { @@ -13,10 +12,12 @@ const defaultPresets = [ const defaultPlugins = [ ['@babel/plugin-proposal-class-properties', { loose: true }], ['@babel/plugin-proposal-object-rest-spread', { loose: true }], + '@babel/plugin-transform-runtime', '@babel/plugin-transform-object-assign' ]; const productionPlugins = [ + 'babel-plugin-transform-react-constant-elements', [ 'transform-react-remove-prop-types', { @@ -27,15 +28,10 @@ const productionPlugins = [ ]; module.exports = { - presets: defaultPresets, + presets: defaultPresets.concat(['@babel/preset-react']), plugins: defaultPlugins, env: { - production: { - presets: [ - [ - '@babel/preset-env' - ] - ], + cjs: { plugins: productionPlugins } } diff --git a/ci-scripts/publish-rc.sh b/ci-scripts/publish-rc.sh index 0bbd7037d..45d76e4ce 100755 --- a/ci-scripts/publish-rc.sh +++ b/ci-scripts/publish-rc.sh @@ -9,8 +9,4 @@ npm run std-version -- --prerelease rc --no-verify git push --follow-tags "https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG" "$TRAVIS_BRANCH" > /dev/null 2>&1; -npm run build:copy-files - -cd lib - -npm publish --tag prerelease +npm publish lib --tag prerelease diff --git a/ci-scripts/publish.sh b/ci-scripts/publish.sh index 0511184a5..57e6d54cc 100755 --- a/ci-scripts/publish.sh +++ b/ci-scripts/publish.sh @@ -15,13 +15,7 @@ echo "$std_ver" git push --follow-tags "https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG" master > /dev/null 2>&1; -npm run build:copy-files - -cd lib - -npm publish - -cd .. +npm publish lib # run this after publish to make sure GitHub finishes updating from the push npm run release:create -- --repo $TRAVIS_REPO_SLUG --tag $release_tag --branch master diff --git a/package-lock.json b/package-lock.json index f3c678bfb..1f122e67d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -912,9 +912,9 @@ } }, "@babel/plugin-transform-runtime": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.6.0.tgz", - "integrity": "sha512-Da8tMf7uClzwUm/pnJ1S93m/aRXmoYNDD7TkHua8xBDdaAs54uZpTWvEt6NGwmoVMb9mZbntfTqmG2oSzN/7Vg==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.6.2.tgz", + "integrity": "sha512-cqULw/QB4yl73cS5Y0TZlQSjDvNkzDbu0FurTZyHlJpWE5T3PCMdnyV+xXoH1opr1ldyHODe3QAX3OMAii5NxA==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.0.0", @@ -1115,9 +1115,9 @@ } }, "@babel/runtime": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.0.tgz", - "integrity": "sha512-89eSBLJsxNxOERC0Op4vd+0Bqm6wRMqMbFtV3i0/fbaWw/mJ8Q3eBvgX0G4SyrOOLCtbu98HspF8o09MRT+KzQ==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.3.tgz", + "integrity": "sha512-kq6anf9JGjW8Nt5rYfEuGRaEAaH1mkv3Bbu6rYvLOpPh/RusSJXuKPEAoZ7L7gybZkchE8+NV5g9vKF4AGAtsA==", "requires": { "regenerator-runtime": "^0.13.2" } @@ -4601,6 +4601,15 @@ "esutils": "^2.0.2" } }, + "babel-plugin-transform-react-constant-elements": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-constant-elements/-/babel-plugin-transform-react-constant-elements-6.23.0.tgz", + "integrity": "sha1-LxGb9NLN1F65uqrldAU8YE9hR90=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, "babel-plugin-transform-react-remove-prop-types": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz", @@ -4743,6 +4752,18 @@ "@babel/plugin-syntax-object-rest-spread": "^7.2.0" } }, + "@babel/plugin-transform-runtime": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.6.0.tgz", + "integrity": "sha512-Da8tMf7uClzwUm/pnJ1S93m/aRXmoYNDD7TkHua8xBDdaAs54uZpTWvEt6NGwmoVMb9mZbntfTqmG2oSzN/7Vg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0", + "resolve": "^1.8.1", + "semver": "^5.5.1" + } + }, "@babel/preset-env": { "version": "7.6.0", "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.6.0.tgz", @@ -4801,6 +4822,15 @@ "semver": "^5.5.0" } }, + "@babel/runtime": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.0.tgz", + "integrity": "sha512-89eSBLJsxNxOERC0Op4vd+0Bqm6wRMqMbFtV3i0/fbaWw/mJ8Q3eBvgX0G4SyrOOLCtbu98HspF8o09MRT+KzQ==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.2" + } + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -6835,6 +6865,58 @@ "warning": "^4.0.3" } }, + "cross-env": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-6.0.3.tgz", + "integrity": "sha512-+KqxF6LCvfhWvADcDPqo64yVIB31gv/jQulX2NGzKS/g3GEVz6/pt4wjHFtFWsHMddebWD/sDthJemzM4MaAag==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz", + "integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "path-key": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.0.tgz", + "integrity": "sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.1.tgz", + "integrity": "sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", diff --git a/package.json b/package.json index a3b83f343..32c8ee8cf 100644 --- a/package.json +++ b/package.json @@ -11,21 +11,19 @@ "url": "https://github.com/SAP/fundamental-react" }, "scripts": { - "build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/", "build-doc:netlify": "npm run build && NETLIFY=true npm run build-doc", "build-doc": "node scripts/build.js && cp build/index.html build/404.html", - "build-js": "node scripts/build.js", "build:copy-files": "cp -rf package.json README.md NOTICE.txt LICENSE.txt CHANGELOG.md lib", "build:index": "babel-node devtools/buildIndexFiles.js", "build:lint:fix": "npm run build:lint -- --fix", "build:lint": "eslint 'src/**' --ext .js,.jsx --env browser,node", - "build": "npm run build:index && rm -rf lib && NODE_ENV=production babel src --out-dir lib --ignore \"src/**/*.spec.js\",\"src/**/*.test.js\",\"src/**/*.Component.js\",\"src/_playground/*\",\"src/**/*.stories.js\"", - "config:lint:fix": "npm run config:lint -- --fix", + "build:cjs": "cross-env NODE_ENV=production BABEL_ENV=cjs babel src --out-dir lib --ignore \"src/**/*.spec.js\",\"src/**/*.test.js\",\"src/**/*.Component.js\",\"src/_playground/*\",\"src/**/*.stories.js\"", + "build": "npm run build:index && rm -rf lib && npm run build:cjs && npm run build:copy-files", "config:lint": "eslint 'config/**' --ext .js,.jsx --env browser,node", "deploy": "gh-pages -d build", "devtools:lint": "eslint 'devtools/**' --ext .js,.jsx --env browser,node", "docs:dev": "FUNDAMENTAL_REACT_PLAYGROUND=true npm start", - "dry-run": "npm run build && npm publish --dry-run", + "dry-run": "npm run build && npm publish lib --dry-run", "lint:fix": "npm run build:lint:fix && npm run scripts:lint:fix && npm run config:lint:fix", "lint:pre-commit": "printf \"running pre-commit lint...\" && npm run lint && printf \"done!\n\"", "lint": "npm run build:lint && npm run scripts:lint && npm run config:lint && npm run devtools:lint && npm run style:lint", @@ -49,14 +47,15 @@ "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive" }, "dependencies": { + "@babel/runtime": "^7.6.3", "chain-function": "^1.0.1", "classnames": "^2.2.6", - "react-focus-lock": "^2.1.1", "fundamental-styles": "~0.3.0-rc.4", "hoist-non-react-statics": "^3.3.0", "keycode": "^2.2.0", "prop-types": "^15.7.1", "react-foco": "^1.3.0", + "react-focus-lock": "^2.1.1", "react-overlays": "^1.1.2", "react-popper": "^1.3.3", "shortid": "^2.2.14" @@ -68,6 +67,7 @@ "@babel/plugin-proposal-class-properties": "^7.3.0", "@babel/plugin-proposal-object-rest-spread": "^7.3.1", "@babel/plugin-transform-object-assign": "^7.2.0", + "@babel/plugin-transform-runtime": "^7.6.2", "@babel/preset-env": "^7.3.1", "@babel/preset-react": "^7.0.0", "@storybook/addon-a11y": "^5.2.1", @@ -81,6 +81,7 @@ "babel-jest": "^24.8.0", "babel-loader": "8.0.6", "babel-plugin-named-asset-import": "^0.3.2", + "babel-plugin-transform-react-constant-elements": "^6.23.0", "babel-plugin-transform-react-remove-prop-types": "^0.4.23", "babel-preset-react-app": "^9.0.0", "bfj": "7.0.1", @@ -88,6 +89,7 @@ "chalk": "2.4.2", "core-js": "^3.1.4", "coveralls": "^3.0.2", + "cross-env": "^6.0.3", "css-loader": "3.2.0", "dotenv": "8.1.0", "dotenv-expand": "5.1.0", @@ -163,8 +165,5 @@ "not dead", "not ie < 11", "not op_mini all" - ], - "files": [ - "/lib" ] }