This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix run unchanged links lifecycle scripts
Users expect workspaces (or regular linked deps) to run their prepare lifecycle script on every reify, since it's often used as some form of compilation step and should run even though that node hasn't changed. Fixes: npm/cli#2900 PR-URL: #290 Credit: @ruyadorno Close: #290 Reviewed-by: @isaacs, @nlf
- Loading branch information
Showing
9 changed files
with
182 additions
and
5 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
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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "a", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"prepare": "node -e \"require('fs').writeFileSync(require('path').resolve('a-prepare'), '')\"" | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
test/fixtures/link-dep-lifecycle-scripts/package-lock.json
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,7 @@ | ||
{ | ||
"name": "link-dep-lifecycle-scripts", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"a": "file:./a" | ||
} | ||
} |
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,71 @@ | ||
// generated from test/fixtures/link-dep-lifecycle-scripts | ||
module.exports = t => { | ||
const path = t.testdir({ | ||
"a": { | ||
"package.json": JSON.stringify({ | ||
"name": "a", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"prepare": "node -e \"require('fs').writeFileSync(require('path').resolve('a-prepare'), '')\"" | ||
} | ||
}) | ||
}, | ||
"node_modules": { | ||
".package-lock.json": JSON.stringify({ | ||
"name": "link-dep-lifecycle-scripts", | ||
"version": "1.0.0", | ||
"lockfileVersion": 2, | ||
"requires": true, | ||
"packages": { | ||
"a": { | ||
"version": "1.0.0" | ||
}, | ||
"node_modules/a": { | ||
"resolved": "a", | ||
"link": true | ||
} | ||
} | ||
}), | ||
"a": t.fixture('symlink', "../a") | ||
}, | ||
"package-lock.json": JSON.stringify({ | ||
"name": "link-dep-lifecycle-scripts", | ||
"version": "1.0.0", | ||
"lockfileVersion": 2, | ||
"requires": true, | ||
"packages": { | ||
"": { | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"a": "file:./a" | ||
} | ||
}, | ||
"a": { | ||
"version": "1.0.0" | ||
}, | ||
"node_modules/a": { | ||
"resolved": "a", | ||
"link": true | ||
} | ||
}, | ||
"dependencies": { | ||
"a": { | ||
"version": "file:a" | ||
} | ||
} | ||
}), | ||
"package.json": JSON.stringify({ | ||
"name": "link-dep-lifecycle-scripts", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"a": "file:./a" | ||
} | ||
}) | ||
}) | ||
const {utimesSync} = require('fs') | ||
const n = Date.now() + 10000 | ||
const {resolve} = require('path') | ||
|
||
utimesSync(resolve(path, "node_modules/.package-lock.json"), new Date(n), new Date(n)) | ||
return path | ||
} |