Skip to content

Commit d49d3f4

Browse files
committed
# Conflicts: # tasks/cra.sh # tasks/release.sh
2 parents ae61c98 + 058b2cc commit d49d3f4

File tree

7 files changed

+28
-23
lines changed

7 files changed

+28
-23
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ and then run `npm start` or `npm run build`.
6868
6. Make sure to include “Migrating from ...” instructions for the previous release. Often you can copy and paste them.
6969
7. After merging the changelog update, create a GitHub Release with the same text. See previous Releases for inspiration.
7070
8. **Do not run `npm publish`. Instead, run `npm run publish`.**
71-
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.
71+
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.
7272

7373
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`.
7474

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ module.exports = {
127127
// A missing `test` is equivalent to a match.
128128
{
129129
exclude: [
130+
/\.(html)$/,
130131
/\.(js|jsx)$/,
131132
/\.css$/,
132133
/\.html$/,

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ module.exports = {
135135
// A missing `test` is equivalent to a match.
136136
{
137137
exclude: [
138+
/\.(html)$/,
138139
/\.(js|jsx)$/,
139140
/\.css$/,
140141
/\.html$/,

tasks/cra.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ cd packages/react-scripts
5959
# Save package.json because we're going to touch it
6060
cp package.json package.json.orig
6161

62+
# Replace own dependencies (those in the `packages` dir) with the local paths
63+
# of those packages.
64+
node $root_path/tasks/replace-own-deps.js
65+
6266
# Finally, pack react-scripts
6367
scripts_path=$root_path/packages/react-scripts/`npm pack`
6468

@@ -71,6 +75,9 @@ mv package.json.orig package.json
7175
# Now that we have packed them, call the global CLI.
7276
# ******************************************************************************
7377

78+
# If Yarn is installed, clean its cache because it may have cached react-scripts
79+
yarn cache clean || true
80+
7481
# Go back to the root directory and run the command from here
7582
cd $root_path
7683
node packages/create-react-app/index.js --scripts-version=$scripts_path "$@"

tasks/e2e.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ if [ "$USE_YARN" = "yes" ]
5757
then
5858
# Install Yarn so that the test can use it to install packages.
5959
npm install -g yarn
60+
yarn cache clean
6061
fi
6162

6263
npm install
@@ -96,13 +97,20 @@ cli_path=$PWD/`npm pack`
9697
# Go to react-scripts
9798
cd $root_path/packages/react-scripts
9899

99-
# Like bundle-deps, this script modifies packages/react-scripts/package.json,
100-
# copying own dependencies (those in the `packages` dir) to bundledDependencies
101-
node $root_path/tasks/bundle-own-deps.js
100+
# Save package.json because we're going to touch it
101+
cp package.json package.json.orig
102+
103+
# Replace own dependencies (those in the `packages` dir) with the local paths
104+
# of those packages.
105+
node $root_path/tasks/replace-own-deps.js
102106

103107
# Finally, pack react-scripts
104108
scripts_path=$root_path/packages/react-scripts/`npm pack`
105109

110+
# Restore package.json
111+
rm package.json
112+
mv package.json.orig package.json
113+
106114
# ******************************************************************************
107115
# Now that we have packed them, create a clean app folder and install them.
108116
# ******************************************************************************

tasks/release.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,6 @@ if [ -n "$(git status --porcelain)" ]; then
3939
exit 1;
4040
fi
4141

42-
# Update deps
43-
rm -rf node_modules
44-
rm -rf ~/.npm
45-
npm cache clear
46-
npm install
47-
48-
cd packages/react-scripts
49-
# Force dedupe
50-
npm dedupe
51-
52-
# Don't bundle fsevents because it is optional and OS X-only
53-
# Since it's in optionalDependencies, it will attempt install outside bundle
54-
rm -rf node_modules/fsevents
55-
5642
cd $root_path
5743
# Go!
5844
./node_modules/.bin/lerna publish --independent "$@"

tasks/bundle-own-deps.js renamed to tasks/replace-own-deps.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
*/
1010
'use strict';
1111

12-
// Like bundle-deps, this script modifies packages/react-scripts/package.json,
13-
// copying own dependencies (those in the `packages` dir) to bundledDependencies
12+
// Replaces internal dependencies in package.json with local package paths.
1413

1514
const fs = require('fs');
1615
const path = require('path');
@@ -19,10 +18,13 @@ const packagesDir = path.join(__dirname, '../packages');
1918
const pkgFilename = path.join(packagesDir, 'react-scripts/package.json');
2019
const data = require(pkgFilename);
2120

22-
data.bundledDependencies = fs.readdirSync(packagesDir)
23-
.filter((name) => data.dependencies[name]);
21+
fs.readdirSync(packagesDir).forEach((name) => {
22+
if (data.dependencies[name]) {
23+
data.dependencies[name] = 'file:' + path.join(packagesDir, name);
24+
}
25+
})
2426

2527
fs.writeFile(pkgFilename, JSON.stringify(data, null, 2), 'utf8', (err) => {
2628
if (err) throw err;
27-
console.log('bundled ' + data.bundledDependencies.length + ' dependencies.');
29+
console.log('Replaced local dependencies.');
2830
});

0 commit comments

Comments
 (0)