From 2404704642cf419def5896c0e5ae01b22dd27e9b Mon Sep 17 00:00:00 2001 From: Gar Date: Wed, 15 Sep 2021 11:29:13 -0700 Subject: [PATCH] feat: drop node 10, 11, and programmatic api BREAKING CHANGE: This will drop official support for node versions less than v12. It also removes the `main` export as something that will work, effectively dropping a supported programmatic api via `require('npm')` --- .github/workflows/ci.yml | 6 +++--- lib/no-api.js | 1 + package.json | 8 ++++---- test/lib/utils/unsupported.js | 13 +++++++++---- 4 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 lib/no-api.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffa194d014c12..0e9edb5f5ef31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [10.x, 12.x, 14.x, 16.x] + node-version: [12.x, 14.x, 16.x] platform: - os: ubuntu-latest shell: bash @@ -100,7 +100,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [10.x, 12.x, 14.x, 16.x] + node-version: [12.x, 14.x, 16.x] platform: - os: ubuntu-latest shell: bash @@ -141,7 +141,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: ['10.1', 10.x, '12.1', 12.x, '14.1', 14.x, '16.1', 16.x] + node-version: ['12.13.0', 12.x, '14.15.0', 14.x, '16.1', 16.x] platform: - os: ubuntu-latest shell: bash diff --git a/lib/no-api.js b/lib/no-api.js new file mode 100644 index 0000000000000..347e289390588 --- /dev/null +++ b/lib/no-api.js @@ -0,0 +1 @@ +throw new Error('The programmatic API was removed in npm v8.0.0') diff --git a/package.json b/package.json index 8011f238ac2ff..44db6f5c6d1c9 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "lib": "./lib", "man": "./man" }, - "main": "./lib/npm.js", + "main": "./lib/no-api.js", "bin": { "npm": "bin/npm-cli.js", "npx": "bin/npx-cli.js" @@ -46,9 +46,9 @@ "exports": { ".": [ { - "default": "./lib/npm.js" + "default": "./lib/no-api.js" }, - "./lib/npm.js" + "./lib/no-api.js" ], "./package.json": "./package.json" }, @@ -235,6 +235,6 @@ }, "license": "Artistic-2.0", "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" } } diff --git a/test/lib/utils/unsupported.js b/test/lib/utils/unsupported.js index 3a05d90666025..4d806cefc4e52 100644 --- a/test/lib/utils/unsupported.js +++ b/test/lib/utils/unsupported.js @@ -27,10 +27,15 @@ const versions = [ ['v7.2.3', false, true], ['v8.4.0', false, true], ['v9.3.0', false, true], - ['v10.0.0-0', false, false], - ['v11.0.0-0', false, false], - ['v12.0.0-0', false, false], - ['v13.0.0-0', false, false], + ['v10.0.0-0', false, true], + ['v11.0.0-0', false, true], + ['v12.0.0-0', false, true], + ['v12.13.0-0', false, false], + ['v13.0.0-0', false, true], + ['v14.0.0-0', false, true], + ['v14.15.0-0', false, false], + ['v15.0.0-0', false, true], + ['v16.0.0-0', false, false], ] t.test('versions', function (t) {