Content-Length: 291295 | pFad | http://github.com/npm/cli/pull/8317/commits/ed6ae33e908f4dcd2e9b2e9800b6c744547020ee

E6 Remove dependence on deprecated library by owlstronaut · Pull Request #8317 · npm/cli · GitHub
Skip to content

Remove dependence on deprecated library #8317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(libnpmpublish): Remove dependence on deprecated library
  • Loading branch information
owlstronaut committed Jun 3, 2025
commit ed6ae33e908f4dcd2e9b2e9800b6c744547020ee
21 changes: 11 additions & 10 deletions workspaces/libnpmpublish/lib/publish.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { fixer } = require('normalize-package-data')
const npmFetch = require('npm-registry-fetch')
const npa = require('npm-package-arg')
const PackageJson = require('@npmcli/package-json')
const { log } = require('proc-log')
const semver = require('semver')
const { URL } = require('node:url')
Expand Down Expand Up @@ -31,7 +31,7 @@ Remove the 'private' field from the package.json to publish it.`),
}

const reg = npmFetch.pickRegistry(spec, opts)
const pubManifest = patchManifest(manifest, opts)
const pubManifest = await patchManifest(manifest, opts)

// registry-frontdoor cares about the access level,
// which is only configurable for scoped packages
Expand Down Expand Up @@ -62,17 +62,18 @@ Remove the 'private' field from the package.json to publish it.`),
return res
}

const patchManifest = (_manifest, opts) => {
const patchManifest = async (_manifest, opts) => {
const { npmVersion } = opts
// we only update top-level fields, so a shallow clone is fine
const manifest = { ..._manifest }

manifest._nodeVersion = process.versions.node
if (npmVersion) {
manifest._npmVersion = npmVersion
const steps = ['fixName']
const manifestInput = { ..._manifest, _nodeVersion: process.versions.node }
if (npmVersion != null) {
manifestInput._npmVersion = npmVersion
}
const manifest = await new PackageJson()
.fromContent(manifestInput)
.normalize({ steps })
.then(p => p.content)

fixer.fixNameField(manifest, { strict: true, allowLegacyCase: true })
const version = semver.clean(manifest.version)
if (!version) {
throw Object.assign(
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/npm/cli/pull/8317/commits/ed6ae33e908f4dcd2e9b2e9800b6c744547020ee

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy