Issue 1:
Is there an existing issue for this?

I have searched the existing issues

This issue exists in the latest npm version

I am using the latest npm

Current Behavior

I have two packages ajs and bjs. Due to some reason I intend to merge both. Right now, I am installing ajs with npm install ajs and bjs with npm install bjs. But after the merge I wish to install bjs when ajs (npm i ajs) is installed.

I am aware of manual installation of npm i <alias>@npm:<package>. It does not solve my purpose. I did try searching a couple of times around this but did not find any documentation related to this. I doubt this is even directly possible. I wish not to copy one repo to another to maintain the sanity of the deprecated repository upgraded to another. The only option I see is update the github url in the repository. But I doubt it solves the purpose. Any help is welcome.

https://stackoverflow.com/questions/72554667/install-package-x-when-a-request-for-package-y-installation-is-made

Expected Behavior

Add documentation to redirect installation of one package(ajs) when installing another(bjs) package. Alternatively allow for the same as a feature.

Steps To Reproduce

NA. Feature

Environment

npm: 8.5.5

Node.js: 16.15.0

OS Name: Windows/Linux

System Model Name: Dell Vostro OEM 3590 - i5 x64 Arch

npm config:

; copy and paste output from `npm config ls` here
; node bin location = C:\Users\ganes\OneDrive\Documents\binaries\node\node.exe
; cwd = C:\Users\ganes\OneDrive\Documents\projects\github\cgi-js
; HOME = C:\Users\ganes
; Run `npm config ls -l` to show all defaults.

C:\Users\ganes\OneDrive\Documents\projects\github\cgi-js>npm config ls -l
; "default" config from default values

_auth = (protected)
access = null
all = false
allow-same-version = false
also = null
audit = true
audit-level = null
auth-type = "legacy"
before = null
bin-links = true
browser = null
ca = null
cache = "C:\\Users\\ganes\\AppData\\Local\\npm-cache"
cache-max = null
cache-min = 0
cafile = null
call = ""
cert = null
ci-name = null
cidr = null
color = true
commit-hooks = true
depth = null
description = true
dev = false
diff = []
diff-dst-prefix = "b/"
diff-ignore-all-space = false
diff-name-only = false
diff-no-prefix = false
diff-src-prefix = "a/"
diff-text = false
diff-unified = 3
dry-run = false
editor = "notepad.exe"
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
fetch-timeout = 300000
force = false
foreground-scripts = false
format-package-lock = true
fund = true
git = "git"
git-tag-version = true
global = false
global-style = false
globalconfig = "C:\\Users\\ganes\\OneDrive\\Documents\\binaries\\node\\etc\\npmrc"
heading = "npm"
https-proxy = null
if-present = false
ignore-scripts = false
include = []
include-staged = false
include-workspace-root = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\\Users\\ganes\\.npm-init.js"
init-version = "1.0.0"
init.author.email = ""
init.author.name = ""
init.author.url = ""
init.license = "ISC"
init.module = "C:\\Users\\ganes\\.npm-init.js"
init.version = "1.0.0"
json = false
key = null
legacy-bundling = false
legacy-peer-deps = false
link = false
local-address = null
location = "user"
lockfile-version = null
loglevel = "notice"
logs-max = 10
; long = false ; overridden by cli
maxsockets = 15
message = "%s"
metrics-registry = "https://registry.npmjs.org/"
node-options = null
node-version = "v16.15.0"
noproxy = [""]
npm-version = "8.5.5"
offline = false
omit = []
only = null
optional = null
otp = null
pack-destination = "."
package = []
package-lock = true
package-lock-only = false
parseable = false
prefer-offline = false
prefer-online = false
prefix = "C:\\Users\\ganes\\OneDrive\\Documents\\binaries\\node"
preid = ""
production = null
progress = true
proxy = null
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-peer = false
save-prefix = "^"
save-prod = false
scope = ""
script-shell = null
searchexclude = ""
searchlimit = 20
searchopts = ""
searchstaleness = 900
shell = "C:\\Windows\\system32\\cmd.exe"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
strict-peer-deps = false
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "C:\\Users\\ganes\\AppData\\Local\\Temp"
umask = 0
unicode = true
update-notifier = true
usage = false
user-agent = "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}"
userconfig = "C:\\Users\\ganes\\.npmrc"
version = false
versions = false
viewer = "browser"
which = null
workspace = []
workspaces = null
yes = null

; "cli" config from command line options

long = true

Issue 2:
Is there an existing issue for this?

I have searched the existing issues

This issue exists in the latest npm version

I am using the latest npm

Current Behavior

When dealing with a scoped package, the file created on disk is of the format scope-package-1.0.0.tgz.

The filename that is reported by npm pack --json is incorrect as it's reported as @scope/package-1.0.0.tgz instead.

The filename reported by npm pack (without --json) is correct.

Expected Behavior

When running npm pack --json the reported filename property should be scope-package-1.0.0.tgz instead of @scope/package-1.0.0.tgz.

Steps To Reproduce

Given a package.json with the following:

{
"name": "@scope/package",
"version": "1.0.0",
}

The output of npm pack is the following, which includes the correct filename:

npm notice
npm notice 📦 @scope/package@1.0.0
npm notice === Tarball Contents ===
npm notice 0B index.js
npm notice 53B package.json
npm notice === Tarball Details ===
npm notice name: @scope/package
npm notice version: 1.0.0
npm notice filename: @scope/package-1.0.0.tgz
npm notice package size: 167 B
npm notice unpacked size: 53 B
npm notice shasum: ad1ef62b3d84c83033c896f0aee03b701c75b1e8
npm notice integrity: sha512-NNdAGvap0FZo6[...]oW6ok5Rejsmag==
npm notice total files: 2
npm notice
scope-package-1.0.0.tgz

The output of npm pack --json is the following, which includes an incorrect filename property:

[
{
"id": "@scope/package@1.0.0",
"name": "@scope/package",
"version": "1.0.0",
"size": 167,
"unpackedSize": 53,
"shasum": "ad1ef62b3d84c83033c896f0aee03b701c75b1e8",
"integrity": "sha512-NNdAGvap0FZo6aufrgCcRTxV3u9JxwmcHS1wmm9zaNfoD4nQnoGzO4JyRkvozpMadxv1pnhhfoW6ok5Rejsmag==",
"filename": "@scope/package-1.0.0.tgz",
"files": [
{
"path": "index.js",
"size": 0,
"mode": 420
},
{
"path": "package.json",
"size": 53,
"mode": 420
}
],
"entryCount": 2,
"bundled": []
}
]

Environment

npm: 8.18.0

Node.js: v16.15.1

OS Name: macOS

npm config:

; "user" config from /Users/__redacted__/.npmrc

//registry.npmjs.org/:_authToken = (protected)

; node bin location = /Users/__redacted__/.volta/tools/image/node/16.15.1/bin/node
; node version = v16.15.1
; npm local prefix = /Users/__redacted__/Code/cs-apps/packages/app/dist
; npm version = 8.18.0
; cwd = /Users/__redacted__/Code/cs-apps/packages/app/dist
; HOME = /Users/__redacted__