6
6
# LICENSE file in the root directory of this source tree. An additional grant
7
7
# of patent rights can be found in the PATENTS file in the same directory.
8
8
9
- # Start in tests / even if run from root directory
9
+ # Start in tasks / even if run from root directory
10
10
cd " $( dirname " $0 " ) "
11
11
12
12
# Exit the script on any command with non 0 return code
19
19
20
20
# Go to root
21
21
cd ..
22
+ root_path=$PWD
22
23
23
24
# You can only release with npm >= 3
24
25
if [ $( npm -v | head -c 1) -lt 3 ]; then
33
34
34
35
# Create a temporary clean folder that contains production only code.
35
36
# Do not overwrite any files in the current folder.
36
- clean_path=` mktemp -d clean_XXXX `
37
+ clean_path=` mktemp -d 2> /dev/null || mktemp -d -t ' clean_path ' `
37
38
38
39
# Copy some of the project files to the temporary folder.
39
40
# Exclude folders that definitely won’t be part of the package from processing.
40
41
# We will strip the dev-only code there, and then copy files back.
41
42
rsync -av --exclude=' .git' --exclude=$clean_path \
42
43
--exclude=' node_modules' --exclude=' build' \
43
- ' ./' ' $clean_path' > /dev/null
44
+ ' ./' $clean_path > /dev/null
44
45
45
46
# Now remove all the code relevant to development of Create React App.
46
47
cd $clean_path
@@ -64,7 +65,7 @@ npm dedupe
64
65
rm -rf node_modules/fsevents
65
66
66
67
# This modifies $clean_path/package.json to copy all dependencies to bundledDependencies
67
- node . /node_modules/.bin/bundle-deps
68
+ node $root_path /node_modules/.bin/bundle-deps
68
69
69
70
# Go!
70
71
npm publish " $@ "
0 commit comments