Skip to content

Rework @herb-tools/node npm lifecycle scripts#108

Merged
marcoroth merged 4 commits intomainfrom
nodejs-lifecycle
Jun 6, 2025
Merged

Rework @herb-tools/node npm lifecycle scripts#108
marcoroth merged 4 commits intomainfrom
nodejs-lifecycle

Conversation

@marcoroth
Copy link
Owner

@marcoroth marcoroth commented May 31, 2025

This pull request updates the package.json file in the javascript/packages/node directory to streamline the build and vendor processes.

The vendoring of libherb and prism is meant to happen before the package gets published. So, by the time the package gets installed in userland, it'll just have to run the install script which uses the node-pre-gyp install --fallback-to-build command to make sure the extension gets compiled.

Previously, it tried the run the yarn vendor:libherb and yarn vendor:prism commands, which a) failed because rimraf is only a development dependency, but even if that worked, it couldn't re-vendor libherb and prism because these scripts use relative paths within the monorepo, which isn't available in the context when a user is installing the package.

❯ yarn add @herb-tools/node
yarn add v1.22.22
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
error /Users/marcoroth/Development/herb-test/node_modules/@herb-tools/node: Command failed.
Exit code: 127
Command: yarn vendor:libherb && yarn vendor:prism && node-pre-gyp install --fallback-to-build
Arguments:
Directory: /Users/marcoroth/Development/herb-test/node_modules/@herb-tools/node
Output:
yarn run v1.22.22
warning ../../../../package.json: No license field
$ yarn clean && rake templates && cp -r ../../../src ./extension/libherb
warning ../../../../package.json: No license field
$ node-pre-gyp clean && rimraf dist/ && rimraf extension/libherb/ && rimraf build/
[info] it worked if it ends with ok
[info] using node-pre-gyp@2.0.0
[info] using node@20.9.0 | darwin | arm64
[info] ok
/bin/sh: rimraf: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@marcoroth marcoroth merged commit 70d983a into main Jun 6, 2025
14 checks passed
@marcoroth marcoroth deleted the nodejs-lifecycle branch June 6, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant