From 6884b8c2023a5b76d3565bbe6620a1c7b1f1ed0a Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 10 Jan 2023 12:17:26 +0530 Subject: [PATCH 1/3] tools: add automation for updating postject dependency Signed-off-by: Darshan Sen --- .github/workflows/tools.yml | 10 ++++++++++ doc/contributing/maintaining-postject.md | 23 +++++++++++++++++++++++ tools/update-postject.sh | 23 +++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 doc/contributing/maintaining-postject.md create mode 100755 tools/update-postject.sh diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 3047124a782f67..b98ab199c70e70 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -77,6 +77,16 @@ jobs: echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV ./tools/update-undici.sh fi + - id: postject + subsystem: deps + label: dependencies + run: | + NEW_VERSION=$(npm view postject dist-tags.latest) + CURRENT_VERSION=$(node -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version") + if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + ./tools/update-postject.sh + fi - id: base64 subsystem: deps label: dependencies diff --git a/doc/contributing/maintaining-postject.md b/doc/contributing/maintaining-postject.md new file mode 100644 index 00000000000000..fe87329429b14f --- /dev/null +++ b/doc/contributing/maintaining-postject.md @@ -0,0 +1,23 @@ +# Maintaining postject + +The [postject](https://github.com/nodejs/postject) dependency is used for the +[Single Executable strategic initiative](https://github.com/nodejs/single-executable). + +## Updating postject + +The `tools/update-postject.sh` script automates the update of the postject +source files. + +Check that Node.js still builds and tests. + +## Committing postject + +Add postject: `git add --all test/fixtures/postject-copy` + +Commit the changes with a message like + +```text +deps: update postject to 1.0.0-alpha.4 + +Updated as described in doc/contributing/maintaining-postject.md. +``` diff --git a/tools/update-postject.sh b/tools/update-postject.sh new file mode 100755 index 00000000000000..db244228bb22e3 --- /dev/null +++ b/tools/update-postject.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# Shell script to update postject in the source tree to the latest release. + +# This script must be in the tools directory when it runs because it uses the +# script source file path to determine directories to work in. + +set -ex + +cd "$( dirname "$0" )/.." || exit +rm -rf test/fixtures/postject-copy + +mkdir test/fixtures/postject-copy +cd test/fixtures/postject-copy || exit + +ROOT="$PWD/../../.." +[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" +[ -x "$NODE" ] || NODE=$(command -v node) +NPM="$ROOT/deps/npm/bin/npm-cli.js" + +"$NODE" "$NPM" init --yes + +"$NODE" "$NPM" install --no-bin-links --ignore-scripts postject From c31b663af6ee3a6c99a7a8fbde35767594d55688 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Wed, 11 Jan 2023 18:07:19 +0530 Subject: [PATCH 2/3] tools: move update-postject.sh to tools/dep_updaters Refs: https://github.com/nodejs/node/pull/46157#discussion_r1065918898 Signed-off-by: Darshan Sen --- .github/workflows/tools.yml | 2 +- doc/contributing/maintaining-postject.md | 4 ++-- tools/dep_updaters/README.md | 20 ++++++++++++++++++++ tools/{ => dep_updaters}/update-postject.sh | 3 +-- 4 files changed, 24 insertions(+), 5 deletions(-) rename tools/{ => dep_updaters}/update-postject.sh (94%) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index b98ab199c70e70..9b2e29e897a35c 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -85,7 +85,7 @@ jobs: CURRENT_VERSION=$(node -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version") if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - ./tools/update-postject.sh + ./tools/dep_updaters/update-postject.sh fi - id: base64 subsystem: deps diff --git a/doc/contributing/maintaining-postject.md b/doc/contributing/maintaining-postject.md index fe87329429b14f..02b91d47112097 100644 --- a/doc/contributing/maintaining-postject.md +++ b/doc/contributing/maintaining-postject.md @@ -5,8 +5,8 @@ The [postject](https://github.com/nodejs/postject) dependency is used for the ## Updating postject -The `tools/update-postject.sh` script automates the update of the postject -source files. +The `tools/dep_updaters/update-postject.sh` script automates the update of the +postject source files. Check that Node.js still builds and tests. diff --git a/tools/dep_updaters/README.md b/tools/dep_updaters/README.md index 64c59c9d7d5f99..bae6d2be2d0943 100644 --- a/tools/dep_updaters/README.md +++ b/tools/dep_updaters/README.md @@ -60,3 +60,23 @@ been created with the changes), do the following: 3. Check that Node.js compiles without errors and the tests pass. 4. Create a commit for the update and in the commit message include the important/relevant items from the changelog. + +## postject + +The `update-postject.sh` script downloads postject from the [npm package](http://npmjs.com/package/postject) +and uses it to replace the contents of `test/fixtures/postject-copy`. + +In order to update, the following command can be run: + +```bash +./tools/dep_updaters/update-postject.sh +``` + +Once the script has run (either manually, or by CI in which case a PR will have +been created with the changes), do the following: + +1. Check the [changelog](https://github.com/nodejs/postject/releases/tag/v1.0.0-alpha.4) + for things that might require changes in Node.js. +2. Check that Node.js compiles without errors and the tests pass. +3. Create a commit for the update and in the commit message include the + important/relevant items from the changelog. diff --git a/tools/update-postject.sh b/tools/dep_updaters/update-postject.sh similarity index 94% rename from tools/update-postject.sh rename to tools/dep_updaters/update-postject.sh index db244228bb22e3..ceda1866d237c3 100755 --- a/tools/update-postject.sh +++ b/tools/dep_updaters/update-postject.sh @@ -7,9 +7,8 @@ set -ex -cd "$( dirname "$0" )/.." || exit +cd "$( dirname "$0" )/../.." || exit rm -rf test/fixtures/postject-copy - mkdir test/fixtures/postject-copy cd test/fixtures/postject-copy || exit From 6fe1172f9b79fccefced8c09ecaa33883bd13fef Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Wed, 11 Jan 2023 18:18:03 +0530 Subject: [PATCH 3/3] doc: add : to doc/contributing/maintaining-postject.md Refs: https://github.com/nodejs/node/pull/46157#discussion_r1065919824 Signed-off-by: Darshan Sen --- doc/contributing/maintaining-postject.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/contributing/maintaining-postject.md b/doc/contributing/maintaining-postject.md index 02b91d47112097..96746e22796900 100644 --- a/doc/contributing/maintaining-postject.md +++ b/doc/contributing/maintaining-postject.md @@ -14,7 +14,7 @@ Check that Node.js still builds and tests. Add postject: `git add --all test/fixtures/postject-copy` -Commit the changes with a message like +Commit the changes with a message like: ```text deps: update postject to 1.0.0-alpha.4