Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(progress): re-add progress bar to reify #2944

Merged
merged 1 commit into from Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/ci.js
Expand Up @@ -42,8 +42,14 @@ class CI extends BaseCommand {
}

const where = this.npm.prefix
const arb = new Arborist({ ...this.npm.flatOptions, path: where })
const opts = {
...this.npm.flatOptions,
path: where,
log: this.npm.log,
save: false, // npm ci should never modify the lockfile or package.json
}

const arb = new Arborist(opts)
await Promise.all([
arb.loadVirtual().catch(er => {
log.verbose('loadVirtual', er.stack)
Expand All @@ -55,8 +61,7 @@ class CI extends BaseCommand {
}),
removeNodeModules(where),
])
// npm ci should never modify the lockfile or package.json
await arb.reify({ ...this.npm.flatOptions, save: false })
await arb.reify(opts)

const ignoreScripts = this.npm.config.get('ignore-scripts')
// run the same set of scripts that `npm install` runs.
Expand Down
1 change: 1 addition & 0 deletions lib/dedupe.js
Expand Up @@ -30,6 +30,7 @@ class Dedupe extends BaseCommand {
const where = this.npm.prefix
const opts = {
...this.npm.flatOptions,
log: this.npm.log,
path: where,
dryRun,
}
Expand Down
12 changes: 10 additions & 2 deletions lib/exec.js
Expand Up @@ -175,7 +175,11 @@ class Exec extends BaseCommand {
if (needInstall) {
const installDir = this.cacheInstallDir(packages)
await mkdirp(installDir)
const arb = new Arborist({ ...this.npm.flatOptions, path: installDir })
const arb = new Arborist({
...this.npm.flatOptions,
log: this.npm.log,
path: installDir,
})
const tree = await arb.loadActual()

// at this point, we have to ensure that we get the exact same
Expand Down Expand Up @@ -212,7 +216,11 @@ class Exec extends BaseCommand {
throw new Error('canceled')
}
}
await arb.reify({ ...this.npm.flatOptions, add })
await arb.reify({
...this.npm.flatOptions,
log: this.npm.log,
add,
})
}
pathArr.unshift(resolve(installDir, 'node_modules/.bin'))
}
Expand Down
1 change: 1 addition & 0 deletions lib/install.js
Expand Up @@ -128,6 +128,7 @@ class Install extends BaseCommand {

const opts = {
...this.npm.flatOptions,
log: this.npm.log,
auditLevel: null,
path: where,
add: args,
Expand Down
9 changes: 8 additions & 1 deletion lib/link.js
Expand Up @@ -66,6 +66,7 @@ class Link extends BaseCommand {
const globalOpts = {
...this.npm.flatOptions,
path: globalTop,
log: this.npm.log,
global: true,
prune: false,
}
Expand Down Expand Up @@ -113,12 +114,14 @@ class Link extends BaseCommand {
// reify all the pending names as symlinks there
const localArb = new Arborist({
...this.npm.flatOptions,
log: this.npm.log,
path: this.npm.prefix,
save,
})
await localArb.reify({
...this.npm.flatOptions,
path: this.npm.prefix,
log: this.npm.log,
add: names.map(l => `file:${resolve(globalTop, 'node_modules', l)}`),
save,
})
Expand All @@ -131,9 +134,13 @@ class Link extends BaseCommand {
const arb = new Arborist({
...this.npm.flatOptions,
path: globalTop,
log: this.npm.log,
global: true,
})
await arb.reify({ add: [`file:${this.npm.prefix}`] })
await arb.reify({
add: [`file:${this.npm.prefix}`],
log: this.npm.log,
})
await reifyFinish(this.npm, arb)
}

Expand Down
8 changes: 5 additions & 3 deletions lib/prune.js
Expand Up @@ -30,11 +30,13 @@ class Prune extends BaseCommand {

async prune () {
const where = this.npm.prefix
const arb = new Arborist({
const opts = {
...this.npm.flatOptions,
path: where,
})
await arb.prune(this.npm.flatOptions)
log: this.npm.log,
}
const arb = new Arborist(opts)
await arb.prune(opts)
await reifyFinish(this.npm, arb)
}
}
Expand Down
11 changes: 7 additions & 4 deletions lib/uninstall.js
Expand Up @@ -61,12 +61,15 @@ class Uninstall extends BaseCommand {
}
}

const arb = new Arborist({ ...this.npm.flatOptions, path })

await arb.reify({
const opts = {
...this.npm.flatOptions,
path,
log: this.npm.log,
rm: args,
})

}
const arb = new Arborist(opts)
await arb.reify(opts)
await reifyFinish(this.npm, arb)
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/update.js
Expand Up @@ -51,6 +51,7 @@ class Update extends BaseCommand {

const arb = new Arborist({
...this.npm.flatOptions,
log: this.npm.log,
path: where,
})

Expand Down
7 changes: 4 additions & 3 deletions test/lib/update.js
Expand Up @@ -10,6 +10,7 @@ const config = {
const noop = () => null
const npm = mockNpm({
globalDir: '',
log: noop,
config,
prefix: '',
})
Expand Down Expand Up @@ -38,7 +39,7 @@ t.test('no args', t => {
constructor (args) {
t.deepEqual(
args,
{ ...npm.flatOptions, path: npm.prefix },
{ ...npm.flatOptions, path: npm.prefix, log: noop },
'should call arborist contructor with expected args'
)
}
Expand Down Expand Up @@ -72,7 +73,7 @@ t.test('with args', t => {
constructor (args) {
t.deepEqual(
args,
{ ...npm.flatOptions, path: npm.prefix },
{ ...npm.flatOptions, path: npm.prefix, log: noop },
'should call arborist contructor with expected args'
)
}
Expand Down Expand Up @@ -140,7 +141,7 @@ t.test('update --global', t => {
const { path, ...opts } = args
t.deepEqual(
opts,
npm.flatOptions,
{ ...npm.flatOptions, log: noop },
'should call arborist contructor with expected options'
)

Expand Down