7
7
8
8
set -ex
9
9
10
- ROOT =$( cd " $( dirname " $0 " ) /../.." && pwd)
11
- [ -z " $NODE " ] && NODE=" $ROOT /out/Release/node"
10
+ BASE_DIR =$( cd " $( dirname " $0 " ) /../.." && pwd)
11
+ [ -z " $NODE " ] && NODE=" $BASE_DIR /out/Release/node"
12
12
[ -x " $NODE " ] || NODE=$( command -v node)
13
- NPM=" $ROOT /deps/npm/bin/npm-cli.js"
13
+ NPM=" $BASE_DIR /deps/npm/bin/npm-cli.js"
14
+ DEPS_DIR=" $BASE_DIR /deps"
14
15
15
16
# shellcheck disable=SC1091
16
- . " $ROOT /tools/dep_updaters/utils.sh"
17
+ . " $BASE_DIR /tools/dep_updaters/utils.sh"
17
18
18
19
NEW_VERSION=$( " $NODE " " $NPM " view acorn dist-tags.latest)
19
- CURRENT_VERSION=$( " $NODE " -p " require( './deps/acorn/acorn/package.json'). version" )
20
+ CURRENT_VERSION=$( " $NODE " " $NPM " --prefix ' ./deps/acorn/acorn/' pkg get version)
20
21
21
22
# This function exit with 0 if new version and current version are the same
22
23
compare_dependency_version " acorn" " $NEW_VERSION " " $CURRENT_VERSION "
23
24
24
25
cd " $( dirname " $0 " ) /../.." || exit
25
26
26
- rm -rf deps/acorn/acorn
27
+ echo " Making temporary workspace... "
27
28
28
- (
29
- rm -rf acorn-tmp
30
- mkdir acorn-tmp
31
- cd acorn-tmp || exit
29
+ WORKSPACE=$( mktemp -d 2> /dev/null || mktemp -d -t ' tmp' )
32
30
33
- " $NODE " " $NPM " init --yes
31
+ cleanup () {
32
+ EXIT_CODE=$?
33
+ [ -d " $WORKSPACE " ] && rm -rf " $WORKSPACE "
34
+ exit $EXIT_CODE
35
+ }
34
36
35
- " $NODE " " $NPM " install --global-style --no-bin-links --ignore-scripts " acorn@$NEW_VERSION "
36
- )
37
+ trap cleanup INT TERM EXIT
38
+
39
+ cd " $WORKSPACE "
40
+
41
+ echo " Fetching acorn source archive..."
42
+
43
+ " $NODE " " $NPM " pack " acorn@$NEW_VERSION "
44
+
45
+ ACORN_TGZ=" acorn-$NEW_VERSION .tgz"
46
+
47
+ log_and_verify_sha256sum " acorn" " $ACORN_TGZ "
48
+
49
+ rm -r " $DEPS_DIR /acorn/acorn" /*
50
+
51
+ tar -xf " $ACORN_TGZ "
52
+
53
+ mv package/* " $DEPS_DIR /acorn/acorn"
37
54
38
55
# update version information in src/acorn_version.h
39
- cat > " $ROOT /src/acorn_version.h" << EOF
56
+ cat > " $BASE_DIR /src/acorn_version.h" << EOF
40
57
// This is an auto generated file, please do not edit.
41
58
// Refer to tools/dep_updaters/update-acorn.sh
42
59
#ifndef SRC_ACORN_VERSION_H_
@@ -45,9 +62,14 @@ cat > "$ROOT/src/acorn_version.h" <<EOF
45
62
#endif // SRC_ACORN_VERSION_H_
46
63
EOF
47
64
48
- mv acorn-tmp/node_modules/acorn deps/acorn
49
-
50
- rm -rf acorn-tmp/
65
+ echo " All done!"
66
+ echo " "
67
+ echo " Please git add acorn, commit the new version:"
68
+ echo " "
69
+ echo " $ git add -A deps/acorn/acorn"
70
+ echo " $ git add $BASE_DIR /src/acorn_version.h"
71
+ echo " $ git commit -m \" deps: update acorn to $NEW_VERSION \" "
72
+ echo " "
51
73
52
74
# Update the version number on maintaining-dependencies.md
53
75
# and print the new version as the last line of the script as we need
0 commit comments