Skip to content

Commit

Permalink
feat!: remove silent option
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Apr 12, 2024
1 parent ecab3c1 commit 3c04e2b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 91 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions lib/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
66 changes: 0 additions & 66 deletions tap-snapshots/test/dir.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 0 additions & 18 deletions test/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
})

Expand All @@ -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'), {
Expand Down

0 comments on commit 3c04e2b

Please sign in to comment.