@@ -12,18 +12,22 @@ DEPS_DIR="${BASE_DIR}/deps"
12
12
# shellcheck disable=SC1091
13
13
. " $BASE_DIR /tools/dep_updaters/utils.sh"
14
14
15
- NEW_VERSION=" $( " $NODE " --input-type=module << 'EOF '
16
- const res = await fetch('https://api.github.com/repos/nodejs/llhttp/releases/latest',
17
- process.env.GITHUB_TOKEN && {
18
- headers: {
19
- "Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
20
- },
21
- });
22
- if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
23
- const { tag_name } = await res.json();
24
- console.log(tag_name.replace('release/v', ''));
15
+ if [ -n " $LOCAL_COPY " ]; then
16
+ NEW_VERSION=$( node -e " console.log(JSON.parse(require('fs').readFileSync('$LOCAL_COPY /package.json', 'utf-8')).version)" )
17
+ else
18
+ NEW_VERSION=" $( " $NODE " --input-type=module << 'EOF '
19
+ const res = await fetch('https://api.github.com/repos/nodejs/llhttp/releases/latest',
20
+ process.env.GITHUB_TOKEN && {
21
+ headers: {
22
+ "Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
23
+ },
24
+ });
25
+ if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
26
+ const { tag_name } = await res.json();
27
+ console.log(tag_name.replace('release/v', ''));
25
28
EOF
26
29
) "
30
+ fi
27
31
28
32
CURRENT_MAJOR_VERSION=$( grep " #define LLHTTP_VERSION_MAJOR" ./deps/llhttp/include/llhttp.h | sed -n " s/^.*MAJOR \(.*\)/\1/p" )
29
33
CURRENT_MINOR_VERSION=$( grep " #define LLHTTP_VERSION_MINOR" ./deps/llhttp/include/llhttp.h | sed -n " s/^.*MINOR \(.*\)/\1/p" )
@@ -48,7 +52,19 @@ cd "$WORKSPACE"
48
52
echo " Replacing existing llhttp (except GYP and GN build files)"
49
53
mv " $DEPS_DIR /llhttp/" * .gn " $DEPS_DIR /llhttp/" * .gni " $WORKSPACE /"
50
54
51
- if echo " $NEW_VERSION " | grep -qs " /" ; then # Download a release
55
+ if [ -n " $LOCAL_COPY " ]; then
56
+ echo " Copying llhttp release from $LOCAL_COPY ..."
57
+
58
+ echo " Building llhttp ..."
59
+ cd " $BASE_DIR "
60
+ cd " $LOCAL_COPY "
61
+ npm install
62
+ RELEASE=$NEW_VERSION make release
63
+
64
+ echo " Copying llhttp release ..."
65
+ rm -rf " $DEPS_DIR /llhttp"
66
+ cp -a release " $DEPS_DIR /llhttp"
67
+ elif echo " $NEW_VERSION " | grep -qs " /" ; then # Download a release
52
68
REPO=" git@github.com:$NEW_VERSION .git"
53
69
BRANCH=$2
54
70
[ -z " $BRANCH " ] && BRANCH=main
@@ -61,7 +77,7 @@ if echo "$NEW_VERSION" | grep -qs "/" ; then # Download a release
61
77
62
78
echo " Building llhttp ..."
63
79
npm install
64
- make release
80
+ RELEASE= $NEW_VERSION make release
65
81
66
82
echo " Copying llhttp release ..."
67
83
rm -rf " $DEPS_DIR /llhttp"
0 commit comments