Skip to content

Commit c057b90

Browse files
lukekarrysfritzy
authored andcommitted
feat(config): warn on deprecated configs
1 parent aa4a4da commit c057b90

File tree

4 files changed

+3
-34
lines changed

4 files changed

+3
-34
lines changed

lib/auth/sso.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ function sleep (time) {
3636
}
3737

3838
const login = async (npm, { creds, registry, scope }) => {
39-
log.warn('deprecated', 'SSO --auth-type is deprecated')
40-
4139
const opts = { ...npm.flatOptions, creds, registry, scope }
4240
const { ssoType } = opts
4341

lib/commands/install.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ class Install extends ArboristWorkspaceCmd {
109109
const isGlobalInstall = this.npm.config.get('global')
110110
const where = isGlobalInstall ? globalTop : this.npm.prefix
111111
const forced = this.npm.config.get('force')
112-
const isDev = this.npm.config.get('dev')
113112
const scriptShell = this.npm.config.get('script-shell') || undefined
114113

115114
// be very strict about engines when trying to update npm itself
@@ -140,14 +139,6 @@ class Install extends ArboristWorkspaceCmd {
140139
args = ['.']
141140
}
142141

143-
// TODO: Add warnings for other deprecated flags? or remove this one?
144-
if (isDev) {
145-
log.warn(
146-
'install',
147-
'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.'
148-
)
149-
}
150-
151142
const opts = {
152143
...this.npm.flatOptions,
153144
auditLevel: null,
@@ -163,7 +154,7 @@ class Install extends ArboristWorkspaceCmd {
163154
'preinstall',
164155
'install',
165156
'postinstall',
166-
'prepublish', // XXX should we remove this finally??
157+
'prepublish', // XXX(npm9) should we remove this finally??
167158
'preprepare',
168159
'prepare',
169160
'postprepare',

test/lib/auth/sso.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const t = require('tap')
22

33
let log = ''
4-
let warn = ''
54

65
const _flatOptions = {
76
ssoType: 'oauth',
@@ -15,9 +14,6 @@ const sso = t.mock('../../../lib/auth/sso.js', {
1514
info: (...msgs) => {
1615
log += msgs.join(' ') + '\n'
1716
},
18-
warn: (...msgs) => {
19-
warn += msgs.join(' ')
20-
},
2117
},
2218
'npm-profile': profile,
2319
'npm-registry-fetch': npmFetch,
@@ -44,15 +40,8 @@ t.test('empty login', async (t) => {
4440
'should throw if no sso-type defined in flatOptions'
4541
)
4642

47-
t.equal(
48-
warn,
49-
'deprecated SSO --auth-type is deprecated',
50-
'should print deprecation warning'
51-
)
52-
5343
_flatOptions.ssoType = 'oauth'
5444
log = ''
55-
warn = ''
5645
})
5746

5847
t.test('simple login', async (t) => {
@@ -104,7 +93,6 @@ t.test('simple login', async (t) => {
10493
)
10594

10695
log = ''
107-
warn = ''
10896
delete profile.loginCouch
10997
delete npmFetch.json
11098
})
@@ -151,7 +139,6 @@ t.test('polling retry', async (t) => {
151139
})
152140

153141
log = ''
154-
warn = ''
155142
delete profile.loginCouch
156143
delete npmFetch.json
157144
})
@@ -174,7 +161,6 @@ t.test('polling error', async (t) => {
174161
)
175162

176163
log = ''
177-
warn = ''
178164
delete profile.loginCouch
179165
delete npmFetch.json
180166
})
@@ -193,7 +179,6 @@ t.test('no token retrieved from loginCouch', async (t) => {
193179
)
194180

195181
log = ''
196-
warn = ''
197182
delete profile.loginCouch
198183
})
199184

@@ -211,7 +196,6 @@ t.test('no sso url retrieved from loginCouch', async (t) => {
211196
)
212197

213198
log = ''
214-
warn = ''
215199
delete profile.loginCouch
216200
})
217201

@@ -247,7 +231,6 @@ t.test('scoped login', async (t) => {
247231
)
248232

249233
log = ''
250-
warn = ''
251234
delete profile.loginCouch
252235
delete npmFetch.json
253236
})

test/lib/commands/install.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ t.test('with args, dev=true', async t => {
1212
let REIFY_CALLED = false
1313
let ARB_OBJ = null
1414

15-
const { npm, logs } = await loadMockNpm(t, {
15+
const { npm } = await loadMockNpm(t, {
1616
'@npmcli/run-script': ({ event }) => {
1717
SCRIPTS.push(event)
1818
},
@@ -41,10 +41,7 @@ t.test('with args, dev=true', async t => {
4141
npm.prefix = path.resolve(t.testdir({}))
4242

4343
await npm.exec('install', ['fizzbuzz'])
44-
t.match(
45-
logs.warn,
46-
[['install', 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.']]
47-
)
44+
4845
t.match(
4946
ARB_ARGS,
5047
{ global: false, path: npm.prefix, auditLevel: null },

0 commit comments

Comments
 (0)