Commit e0426340 authored by Ville Immonen's avatar Ville Immonen Committed by GitHub
Browse files

Remove bundledDependencies (#1068)

* Remove bundledDependencies
* Change the e2e scripts to use local file dependencies instead of
  bundledDependencies to test the packages
parent 29299f2d
No related merge requests found
Showing with 26 additions and 77 deletions
+26 -77
...@@ -68,7 +68,7 @@ and then run `npm start` or `npm run build`. ...@@ -68,7 +68,7 @@ and then run `npm start` or `npm run build`.
6. Make sure to include “Migrating from ...” instructions for the previous release. Often you can copy and paste them. 6. Make sure to include “Migrating from ...” instructions for the previous release. Often you can copy and paste them.
7. After merging the changelog update, create a GitHub Release with the same text. See previous Releases for inspiration. 7. After merging the changelog update, create a GitHub Release with the same text. See previous Releases for inspiration.
8. **Do not run `npm publish`. Instead, run `npm run publish`.** 8. **Do not run `npm publish`. Instead, run `npm run publish`.**
9. Wait for a long time, and it will get published. Don’t worry that it’s stuck. It will bundle dependencies into a single tarball before publishing for faster installs. In the end the publish script will prompt for versions before publishing the packages. 9. Wait for a long time, and it will get published. Don’t worry that it’s stuck. In the end the publish script will prompt for versions before publishing the packages.
Make sure to test the released version! If you want to be extra careful, you can publish a prerelease by running `npm run publish -- --tag next` instead of `npm run publish`. Make sure to test the released version! If you want to be extra careful, you can publish a prerelease by running `npm run publish -- --tag next` instead of `npm run publish`.
......
...@@ -68,57 +68,10 @@ ...@@ -68,57 +68,10 @@
"whatwg-fetch": "1.0.0" "whatwg-fetch": "1.0.0"
}, },
"devDependencies": { "devDependencies": {
"bundle-deps": "1.0.0",
"react": "^15.3.0", "react": "^15.3.0",
"react-dom": "^15.3.0" "react-dom": "^15.3.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"fsevents": "1.0.14" "fsevents": "1.0.14"
}, }
"bundledDependencies": [
"autoprefixer",
"babel-core",
"babel-eslint",
"babel-jest",
"babel-loader",
"babel-preset-react-app",
"case-sensitive-paths-webpack-plugin",
"chalk",
"connect-history-api-fallback",
"cross-spawn",
"css-loader",
"detect-port",
"dotenv",
"eslint",
"eslint-config-react-app",
"eslint-loader",
"eslint-plugin-flowtype",
"eslint-plugin-import",
"eslint-plugin-jsx-a11y",
"eslint-plugin-react",
"extract-text-webpack-plugin",
"file-loader",
"filesize",
"find-cache-dir",
"fs-extra",
"gzip-size",
"html-webpack-plugin",
"http-proxy-middleware",
"jest",
"json-loader",
"object-assign",
"path-exists",
"postcss-loader",
"promise",
"react-dev-utils",
"recursive-readdir",
"rimraf",
"strip-ansi",
"style-loader",
"url-loader",
"webpack",
"webpack-dev-server",
"webpack-manifest-plugin",
"whatwg-fetch"
]
} }
...@@ -59,9 +59,9 @@ cd packages/react-scripts ...@@ -59,9 +59,9 @@ cd packages/react-scripts
# Save package.json because we're going to touch it # Save package.json because we're going to touch it
cp package.json package.json.orig cp package.json package.json.orig
# Like bundle-deps, this script modifies packages/react-scripts/package.json, # Replace own dependencies (those in the `packages` dir) with the local paths
# copying own dependencies (those in the `packages` dir) to bundledDependencies # of those packages.
node $root_path/tasks/bundle-own-deps.js node $root_path/tasks/replace-own-deps.js
# Finally, pack react-scripts # Finally, pack react-scripts
scripts_path=$root_path/packages/react-scripts/`npm pack` scripts_path=$root_path/packages/react-scripts/`npm pack`
...@@ -75,6 +75,9 @@ mv package.json.orig package.json ...@@ -75,6 +75,9 @@ mv package.json.orig package.json
# Now that we have packed them, call the global CLI. # Now that we have packed them, call the global CLI.
# ****************************************************************************** # ******************************************************************************
# If Yarn is installed, clean its cache because it may have cached react-scripts
yarn cache clean || true
# Go back to the root directory and run the command from here # Go back to the root directory and run the command from here
cd $root_path cd $root_path
node packages/create-react-app/index.js --scripts-version=$scripts_path "$@" node packages/create-react-app/index.js --scripts-version=$scripts_path "$@"
......
...@@ -57,6 +57,7 @@ if [ "$USE_YARN" = "yes" ] ...@@ -57,6 +57,7 @@ if [ "$USE_YARN" = "yes" ]
then then
# Install Yarn so that the test can use it to install packages. # Install Yarn so that the test can use it to install packages.
npm install -g yarn npm install -g yarn
yarn cache clean
fi fi
npm install npm install
...@@ -96,13 +97,20 @@ cli_path=$PWD/`npm pack` ...@@ -96,13 +97,20 @@ cli_path=$PWD/`npm pack`
# Go to react-scripts # Go to react-scripts
cd $root_path/packages/react-scripts cd $root_path/packages/react-scripts
# Like bundle-deps, this script modifies packages/react-scripts/package.json, # Save package.json because we're going to touch it
# copying own dependencies (those in the `packages` dir) to bundledDependencies cp package.json package.json.orig
node $root_path/tasks/bundle-own-deps.js
# Replace own dependencies (those in the `packages` dir) with the local paths
# of those packages.
node $root_path/tasks/replace-own-deps.js
# Finally, pack react-scripts # Finally, pack react-scripts
scripts_path=$root_path/packages/react-scripts/`npm pack` scripts_path=$root_path/packages/react-scripts/`npm pack`
# Restore package.json
rm package.json
mv package.json.orig package.json
# ****************************************************************************** # ******************************************************************************
# Now that we have packed them, create a clean app folder and install them. # Now that we have packed them, create a clean app folder and install them.
# ****************************************************************************** # ******************************************************************************
......
...@@ -39,23 +39,6 @@ if [ -n "$(git status --porcelain)" ]; then ...@@ -39,23 +39,6 @@ if [ -n "$(git status --porcelain)" ]; then
exit 1; exit 1;
fi fi
# Update deps
rm -rf node_modules
rm -rf ~/.npm
npm cache clear
npm install
cd packages/react-scripts
# Force dedupe
npm dedupe
# Don't bundle fsevents because it is optional and OS X-only
# Since it's in optionalDependencies, it will attempt install outside bundle
rm -rf node_modules/fsevents
# This modifies package.json to copy all dependencies to bundledDependencies
node ./node_modules/.bin/bundle-deps
cd $root_path cd $root_path
# Go! # Go!
./node_modules/.bin/lerna publish --independent "$@" ./node_modules/.bin/lerna publish --independent "$@"
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
*/ */
'use strict'; 'use strict';
// Like bundle-deps, this script modifies packages/react-scripts/package.json, // Replaces internal dependencies in package.json with local package paths.
// copying own dependencies (those in the `packages` dir) to bundledDependencies
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
...@@ -19,10 +18,13 @@ const packagesDir = path.join(__dirname, '../packages'); ...@@ -19,10 +18,13 @@ const packagesDir = path.join(__dirname, '../packages');
const pkgFilename = path.join(packagesDir, 'react-scripts/package.json'); const pkgFilename = path.join(packagesDir, 'react-scripts/package.json');
const data = require(pkgFilename); const data = require(pkgFilename);
data.bundledDependencies = fs.readdirSync(packagesDir) fs.readdirSync(packagesDir).forEach((name) => {
.filter((name) => data.dependencies[name]); if (data.dependencies[name]) {
data.dependencies[name] = 'file:' + path.join(packagesDir, name);
}
})
fs.writeFile(pkgFilename, JSON.stringify(data, null, 2), 'utf8', (err) => { fs.writeFile(pkgFilename, JSON.stringify(data, null, 2), 'utf8', (err) => {
if (err) throw err; if (err) throw err;
console.log('bundled ' + data.bundledDependencies.length + ' dependencies.'); console.log('Replaced local dependencies.');
}); });
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment