@@ -16,10 +16,8 @@ cd "$(dirname "$0")"
1616
1717function cleanup {
1818 echo ' Cleaning up.'
19- cd $root_path
2019 # Uncomment when snapshot testing is enabled by default:
2120 # rm ./template/src/__snapshots__/App.test.js.snap
22- rm -rf $clean_path
2321}
2422
2523# Error messages are redirected to stderr
@@ -53,41 +51,17 @@ root_path=$PWD
5351# Pack react-scripts so we can verify they work.
5452# ******************************************************************************
5553
56- # Packing react-scripts takes some work because we want to clean it up first.
57- # Create a temporary clean folder that contains production only code.
58- # Do not overwrite any files in the current folder.
59- clean_path=` mktemp -d 2> /dev/null || mktemp -d -t ' clean_path' `
60-
61- # Copy some of the react-scripts project files to the temporary folder.
62- # Exclude folders that definitely won’t be part of the package from processing.
63- # We will strip the dev-only code there, `npm pack`, and copy the package back.
64- cd $root_path
65- rsync -av --exclude=' .git' --exclude=$clean_path \
66- --exclude=' node_modules' --exclude=' build' \
67- ' ./' $clean_path > /dev/null
68-
69- # Open the clean folder
70- cd $clean_path /packages/react-scripts
71-
72- # Now remove all the code relevant to development of Create React App.
73- files=" $( find -L . -name " *.js" -type f) "
74- for file in $files ; do
75- sed -i.bak ' /\/\/ @remove-on-publish-begin/,/\/\/ @remove-on-publish-end/d' $file
76- rm $file .bak
77- done
78-
7954# Install all our packages
80- cd $clean_path
8155$root_path /node_modules/.bin/lerna bootstrap
8256
83- cd $clean_path / packages/react-scripts
57+ cd packages/react-scripts
8458
8559# Like bundle-deps, this script modifies packages/react-scripts/package.json,
8660# copying own dependencies (those in the `packages` dir) to bundledDependencies
87- node $clean_path /tasks/bundle-own-deps.js
61+ node $root_path /tasks/bundle-own-deps.js
8862
8963# Finally, pack react-scripts
90- scripts_path=$clean_path /packages/react-scripts/` npm pack`
64+ scripts_path=$root_path /packages/react-scripts/` npm pack`
9165
9266# ******************************************************************************
9367# Now that we have packed them, call the global CLI.
0 commit comments