Socket
Socket
Sign inDemoInstall

@lerna/run-lifecycle

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lerna/run-lifecycle - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0-alpha.0

10

package.json
{
"name": "@lerna/run-lifecycle",
"version": "4.0.0",
"version": "5.0.0-alpha.0",
"description": "An internal Lerna tool",

@@ -20,3 +20,3 @@ "keywords": [

"engines": {
"node": ">= 10.18.0"
"node": "^14.19.3 || >=16.0.0"
},

@@ -35,7 +35,7 @@ "publishConfig": {

"dependencies": {
"@lerna/npm-conf": "4.0.0",
"npm-lifecycle": "^3.1.5",
"@lerna/npm-conf": "5.0.0-alpha.0",
"@npmcli/run-script": "^3.0.2",
"npmlog": "^4.1.2"
},
"gitHead": "4582c476e07dddddd6b2e3ab6e7f52c1f9eed59a"
"gitHead": "5451a79392742a6e942a845de1e46db0a41b1c2e"
}

@@ -0,5 +1,7 @@

// @ts-check
"use strict";
const log = require("npmlog");
const runScript = require("npm-lifecycle");
const runScript = require("@npmcli/run-script");
const npmConf = require("@lerna/npm-conf");

@@ -39,2 +41,11 @@

/**
* Adapted from https://github.com/npm/run-script/blob/bb5156063ea3a7e167a6d5435847d9389146ec89/lib/run-script-pkg.js#L9
* Modified to add back "path" and make it behave more like "npm-lifecycle"
*/
function printCommandBanner(id, event, cmd, path) {
// eslint-disable-next-line no-console
return console.log(`\n> ${id ? `${id} ` : ""}${event} ${path}\n> ${cmd.trim().replace(/\n/g, "\n> ")}\n`);
}
/**
* Run a lifecycle script for a package.

@@ -59,2 +70,3 @@ * @param {import("@lerna/package").Package} pkg

const dir = pkg.location;
const id = `${pkg.name}@${pkg.version}`;
const config = {};

@@ -97,19 +109,37 @@

// TODO: remove pkg._id when npm-lifecycle no longer relies on it
pkg._id = `${pkg.name}@${pkg.version}`; // eslint-disable-line
// _id is needed by @npmcli/run-script
// eslint-disable-next-line no-underscore-dangle
pkg._id = id;
opts.log.silly("lifecycle", "%j starting in %j", stage, pkg.name);
return runScript(pkg, stage, dir, {
config,
dir,
failOk: false,
log: opts.log,
// bring along camelCased aliases
nodeOptions: opts.nodeOptions,
scriptShell: opts.scriptShell,
scriptsPrependNodePath: opts.scriptsPrependNodePath,
unsafePerm: opts.unsafePerm,
// info log here to reproduce previous behavior when this was powered by "npm-lifecycle"
opts.log.info("lifecycle", `${id}~${stage}: ${id}`);
/**
* In order to match the previous behavior of "npm-lifecycle", we have to disable the writing
* to the parent process and print the command banner ourself.
*/
const stdio = "pipe";
if (log.level !== "silent") {
printCommandBanner(id, stage, pkg.scripts[stage], dir);
}
return runScript({
event: stage,
path: dir,
pkg,
args: [],
stdio,
banner: false,
scriptShell: config.scriptShell,
}).then(
() => {
({ stdout }) => {
/**
* This adjustment is based on trying to match the existing integration test outputs when migrating
* from "npm-lifecycle" to "@npmcli/run-script".
*/
// eslint-disable-next-line no-console
console.log(stdout.toString().trimEnd());
opts.log.silly("lifecycle", "%j finished in %j", stage, pkg.name);

@@ -119,3 +149,3 @@ },

// propagate the exit code
const exitCode = err.errno || 1;
const exitCode = err.code || 1;

@@ -122,0 +152,0 @@ // error logging has already occurred on stderr, but we need to stop the chain

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc