Skip to content

Commit 1aa4534

Browse files
RaisinTenRafaelGSS
authored andcommitted
tools: add automation for updating postject dependency
Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #46157 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent f18ab94 commit 1aa4534

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

.github/workflows/tools.yml

+10
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ jobs:
7777
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
7878
./tools/update-undici.sh
7979
fi
80+
- id: postject
81+
subsystem: deps
82+
label: dependencies
83+
run: |
84+
NEW_VERSION=$(npm view postject dist-tags.latest)
85+
CURRENT_VERSION=$(node -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version")
86+
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
87+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
88+
./tools/dep_updaters/update-postject.sh
89+
fi
8090
- id: base64
8191
subsystem: deps
8292
label: dependencies
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Maintaining postject
2+
3+
The [postject](https://github.com/nodejs/postject) dependency is used for the
4+
[Single Executable strategic initiative](https://github.com/nodejs/single-executable).
5+
6+
## Updating postject
7+
8+
The `tools/dep_updaters/update-postject.sh` script automates the update of the
9+
postject source files.
10+
11+
Check that Node.js still builds and tests.
12+
13+
## Committing postject
14+
15+
Add postject: `git add --all test/fixtures/postject-copy`
16+
17+
Commit the changes with a message like:
18+
19+
```text
20+
deps: update postject to 1.0.0-alpha.4
21+
22+
Updated as described in doc/contributing/maintaining-postject.md.
23+
```

tools/dep_updaters/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,23 @@ been created with the changes), do the following:
6060
3. Check that Node.js compiles without errors and the tests pass.
6161
4. Create a commit for the update and in the commit message include the
6262
important/relevant items from the changelog.
63+
64+
## postject
65+
66+
The `update-postject.sh` script downloads postject from the [npm package](http://npmjs.com/package/postject)
67+
and uses it to replace the contents of `test/fixtures/postject-copy`.
68+
69+
In order to update, the following command can be run:
70+
71+
```bash
72+
./tools/dep_updaters/update-postject.sh
73+
```
74+
75+
Once the script has run (either manually, or by CI in which case a PR will have
76+
been created with the changes), do the following:
77+
78+
1. Check the [changelog](https://github.com/nodejs/postject/releases/tag/v1.0.0-alpha.4)
79+
for things that might require changes in Node.js.
80+
2. Check that Node.js compiles without errors and the tests pass.
81+
3. Create a commit for the update and in the commit message include the
82+
important/relevant items from the changelog.

tools/dep_updaters/update-postject.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
# Shell script to update postject in the source tree to the latest release.
4+
5+
# This script must be in the tools directory when it runs because it uses the
6+
# script source file path to determine directories to work in.
7+
8+
set -ex
9+
10+
cd "$( dirname "$0" )/../.." || exit
11+
rm -rf test/fixtures/postject-copy
12+
mkdir test/fixtures/postject-copy
13+
cd test/fixtures/postject-copy || exit
14+
15+
ROOT="$PWD/../../.."
16+
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
17+
[ -x "$NODE" ] || NODE=$(command -v node)
18+
NPM="$ROOT/deps/npm/bin/npm-cli.js"
19+
20+
"$NODE" "$NPM" init --yes
21+
22+
"$NODE" "$NPM" install --no-bin-links --ignore-scripts postject

0 commit comments

Comments
 (0)