-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(engines): ensure correct required node version
Closes #237 BREAKING CHANGE: Changed `engines.node` from `>=16` to `>=18.18.0`. `minimatch@10` was updated in `[email protected]` which required `node@>=20` and caused issues in some projects. This change adds a local linter to verify that the node engines of syncpack's dependencies all satisfy syncpack's own node engine. Using this linter found that the minimum node engine of all of syncpack's dependencies is v18.18.0.
- Loading branch information
1 parent
f1e6ce2
commit e8df803
Showing
6 changed files
with
50 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# https://pnpm.io/next/npmrc#auto-install-peers | ||
auto-install-peers=false | ||
# https://pnpm.io/next/npmrc#strict-peer-dependencies | ||
strict-peer-dependencies=true | ||
# https://docs.npmjs.com/cli/v10/using-npm/config#strict-peer-deps | ||
strict-peer-deps=true | ||
# https://docs.npmjs.com/cli/v10/using-npm/config#engine-strict | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { readFileSync } from 'node:fs'; | ||
import { globbySync } from 'globby'; | ||
import { satisfies } from 'semver'; | ||
import root from '../package.json' assert { type: 'json' }; | ||
|
||
const syncpackEngine = root.engines.node.replace('>=', ''); | ||
|
||
const unsatisfiedDependencies = globbySync('node_modules/**/package.json') | ||
.map(filePath => readFileSync(filePath, 'utf8')) | ||
.filter(json => json.includes('"engines"')) | ||
.map(json => JSON.parse(json)) | ||
.filter(file => file.engines?.node) | ||
.map(file => { | ||
const name = file.name; | ||
const dependencyEngine = file.engines.node; | ||
const isSatisfied = satisfies(syncpackEngine, dependencyEngine); | ||
return { | ||
name, | ||
expected: syncpackEngine, | ||
actual: dependencyEngine, | ||
isSatisfied, | ||
}; | ||
}) | ||
.filter(result => !result.isSatisfied); | ||
|
||
if (unsatisfiedDependencies.length) { | ||
console.error( | ||
'The following dependencies have incompatible engines:', | ||
unsatisfiedDependencies, | ||
); | ||
process.exit(1); | ||
} else { | ||
console.info('All dependencies have compatible engines.'); | ||
} |