Skip to content

Commit

Permalink
Add engines.node field to package.json (#295)
Browse files Browse the repository at this point in the history
The `engines.node` field should be the same as `stylelint`'s `engines.node` (peer dependency).
  • Loading branch information
ybiquitous committed Jul 4, 2023
1 parent dc2e756 commit b6f1895
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions __tests__/engines.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

const { execFileSync } = require('child_process');
const pkg = require('../package.json');

describe('engines.node', () => {
it("is the same as stylelint's one", () => {
const stylelintVersion = pkg.peerDependencies.stylelint;
const [nodeVersion] = JSON.parse(
execFileSync('npm', [
'view',
'--json',
`stylelint@${stylelintVersion}`,
'engines.node',
]).toString(),
);

expect(nodeVersion).toEqual(pkg.engines.node);
});
});
3 changes: 3 additions & 0 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,8 @@
},
"peerDependencies": {
"stylelint": "^15.5.0"
},
"engines": {
"node": "^14.13.1 || >=16.0.0"
}
}

0 comments on commit b6f1895

Please sign in to comment.