From c057b90d0954ff5b6f2973748ae5d41885b99213 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Tue, 12 Apr 2022 23:29:30 -0700 Subject: [PATCH] feat(config): warn on deprecated configs --- lib/auth/sso.js | 2 -- lib/commands/install.js | 11 +---------- test/lib/auth/sso.js | 17 ----------------- test/lib/commands/install.js | 7 ++----- 4 files changed, 3 insertions(+), 34 deletions(-) diff --git a/lib/auth/sso.js b/lib/auth/sso.js index 795eb8972a223..9812a18cb99ca 100644 --- a/lib/auth/sso.js +++ b/lib/auth/sso.js @@ -36,8 +36,6 @@ function sleep (time) { } const login = async (npm, { creds, registry, scope }) => { - log.warn('deprecated', 'SSO --auth-type is deprecated') - const opts = { ...npm.flatOptions, creds, registry, scope } const { ssoType } = opts diff --git a/lib/commands/install.js b/lib/commands/install.js index ebba02a1bd47d..0a5c827bcc97b 100644 --- a/lib/commands/install.js +++ b/lib/commands/install.js @@ -109,7 +109,6 @@ class Install extends ArboristWorkspaceCmd { const isGlobalInstall = this.npm.config.get('global') const where = isGlobalInstall ? globalTop : this.npm.prefix const forced = this.npm.config.get('force') - const isDev = this.npm.config.get('dev') const scriptShell = this.npm.config.get('script-shell') || undefined // be very strict about engines when trying to update npm itself @@ -140,14 +139,6 @@ class Install extends ArboristWorkspaceCmd { args = ['.'] } - // TODO: Add warnings for other deprecated flags? or remove this one? - if (isDev) { - log.warn( - 'install', - 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.' - ) - } - const opts = { ...this.npm.flatOptions, auditLevel: null, @@ -163,7 +154,7 @@ class Install extends ArboristWorkspaceCmd { 'preinstall', 'install', 'postinstall', - 'prepublish', // XXX should we remove this finally?? + 'prepublish', // XXX(npm9) should we remove this finally?? 'preprepare', 'prepare', 'postprepare', diff --git a/test/lib/auth/sso.js b/test/lib/auth/sso.js index eab51f06c0ab2..8d70077ad205f 100644 --- a/test/lib/auth/sso.js +++ b/test/lib/auth/sso.js @@ -1,7 +1,6 @@ const t = require('tap') let log = '' -let warn = '' const _flatOptions = { ssoType: 'oauth', @@ -15,9 +14,6 @@ const sso = t.mock('../../../lib/auth/sso.js', { info: (...msgs) => { log += msgs.join(' ') + '\n' }, - warn: (...msgs) => { - warn += msgs.join(' ') - }, }, 'npm-profile': profile, 'npm-registry-fetch': npmFetch, @@ -44,15 +40,8 @@ t.test('empty login', async (t) => { 'should throw if no sso-type defined in flatOptions' ) - t.equal( - warn, - 'deprecated SSO --auth-type is deprecated', - 'should print deprecation warning' - ) - _flatOptions.ssoType = 'oauth' log = '' - warn = '' }) t.test('simple login', async (t) => { @@ -104,7 +93,6 @@ t.test('simple login', async (t) => { ) log = '' - warn = '' delete profile.loginCouch delete npmFetch.json }) @@ -151,7 +139,6 @@ t.test('polling retry', async (t) => { }) log = '' - warn = '' delete profile.loginCouch delete npmFetch.json }) @@ -174,7 +161,6 @@ t.test('polling error', async (t) => { ) log = '' - warn = '' delete profile.loginCouch delete npmFetch.json }) @@ -193,7 +179,6 @@ t.test('no token retrieved from loginCouch', async (t) => { ) log = '' - warn = '' delete profile.loginCouch }) @@ -211,7 +196,6 @@ t.test('no sso url retrieved from loginCouch', async (t) => { ) log = '' - warn = '' delete profile.loginCouch }) @@ -247,7 +231,6 @@ t.test('scoped login', async (t) => { ) log = '' - warn = '' delete profile.loginCouch delete npmFetch.json }) diff --git a/test/lib/commands/install.js b/test/lib/commands/install.js index d5db3af673caa..afb6adb4fb0a5 100644 --- a/test/lib/commands/install.js +++ b/test/lib/commands/install.js @@ -12,7 +12,7 @@ t.test('with args, dev=true', async t => { let REIFY_CALLED = false let ARB_OBJ = null - const { npm, logs } = await loadMockNpm(t, { + const { npm } = await loadMockNpm(t, { '@npmcli/run-script': ({ event }) => { SCRIPTS.push(event) }, @@ -41,10 +41,7 @@ t.test('with args, dev=true', async t => { npm.prefix = path.resolve(t.testdir({})) await npm.exec('install', ['fizzbuzz']) - t.match( - logs.warn, - [['install', 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.']] - ) + t.match( ARB_ARGS, { global: false, path: npm.prefix, auditLevel: null },