Skip to content

Commit aba2bc6

Browse files
committed
fix(progress): re-add progress bar to reify
The logger was no longer in flatOptions, we pass it in explicitly now PR-URL: #2944 Credit: @wraithgar Close: #2944 Reviewed-by: @nlf
1 parent e8d2adc commit aba2bc6

File tree

9 files changed

+45
-16
lines changed

9 files changed

+45
-16
lines changed

lib/ci.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ class CI extends BaseCommand {
4242
}
4343

4444
const where = this.npm.prefix
45-
const arb = new Arborist({ ...this.npm.flatOptions, path: where })
45+
const opts = {
46+
...this.npm.flatOptions,
47+
path: where,
48+
log: this.npm.log,
49+
save: false, // npm ci should never modify the lockfile or package.json
50+
}
4651

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

6166
const ignoreScripts = this.npm.config.get('ignore-scripts')
6267
// run the same set of scripts that `npm install` runs.

lib/dedupe.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Dedupe extends BaseCommand {
3030
const where = this.npm.prefix
3131
const opts = {
3232
...this.npm.flatOptions,
33+
log: this.npm.log,
3334
path: where,
3435
dryRun,
3536
}

lib/exec.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ class Exec extends BaseCommand {
175175
if (needInstall) {
176176
const installDir = this.cacheInstallDir(packages)
177177
await mkdirp(installDir)
178-
const arb = new Arborist({ ...this.npm.flatOptions, path: installDir })
178+
const arb = new Arborist({
179+
...this.npm.flatOptions,
180+
log: this.npm.log,
181+
path: installDir,
182+
})
179183
const tree = await arb.loadActual()
180184

181185
// at this point, we have to ensure that we get the exact same
@@ -212,7 +216,11 @@ class Exec extends BaseCommand {
212216
throw new Error('canceled')
213217
}
214218
}
215-
await arb.reify({ ...this.npm.flatOptions, add })
219+
await arb.reify({
220+
...this.npm.flatOptions,
221+
log: this.npm.log,
222+
add,
223+
})
216224
}
217225
pathArr.unshift(resolve(installDir, 'node_modules/.bin'))
218226
}

lib/install.js

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class Install extends BaseCommand {
128128

129129
const opts = {
130130
...this.npm.flatOptions,
131+
log: this.npm.log,
131132
auditLevel: null,
132133
path: where,
133134
add: args,

lib/link.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class Link extends BaseCommand {
6666
const globalOpts = {
6767
...this.npm.flatOptions,
6868
path: globalTop,
69+
log: this.npm.log,
6970
global: true,
7071
prune: false,
7172
}
@@ -113,12 +114,14 @@ class Link extends BaseCommand {
113114
// reify all the pending names as symlinks there
114115
const localArb = new Arborist({
115116
...this.npm.flatOptions,
117+
log: this.npm.log,
116118
path: this.npm.prefix,
117119
save,
118120
})
119121
await localArb.reify({
120122
...this.npm.flatOptions,
121123
path: this.npm.prefix,
124+
log: this.npm.log,
122125
add: names.map(l => `file:${resolve(globalTop, 'node_modules', l)}`),
123126
save,
124127
})
@@ -131,9 +134,13 @@ class Link extends BaseCommand {
131134
const arb = new Arborist({
132135
...this.npm.flatOptions,
133136
path: globalTop,
137+
log: this.npm.log,
134138
global: true,
135139
})
136-
await arb.reify({ add: [`file:${this.npm.prefix}`] })
140+
await arb.reify({
141+
add: [`file:${this.npm.prefix}`],
142+
log: this.npm.log,
143+
})
137144
await reifyFinish(this.npm, arb)
138145
}
139146

lib/prune.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ class Prune extends BaseCommand {
3030

3131
async prune () {
3232
const where = this.npm.prefix
33-
const arb = new Arborist({
33+
const opts = {
3434
...this.npm.flatOptions,
3535
path: where,
36-
})
37-
await arb.prune(this.npm.flatOptions)
36+
log: this.npm.log,
37+
}
38+
const arb = new Arborist(opts)
39+
await arb.prune(opts)
3840
await reifyFinish(this.npm, arb)
3941
}
4042
}

lib/uninstall.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,15 @@ class Uninstall extends BaseCommand {
6161
}
6262
}
6363

64-
const arb = new Arborist({ ...this.npm.flatOptions, path })
65-
66-
await arb.reify({
64+
const opts = {
6765
...this.npm.flatOptions,
66+
path,
67+
log: this.npm.log,
6868
rm: args,
69-
})
69+
70+
}
71+
const arb = new Arborist(opts)
72+
await arb.reify(opts)
7073
await reifyFinish(this.npm, arb)
7174
}
7275
}

lib/update.js

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class Update extends BaseCommand {
5151

5252
const arb = new Arborist({
5353
...this.npm.flatOptions,
54+
log: this.npm.log,
5455
path: where,
5556
})
5657

test/lib/update.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const config = {
1010
const noop = () => null
1111
const npm = mockNpm({
1212
globalDir: '',
13+
log: noop,
1314
config,
1415
prefix: '',
1516
})
@@ -38,7 +39,7 @@ t.test('no args', t => {
3839
constructor (args) {
3940
t.deepEqual(
4041
args,
41-
{ ...npm.flatOptions, path: npm.prefix },
42+
{ ...npm.flatOptions, path: npm.prefix, log: noop },
4243
'should call arborist contructor with expected args'
4344
)
4445
}
@@ -72,7 +73,7 @@ t.test('with args', t => {
7273
constructor (args) {
7374
t.deepEqual(
7475
args,
75-
{ ...npm.flatOptions, path: npm.prefix },
76+
{ ...npm.flatOptions, path: npm.prefix, log: noop },
7677
'should call arborist contructor with expected args'
7778
)
7879
}
@@ -140,7 +141,7 @@ t.test('update --global', t => {
140141
const { path, ...opts } = args
141142
t.deepEqual(
142143
opts,
143-
npm.flatOptions,
144+
{ ...npm.flatOptions, log: noop },
144145
'should call arborist contructor with expected options'
145146
)
146147

0 commit comments

Comments
 (0)