From 3c04e2b62c62d16dc2daebe8b1c09d41e144e615 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 12 Apr 2024 15:46:10 -0700 Subject: [PATCH] feat!: remove silent option --- 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 17c027d..dbb0051 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 420afc5..6979462 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 5f1e4c8..8ef29c8 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 1eef810..c61c1aa 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'), {