From 5f5b986a5433a8f359ebb09de7ab935df1d0cef4 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Tue, 12 Apr 2022 23:29:30 -0700 Subject: [PATCH 1/2] 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 }, From 42d2db6e7d9740439e0046fb0b2ff0b98b1d6e05 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Wed, 13 Apr 2022 09:41:50 -0700 Subject: [PATCH 2/2] deps: @npmcli/config@4.1.0 --- node_modules/@npmcli/config/lib/index.js | 5 ++--- node_modules/@npmcli/config/package.json | 6 +++--- package-lock.json | 14 +++++++------- package.json | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/node_modules/@npmcli/config/lib/index.js b/node_modules/@npmcli/config/lib/index.js index bb8c24602fa52..5b7ea68e91e36 100644 --- a/node_modules/@npmcli/config/lib/index.js +++ b/node_modules/@npmcli/config/lib/index.js @@ -506,10 +506,9 @@ class Config { } [_checkDeprecated] (key, where, obj, kv) { - // XXX a future npm version will make this a warning. - // An even more future npm version will make this an error. + // XXX(npm9+) make this throw an error if (this.deprecated[key]) { - log.verbose('config', key, this.deprecated[key]) + log.warn('config', key, this.deprecated[key]) } } diff --git a/node_modules/@npmcli/config/package.json b/node_modules/@npmcli/config/package.json index fff1575ea9fd3..2cc04e05be8c9 100644 --- a/node_modules/@npmcli/config/package.json +++ b/node_modules/@npmcli/config/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/config", - "version": "4.0.2", + "version": "4.1.0", "files": [ "bin/", "lib/" @@ -31,7 +31,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "tap": "^16.0.1" }, "dependencies": { @@ -49,6 +49,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/package-lock.json b/package-lock.json index 9222c5f4ebd5c..87c68606570b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -90,7 +90,7 @@ "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/arborist": "^5.0.4", "@npmcli/ci-detect": "^2.0.0", - "@npmcli/config": "^4.0.2", + "@npmcli/config": "^4.1.0", "@npmcli/fs": "^2.1.0", "@npmcli/map-workspaces": "^2.0.2", "@npmcli/package-json": "^2.0.0", @@ -858,9 +858,9 @@ } }, "node_modules/@npmcli/config": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/config/-/config-4.0.2.tgz", - "integrity": "sha512-UqD4h4LgyNOb7xRmAK7QXiMu0/k2x7wEzrEqXZ1wGIQVmCl3vamsAprDjAhi7IKlgRulg09hpwYs2/57OP22xw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/config/-/config-4.1.0.tgz", + "integrity": "sha512-cPQmIQ2Q0vuOfrenrA3isikdMFMAHgzlXV+EmvZ8f2JeJsU5xTU2bG7ipXECiMvPF9nM+QDnMLuIg8QLw9H4xg==", "inBundle": true, "dependencies": { "@npmcli/map-workspaces": "^2.0.2", @@ -10504,9 +10504,9 @@ "version": "2.0.0" }, "@npmcli/config": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/config/-/config-4.0.2.tgz", - "integrity": "sha512-UqD4h4LgyNOb7xRmAK7QXiMu0/k2x7wEzrEqXZ1wGIQVmCl3vamsAprDjAhi7IKlgRulg09hpwYs2/57OP22xw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/config/-/config-4.1.0.tgz", + "integrity": "sha512-cPQmIQ2Q0vuOfrenrA3isikdMFMAHgzlXV+EmvZ8f2JeJsU5xTU2bG7ipXECiMvPF9nM+QDnMLuIg8QLw9H4xg==", "requires": { "@npmcli/map-workspaces": "^2.0.2", "ini": "^3.0.0", diff --git a/package.json b/package.json index 277320d11feeb..e0036e1c6e1b9 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/arborist": "^5.0.4", "@npmcli/ci-detect": "^2.0.0", - "@npmcli/config": "^4.0.2", + "@npmcli/config": "^4.1.0", "@npmcli/fs": "^2.1.0", "@npmcli/map-workspaces": "^2.0.2", "@npmcli/package-json": "^2.0.0",