@lerna/run-lifecycle
Advanced tools
Comparing version 3.16.2 to 4.0.0
@@ -6,2 +6,31 @@ # Change Log | ||
# [4.0.0](https://github.com/lerna/lerna/compare/v3.22.1...v4.0.0) (2021-02-10) | ||
### Features | ||
* **deps:** Bump dependencies ([affed1c](https://github.com/lerna/lerna/commit/affed1ce0fce91f01b0a9eafe357db2d985b974f)) | ||
* Consume named exports of sibling modules ([63499e3](https://github.com/lerna/lerna/commit/63499e33652bc78fe23751875d74017e2f16a689)) | ||
* Drop support for Node v6.x & v8.x ([ff4bb4d](https://github.com/lerna/lerna/commit/ff4bb4da215555e3bb136f5af09b5cbc631e57bb)) | ||
* Expose named export ([c1303f1](https://github.com/lerna/lerna/commit/c1303f13adc4cf15f96ff25889b52149f8224c0e)) | ||
* Remove default export ([e2f1ec3](https://github.com/lerna/lerna/commit/e2f1ec3dd049d2a89880029908a2aa7c66f15082)) | ||
* **deps:** execa@^4.1.0 ([9051dca](https://github.com/lerna/lerna/commit/9051dcab1a68b56db09b82ab0345c5f36bcfee2d)) | ||
* **run-lifecycle:** Remove figgy-pudding ([1093f87](https://github.com/lerna/lerna/commit/1093f87d867ddcdf0d7b56f21ad9786a7fb8d6c1)) | ||
### BREAKING CHANGES | ||
* The default export has been removed, please use a named export instead. | ||
* Node v6.x & v8.x are no longer supported. Please upgrade to the latest LTS release. | ||
Here's the gnarly one-liner I used to make these changes: | ||
``` | ||
npx lerna exec --concurrency 1 --stream -- 'json -I -f package.json -e '"'"'this.engines=this.engines||{};this.engines.node=">= 10.18.0"'"'" | ||
``` | ||
(requires `npm i -g json` beforehand) | ||
## [3.16.2](https://github.com/lerna/lerna/compare/v3.16.1...v3.16.2) (2019-07-22) | ||
@@ -8,0 +37,0 @@ |
{ | ||
"name": "@lerna/run-lifecycle", | ||
"version": "3.16.2", | ||
"version": "4.0.0", | ||
"description": "An internal Lerna tool", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">= 6.9.0" | ||
"node": ">= 10.18.0" | ||
}, | ||
@@ -35,8 +35,7 @@ "publishConfig": { | ||
"dependencies": { | ||
"@lerna/npm-conf": "3.16.0", | ||
"figgy-pudding": "^3.5.1", | ||
"npm-lifecycle": "^3.1.2", | ||
"@lerna/npm-conf": "4.0.0", | ||
"npm-lifecycle": "^3.1.5", | ||
"npmlog": "^4.1.2" | ||
}, | ||
"gitHead": "d4b1a0e48d1ff241fafa268dbe57256e10f2cdc8" | ||
"gitHead": "4582c476e07dddddd6b2e3ab6e7f52c1f9eed59a" | ||
} |
@@ -5,45 +5,54 @@ "use strict"; | ||
const runScript = require("npm-lifecycle"); | ||
const figgyPudding = require("figgy-pudding"); | ||
const npmConf = require("@lerna/npm-conf"); | ||
module.exports = runLifecycle; | ||
module.exports.runLifecycle = runLifecycle; | ||
module.exports.createRunner = createRunner; | ||
const LifecycleConfig = figgyPudding( | ||
{ | ||
log: { default: log }, | ||
// provide aliases for some dash-cased props | ||
"ignore-prepublish": {}, | ||
ignorePrepublish: "ignore-prepublish", | ||
"ignore-scripts": {}, | ||
ignoreScripts: "ignore-scripts", | ||
"node-options": {}, | ||
nodeOptions: "node-options", | ||
"script-shell": {}, | ||
scriptShell: "script-shell", | ||
"scripts-prepend-node-path": {}, | ||
scriptsPrependNodePath: "scripts-prepend-node-path", | ||
"unsafe-perm": { | ||
// when running scripts explicitly, assume that they're trusted | ||
default: true, | ||
}, | ||
unsafePerm: "unsafe-perm", | ||
}, | ||
{ | ||
other() { | ||
// open up the pudding | ||
return true; | ||
}, | ||
} | ||
); | ||
/** | ||
* @typedef {object} LifecycleConfig | ||
* @property {typeof log} [log] | ||
* @property {boolean} [ignorePrepublish] | ||
* @property {boolean} [ignoreScripts] | ||
* @property {string} [nodeOptions] | ||
* @property {string} [scriptShell] | ||
* @property {boolean} [scriptsPrependNodePath] | ||
* @property {boolean} [unsafePerm=true] | ||
*/ | ||
function runLifecycle(pkg, stage, _opts) { | ||
/** | ||
* Alias dash-cased npmConf to camelCase | ||
* @param {LifecycleConfig} obj | ||
* @returns {LifecycleConfig} | ||
*/ | ||
function flattenOptions(obj) { | ||
return { | ||
ignorePrepublish: obj["ignore-prepublish"], | ||
ignoreScripts: obj["ignore-scripts"], | ||
nodeOptions: obj["node-options"], | ||
scriptShell: obj["script-shell"], | ||
scriptsPrependNodePath: obj["scripts-prepend-node-path"], | ||
unsafePerm: obj["unsafe-perm"], | ||
...obj, | ||
}; | ||
} | ||
/** | ||
* Run a lifecycle script for a package. | ||
* @param {import("@lerna/package").Package} pkg | ||
* @param {string} stage | ||
* @param {LifecycleConfig} options | ||
*/ | ||
function runLifecycle(pkg, stage, options) { | ||
// back-compat for @lerna/npm-conf instances | ||
// https://github.com/isaacs/proto-list/blob/27764cd/proto-list.js#L14 | ||
if ("root" in _opts) { | ||
if ("root" in options) { | ||
// eslint-disable-next-line no-param-reassign | ||
_opts = _opts.snapshot; | ||
options = options.snapshot; | ||
} | ||
const opts = LifecycleConfig(_opts); | ||
const opts = { | ||
log, | ||
unsafePerm: true, | ||
...flattenOptions(options), | ||
}; | ||
const dir = pkg.location; | ||
@@ -71,3 +80,3 @@ const config = {}; | ||
// https://github.com/zkat/figgy-pudding/blob/7d68bd3/index.js#L42-L64 | ||
for (const [key, val] of opts) { | ||
for (const [key, val] of Object.entries(opts)) { | ||
// omit falsy values and circular objects | ||
@@ -107,3 +116,3 @@ if (val != null && key !== "log" && key !== "logstream") { | ||
}, | ||
err => { | ||
(err) => { | ||
// propagate the exit code | ||
@@ -118,4 +127,4 @@ const exitCode = err.errno || 1; | ||
// our yargs.fail() handler expects a numeric .code, not .errno | ||
err.code = exitCode; | ||
// our yargs.fail() handler expects a numeric .exitCode, not .errno | ||
err.exitCode = exitCode; | ||
process.exitCode = exitCode; | ||
@@ -122,0 +131,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12602
3
115
+ Added@lerna/npm-conf@4.0.0(transitive)
+ Addedpify@5.0.0(transitive)
- Removedfiggy-pudding@^3.5.1
- Removed@lerna/npm-conf@3.16.0(transitive)
- Removedfiggy-pudding@3.5.2(transitive)
- Removedpify@4.0.1(transitive)
Updated@lerna/npm-conf@4.0.0
Updatednpm-lifecycle@^3.1.5