From ecab3c1497868a6076c2a22a1a94d9ad395bcd20 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:35:19 +0000 Subject: [PATCH 1/2] deps: bump @npmcli/run-script from 7.0.4 to 8.0.0 Bumps [@npmcli/run-script](https://github.com/npm/run-script) from 7.0.4 to 8.0.0. - [Release notes](https://github.com/npm/run-script/releases) - [Changelog](https://github.com/npm/run-script/blob/main/CHANGELOG.md) - [Commits](https://github.com/npm/run-script/compare/v7.0.4...v8.0.0) --- updated-dependencies: - dependency-name: "@npmcli/run-script" dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e8139754..5e9fba48 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@npmcli/git": "^5.0.0", "@npmcli/installed-package-contents": "^2.0.1", "@npmcli/promise-spawn": "^7.0.0", - "@npmcli/run-script": "^7.0.0", + "@npmcli/run-script": "^8.0.0", "cacache": "^18.0.0", "fs-minipass": "^3.0.0", "minipass": "^7.0.2", From ebbe0b84bb54b819f1199a629927081e76b89e37 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 12 Apr 2024 15:46:10 -0700 Subject: [PATCH 2/2] feat!: remove silent option BREAKING CHANGE: The `silent` option was used to control whether `@npmcli/run-script` would write a banner via `console.log`. Now ouput will be emitted via an `process.emit('output')`. --- README.md | 2 - lib/dir.js | 5 --- tap-snapshots/test/dir.js.test.cjs | 66 ------------------------------ test/dir.js | 18 -------- 4 files changed, 91 deletions(-) diff --git a/README.md b/README.md index 17c027df..dbb0051d 100644 --- a/README.md +++ b/README.md @@ -166,8 +166,6 @@ resolved, and other properties, as they are determined. calls. This allows you to easily avoid hitting the registry multiple times (even just to validate the cache) for a given packument, since it is unlikely to change in the span of a single command. -* `silent` A boolean that determines whether the banner is displayed - when calling `@npmcli/run-script`. * `verifySignatures` A boolean that will make pacote verify the integrity signature of a manifest, if present. There must be a configured `_keys` entry in the config that is scoped to the diff --git a/lib/dir.js b/lib/dir.js index 420afc58..6979462e 100644 --- a/lib/dir.js +++ b/lib/dir.js @@ -41,16 +41,11 @@ class DirFetcher extends Fetcher { // but this function is *also* run when installing git deps const stdio = this.opts.foregroundScripts ? 'inherit' : 'pipe' - // hide the banner if silent opt is passed in, or if prepare running - // in the background. - const banner = this.opts.silent ? false : stdio === 'inherit' - return runScript({ pkg: mani, event: 'prepare', path: this.resolved, stdio, - banner, env: { npm_package_resolved: this.resolved, npm_package_integrity: this.integrity, diff --git a/tap-snapshots/test/dir.js.test.cjs b/tap-snapshots/test/dir.js.test.cjs index 5f1e4c8b..8ef29c8b 100644 --- a/tap-snapshots/test/dir.js.test.cjs +++ b/tap-snapshots/test/dir.js.test.cjs @@ -247,72 +247,6 @@ Object { } ` -exports[`test/dir.js TAP responds to foregroundScripts: true and silent: true > extract 1`] = ` -Object { - "from": "file:test/fixtures/prepare-script", - "integrity": "{integrity}", - "resolved": "\${CWD}/test/fixtures/prepare-script", -} -` - -exports[`test/dir.js TAP responds to foregroundScripts: true and silent: true > file list 1`] = ` -Array [ - "index.js", - "package.json", - "prepare.js", -] -` - -exports[`test/dir.js TAP responds to foregroundScripts: true and silent: true > manifest 1`] = ` -Object { - "_from": "file:test/fixtures/prepare-script", - "_id": "git-prepare-script@1.0.0", - "_integrity": null, - "_resolved": "\${CWD}/test/fixtures/prepare-script", - "devDependencies": Object { - "abbrev": "^1.1.1", - }, - "license": "ISC", - "main": "index.js", - "name": "git-prepare-script", - "scripts": Object { - "prepare": "node prepare.js", - }, - "version": "1.0.0", -} -` - -exports[`test/dir.js TAP responds to foregroundScripts: true and silent: true > packument 1`] = ` -Object { - "dist-tags": Object { - "latest": "1.0.0", - }, - "name": "git-prepare-script", - "versions": Object { - "1.0.0": Object { - "_from": "file:test/fixtures/prepare-script", - "_id": "git-prepare-script@1.0.0", - "_integrity": null, - "_resolved": "\${CWD}/test/fixtures/prepare-script", - "devDependencies": Object { - "abbrev": "^1.1.1", - }, - "dist": Object { - "integrity": null, - "tarball": "file:\${CWD}/test/fixtures/prepare-script", - }, - "license": "ISC", - "main": "index.js", - "name": "git-prepare-script", - "scripts": Object { - "prepare": "node prepare.js", - }, - "version": "1.0.0", - }, - }, -} -` - exports[`test/dir.js TAP with prepare script > extract 1`] = ` Object { "from": "file:test/fixtures/prepare-script", diff --git a/test/dir.js b/test/dir.js index 1eef810b..c61c1aaa 100644 --- a/test/dir.js +++ b/test/dir.js @@ -64,7 +64,6 @@ t.test('with prepare script', async t => { .then(() => t.matchSnapshot(fs.readdirSync(me + '/prepare').sort(), 'file list')) .then(() => t.match(RUNS[0], { stdio: 'pipe', - banner: false, }, 'should run in background')) }) @@ -80,26 +79,9 @@ t.test('responds to foregroundScripts: true', async t => { .then(() => t.matchSnapshot(fs.readdirSync(me + '/prepare').sort(), 'file list')) .then(() => t.match(RUNS[0], { stdio: 'inherit', - banner: true, }, 'should run in foreground')) }) -t.test('responds to foregroundScripts: true and silent: true', async t => { - RUNS.length = 0 - const opt = { foregroundScripts: true, silent: true, tree: await loadActual(prepare) } - const f = new DirFetcher(preparespec, opt) - t.resolveMatchSnapshot(f.packument(), 'packument') - t.resolveMatchSnapshot(f.manifest(), 'manifest') - const index = me + '/prepare/index.js' - return t.resolveMatchSnapshot(f.extract(me + '/prepare'), 'extract') - .then(() => t.spawn(process.execPath, [index], 'test prepared result')) - .then(() => t.matchSnapshot(fs.readdirSync(me + '/prepare').sort(), 'file list')) - .then(() => t.match(RUNS[0], { - stdio: 'inherit', - banner: false, - }, 'should run in foreground, but without banner')) -}) - t.test('missing dir cannot be packed', async t => { const f = new DirFetcher('file:/this/dir/doesnt/exist', { tree: await loadActual() }) return t.rejects(f.extract(me + '/nope'), {