Skip to content

Commit

Permalink
chore: added preinstall script (#1167)
Browse files Browse the repository at this point in the history
  • Loading branch information
gperdomor authored Dec 9, 2024
1 parent dd7f1ea commit fd80566
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
# This enables task distribution via Nx Cloud
# Run this command as early as possible, before dependencies are installed
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
# Uncomment this line to enable task distribution
- run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"

# Cache node_modules
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"check-lock-files": "node ./tools/scripts/check-lock-files.mjs",
"commit": "cz",
"prepare": "husky"
"prepare": "husky",
"preinstall": "node ./tools/scripts/preinstall.mjs"
},
"private": true,
"engines": {
Expand Down
17 changes: 17 additions & 0 deletions tools/scripts/preinstall.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* This pre-install script will check that the necessary dependencies are installed
* Checks for:
* - Node 20+
*/

if (process.env.CI) {
process.exit(0);
}

import { lt as semverLessThan } from 'semver';

// Check node version
if (semverLessThan(process.version, '18.12.0')) {
console.error('Please make sure that your installed Node version is greater than v20');
process.exit(1);
}

0 comments on commit fd80566

Please sign in to comment.