Skip to content

Commit

Permalink
[Breaking] update to npm-lockfile v3
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 7, 2022
1 parent 60e4f8b commit b52962b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
@@ -1,7 +1,7 @@
{
"root": true,

"extends": "@ljharb/eslint-config/node/6",
"extends": "@ljharb/eslint-config/node/12",

"rules": {
"array-bracket-newline": 0,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node.yml
Expand Up @@ -6,12 +6,12 @@ jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 6'
range: '>=16 || ^14.15 || ^12.13'
type: minors
command: npm run tests-only

node:
name: 'node >= 6'
name: 'node'
needs: [tests]
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion bin.js
Expand Up @@ -50,7 +50,7 @@ if (npmIsGood && (hasPkgLock || hasShrink || isFix)) {
console.log(colors.blue(`npm is v${npmV}; we need ${npmNeeded}; installing npm in a temp dir...`));
}
Promise.all([
getLockfile(pkg, undefined, { npmNeeded }),
getLockfile(pkg),
getProjectTempDir({ npmNeeded }),
]).then(([lockfile, tmpDir]) => {
const lockfilePath = path.join(tmpDir, 'package-lock.json');
Expand Down
2 changes: 1 addition & 1 deletion getProjectTempDir.js
Expand Up @@ -45,7 +45,7 @@ const getRootTempDir = function getRootTempDir(npmNeeded, logger = () => {}) {
};
return writeFile(
path.join(tmpDir, 'package.json'),
JSON.stringify(pkgContents)
JSON.stringify(pkgContents),
).then(() => new Promise((resolve, reject) => {
cleanupHandlers.unshift(() => {
rimraf.sync(path.join(tmpDir, '*'));
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -40,7 +40,7 @@
"fs-copy-file": "^2.1.2",
"libnpx": "^10.2.4",
"node-cleanup": "^2.1.2",
"npm-lockfile": "^2.0.4",
"npm-lockfile": "^3.0.0",
"semver": "^6.3.0",
"tmp": "^0.1.0",
"util.promisify": "^1.1.1"
Expand All @@ -49,12 +49,12 @@
"@ljharb/eslint-config": "^20.1.0",
"auto-changelog": "^2.3.0",
"eslint": "^8.6.0",
"nyc": "^14.1.1",
"nyc": "^15.1.0",
"safe-publish-latest": "^2.0.0",
"tape": "^5.4.0"
},
"engines": {
"node": ">= 10 || ^8 || ^6",
"node": ">=16 || ^14.15 || ^12.13",
"npm": ">= 3"
},
"auto-changelog": {
Expand Down
8 changes: 4 additions & 4 deletions test/index.js
Expand Up @@ -22,14 +22,14 @@ test('fix option', (t) => {
t.equal(error.code, 1, 'error code is 1');
t.match(
hideWarnings(String(error).split('\n'))[1],
/^npm ERR! code (EAUDITNOLOCK|ENOLOCK)$/,
'error message has EAUDITNOLOCK or ENOLOCK'
/^npm ERR! code (?:EAUDITNOLOCK|ENOLOCK)$/,
'error message has EAUDITNOLOCK or ENOLOCK',
);
t.equal(stdout, '', 'no stdout output');
t.match(
hideWarnings(stderr.split('\n'))[0],
/^npm ERR! code (EAUDITNOLOCK|ENOLOCK)$/,
'stderr starts with expected error code'
/^npm ERR! code (?:EAUDITNOLOCK|ENOLOCK)$/,
'stderr starts with expected error code',
);
});
});

0 comments on commit b52962b

Please sign in to comment.