Issue 1:
Background:

I am an author of a golang project called sorvor and I wish to distribute golang binaries using NPM so that consumers do not have to install separate toolchain to get sorvor.

To achieve this, I've published prebuilt platform specific native binaries to NPM via below packages:

https://www.npmjs.com/package/sorvor-darwin-64

https://www.npmjs.com/package/sorvor-darwin-arm64

https://www.npmjs.com/package/sorvor-freebsd-64

https://www.npmjs.com/package/sorvor-freebsd-arm64

https://www.npmjs.com/package/sorvor-linux-32

https://www.npmjs.com/package/sorvor-linux-64

https://www.npmjs.com/package/sorvor-linux-arm

https://www.npmjs.com/package/sorvor-linux-arm64

https://www.npmjs.com/package/sorvor-windows-32

https://www.npmjs.com/package/sorvor-windows-64

I am expecting user's to have a single NPM dependency in their package.json for the main package:

https://www.npmjs.com/package/sorvor

The main package lists all the native packages as optional dependencies so that and NPM can install appropriate optional dependency for a given platform.

Current Behavior:

NPM v7.x installs all optional dependencies without checking current OS and CPU arch.

Expected Behavior:

NPM v7.x should install optional dependencies only for current OS and CPU arch.

Note: This works correctly with NPM v6.x

Steps To Reproduce:

run npm install --save-dev sorvor

Environment:

OS: Darwin x86_64

Node: 15.9.0

NPM: 7.5.3

Related Issues:

#558

#475

Issue 2:
Current Behavior:

I tested installing a git dependency which has either prepare or prepack script with npm CLI v7.0.0-beta.12 and confirmed the following behaviors.

a package with a prepare script: devDependencies are NOT installed but the prepare script is executed

a package with a prepack script: devDependencies are NOT installed and the prepack script is NOT executed

Expected Behavior:

a package with a prepare script: devDependencies are installed and the prepare script is executed

a package with a prepack script: devDependencies are installed and the prepack script is executed

Though I've not found any document saying that devDependencies are installed when installing a git dependency with a prepack script and actually they are not installed even when npm CLI v6 is used, I believe npm should install them since running a prepack script without installing devDependencies does not make sense.

Steps To Reproduce:

prepare:

// https://github.com/kimamula/prepare-test/blob/master/package.json
{
"name": "prepare-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "tsc"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"typescript": "^4.0.3"
}
}

$ npm install github:kimamula/prepare-test
npm ERR! code 127
npm ERR! git dep preparation failed
npm ERR! command /Users/kenji/.nodenv/versions/12.18.3/bin/node /Users/kenji/.nodenv/versions/12.18.3/lib/node_modules/npm/bin/npm-cli.js install --only=dev --prod --ignore-prepublish --no-progress --no-save --cache=/Users/kenji/.npm/_cacache --prefer-offline=false --prefer-online=false --offline=false --before=
npm ERR! > prepare-test@1.0.0 prepare
npm ERR! > tsc
npm ERR! npm WARN invalid config before="" set in command line options
npm ERR! npm WARN invalid config Must be one of: null, valid Date string
npm ERR! sh: tsc: command not found
npm ERR! npm ERR! code 127
npm ERR! npm ERR! path /Users/kenji/.npm/_cacache/tmp/git-clone-a73f300b
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c tsc
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /Users/kenji/.npm/_cacache/_logs/2020-09-27T06_13_19_941Z-debug.log

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kenji/.npm/_logs/2020-09-27T06_13_19_972Z-debug.log

prepack:

// https://github.com/kimamula/prepack-test/blob/master/package.json
{
"name": "prepack-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepack": "tsc"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"typescript": "^4.0.3"
}
}

$ npm install github:kimamula/prepack-test

changed 1 package, and audited 1 package in 6s

found 0 vulnerabilities

-> tsc should generate index.js file, but it's not generated.

Environment:

OS: macOS 10.15.6

Node: 12.18.3

npm: 7.0.0-beta.12