Skip to content
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

Release/v7.5.5 #2754

Merged
merged 17 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -750,3 +750,5 @@ Gar <gar+gh@danger.computer>
dr-js <dr@dr.run>
Pavan Bellamkonda <31280326+pavanbellamkonda@users.noreply.github.com>
Alexander Riccio <test35965@gmail.com>
RA80533 <32469082+RA80533@users.noreply.github.com>
Ikko Ashimine <eltociear@gmail.com>
82 changes: 82 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
## v7.5.5 (2021-02-22)

### BUG FIXES
* [`49c95375a`](https://github.com/npm/cli/commit/49c95375af49308e2db6ba28e91c65193754e091)
[#2688](https://github.com/npm/cli/issues/2688)
fix shrinkwrap in node v10.0
([@ljharb](https://github.com/ljharb))
* [`00afa3161`](https://github.com/npm/cli/commit/00afa316195f2db903146110a07ffdaec9bb6aa2)
[#2718](https://github.com/npm/cli/issues/2718)
restore the prefix on output from `npm version <inc>`
([@nlf](https://github.com/nlf))
* [`69e0c4e8c`](https://github.com/npm/cli/commit/69e0c4e8cd684c475a4450c40dfb32c995061aea)
[#2716](https://github.com/npm/cli/issues/2716)
throw an error when trying to dedupe in global mode
([@nlf](https://github.com/nlf))
* [`b018eb842`](https://github.com/npm/cli/commit/b018eb84266dc5a02274849135ca148cb59cc349)
[#2719](https://github.com/npm/cli/issues/2719)
obey silent loglevel in run-script
([@wraithgar](https://github.com/wraithgar))

### DEPENDENCIES
* [`8c36697df`](https://github.com/npm/cli/commit/8c36697dfffe8b5e853fe889c9ead5578100c413)
`@npmcli/arborist@2.2.3`
* [#1875](https://github.com/npm/cli/issues/1875)
[arborist#230](https://github.com/npm/arborist/pull/230)
Set default advisory `severity`/`vulnerable_range` when missing from audit endpoint data
([@isaacs](https://github.com/isaacs))
* [npm/arborist#231](https://github.com/npm/arborist/pull/231)
skip optional deps with mismatched platform or engine
([@nlf](https://github.com/nlf))
* [#2251](https://github.com/npm/cli/issues/2251)
Unpack shrinkwrapped deps not already unpacked
([@isaacs](https://github.com/isaacs),
[@nlf](https://github.com/nlf))
* [#2714](https://github.com/npm/cli/issues/2714)
Do not write package.json if nothing changed
([@isaacs](https://github.com/isaacs))
* [npm/rfcs#324](https://github.com/npm/rfcs/issues/324)
Prefer peer over prod dep, if both specified
([@isaacs](https://github.com/isaacs))
* [npm/arborist#236](https://github.com/npm/arborist/issues/236)
Fix additional peerOptional conflict cases
([@isaacs](https://github.com/isaacs))
* [`d865b101f`](https://github.com/npm/cli/commit/d865b101f72142619531311645479f0596a68a1a)
`libnpmpack@2.0.1`
* respect silent loglevel
* [`e606953e5`](https://github.com/npm/cli/commit/e606953e5795803a7c4eddb4ea993735ef65ec95)
`libnpmversion@1.0.11`
* respect silent loglevel
* [`9c51005a1`](https://github.com/npm/cli/commit/9c51005a19fd4c3e7cd4c987d2e39d1b763036bf)
`npm-package-arg@8.1.1`
* do a better job of detecting git specifiers like `git@github.com:npm/cli`
* [`8b6bf0db4`](https://github.com/npm/cli/commit/8b6bf0db49a3378bd85a0d1ffdd19fbdd68a944a)
`pacote@11.2.7`
* respect silent loglevel
* fix INVALID_URL errors for certain git dependencies

### TESTS
* [`80c2ac995`](https://github.com/npm/cli/commit/80c2ac995170a05b26856a2b72fe9c8163b2c999)
[#2717](https://github.com/npm/cli/issues/2717)
refactor publish tests
([@wraithgar](https://github.com/wraithgar))
* [`9d81e0ceb`](https://github.com/npm/cli/commit/9d81e0ceba7d69e0651662508415ee3705bddfd9)
[#2729](https://github.com/npm/cli/issues/2729)
fix typo in shrinkwrap tests
([@eltociear](https://github.com/eltociear))

### DOCUMENTATION
* [`e3de7befb`](https://github.com/npm/cli/commit/e3de7befb3a9e2fcb7aac5b740d09b3b7d99d724)
[#2685](https://github.com/npm/cli/issues/2685)
docs(readme): add note back about branding/origin
([@darcyclarke](https://github.com/darcyclarke))
* [`38d87e7c2`](https://github.com/npm/cli/commit/38d87e7c24aea13b0f1c1157aad58d9d15bf8e63)
[#2698](https://github.com/npm/cli/issues/2698)
mention nodenv in README.md
([@RA80533](https://github.com/RA80533))
* [`af4422cdb`](https://github.com/npm/cli/commit/af4422cdbc110f93203667efc08b16f7aa74ac2f)
[#2711](https://github.com/npm/cli/issues/2711)
validate that the docs can be parsed by mdx
([@ethomson](https://github.com/ethomson))


## v7.5.4 (2021-02-12)

### BUG FIXES
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ If you're looking to manage multiple versions of **`node`** &/or **`npm`**, cons
* [**`nave`**](https://github.com/isaacs/nave)
* [**`n`**](https://github.com/tj/n)
* [**`volta`**](https://github.com/volta-cli/volta)
* [**`nodenv`**](https://github.com/nodenv/nodenv)

### Usage

Expand All @@ -51,3 +52,13 @@ npm <command>

* `npm` is configured to use the **npm Public Registry** at [https://registry.npmjs.org](https://registry.npmjs.org) by default; Usage of this registry is subject to **Terms of Use** available at [https://npmjs.com/policies/terms](https://npmjs.com/policies/terms)
* You can configure `npm` to use any other compatible registry you prefer. You can read more about configuring third-party registries [here](https://docs.npmjs.com/cli/v7/using-npm/registry)

### FAQ on Branding

#### Is it "npm" or "NPM" or "Npm"?

**`npm`** should never be capitalized unless it is being displayed in a location that is customarily all-capitals (ex. titles on `man` pages).

#### Is "npm" an acronym for "Node Package Manager"?

Contrary to popular belief, **`npm`** **is not** in fact an acronym for "Node Package Manager"; It is a recursive bacronymic abbreviation for **"npm is not an acronym"** (if the project was named "ninaa", then it would be an acronym). The precursor to **`npm`** was actually a bash utility named **"pm"**, which was the shortform name of **"pkgmakeinst"** - a bash function that installed various things on various platforms. If **`npm`** were to ever have been considered an acronym, it would be as "node pm" or, potentially "new pm".
43 changes: 36 additions & 7 deletions docs/dockhand.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = require('path');
const fs = require('fs');
const yaml = require('yaml');
const cmark = require('cmark-gfm');
const mdx = require('@mdx-js/mdx');
const mkdirp = require('mkdirp');
const jsdom = require('jsdom');
const npm = require('../lib/npm.js')
Expand All @@ -16,25 +17,35 @@ const outputRoot = path.join(docsRoot, 'output');

const template = fs.readFileSync('template.html').toString();

walk(inputRoot);
const run = async function() {
try {
await walk(inputRoot);
}
catch (error) {
console.error(error);
}
}

function walk(root, dirRelative) {
run();

async function walk(root, dirRelative) {
const dirPath = dirRelative ? path.join(root, dirRelative) : root;
const children = fs.readdirSync(dirPath);

fs.readdirSync(dirPath).forEach((childFilename) => {
for (const childFilename of children) {
const childRelative = dirRelative ? path.join(dirRelative, childFilename) : childFilename;
const childPath = path.join(root, childRelative);

if (fs.lstatSync(childPath).isDirectory()) {
walk(root, childRelative);
await walk(root, childRelative);
}
else {
translate(childRelative);
await translate(childRelative);
}
});
}
}

function translate(childPath) {
async function translate(childPath) {
const inputPath = path.join(inputRoot, childPath);

if (!inputPath.match(/\.md$/)) {
Expand Down Expand Up @@ -70,6 +81,16 @@ function translate(childPath) {
}
});

// Test that mdx can parse this markdown file. We don't actually
// use the output, it's just to ensure that the upstream docs
// site (docs.npmjs.com) can parse it when this file gets there.
try {
await mdx(md, { skipExport: true });
}
catch (error) {
throw new MarkdownError(childPath, error);
}

// Inject this data into the template, using a mustache-like
// replacement scheme.
const html = template.replace(/\{\{\s*([\w\.]+)\s*\}\}/g, (token, key) => {
Expand Down Expand Up @@ -225,3 +246,11 @@ function headerLevel(node) {
function debug(str) {
console.log(str);
}

class MarkdownError extends Error {
constructor(file, inner) {
super(`failed to parse ${file}`);
this.file = file;
this.inner = inner;
}
}
1 change: 1 addition & 0 deletions lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const ci = async () => {
scriptShell,
stdio: 'inherit',
stdioString: true,
banner: log.level !== 'silent',
event,
})
}
Expand Down
6 changes: 6 additions & 0 deletions lib/dedupe.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ const completion = require('./utils/completion/none.js')
const cmd = (args, cb) => dedupe(args).then(() => cb()).catch(cb)

const dedupe = async (args) => {
if (npm.flatOptions.global) {
const er = new Error('`npm dedupe` does not work in global mode.')
er.code = 'EDEDUPEGLOBAL'
throw er
}

const dryRun = (args && args.dryRun) || npm.flatOptions.dryRun
const where = npm.prefix
const arb = new Arborist({
Expand Down
1 change: 1 addition & 0 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const install = async args => {
scriptShell,
stdio: 'inherit',
stdioString: true,
banner: log.level !== 'silent',
event,
})
}
Expand Down
3 changes: 3 additions & 0 deletions lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const publish_ = async (arg, opts) => {
path: spec.fetchSpec,
stdio: 'inherit',
pkg: manifest,
banner: log.level !== 'silent',
})
}

Expand Down Expand Up @@ -121,13 +122,15 @@ const publish_ = async (arg, opts) => {
path: spec.fetchSpec,
stdio: 'inherit',
pkg: manifest,
banner: log.level !== 'silent',
})

await runScript({
event: 'postpublish',
path: spec.fetchSpec,
stdio: 'inherit',
pkg: manifest,
banner: log.level !== 'silent',
})
}

Expand Down
10 changes: 5 additions & 5 deletions lib/run-script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const run = require('@npmcli/run-script')
const { isServerPackage } = run
const runScript = require('@npmcli/run-script')
const { isServerPackage } = runScript
const npm = require('./npm.js')
const readJson = require('read-package-json-fast')
const { resolve } = require('path')
Expand Down Expand Up @@ -27,11 +27,11 @@ const completion = async (opts, cb) => {
}

const cmd = (args, cb) => {
const fn = args.length ? runScript : list
const fn = args.length ? doRun : list
return fn(args).then(() => cb()).catch(cb)
}

const runScript = async (args) => {
const doRun = async (args) => {
const path = npm.localPrefix
const event = args.shift()
const { scriptShell } = npm.flatOptions
Expand Down Expand Up @@ -76,7 +76,7 @@ const runScript = async (args) => {
}

for (const [event, args] of events) {
await run({
await runScript({
...opts,
event,
args,
Expand Down
2 changes: 1 addition & 1 deletion lib/shrinkwrap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { resolve, basename } = require('path')
const util = require('util')
const fs = require('fs')
const { unlink } = fs.promises || util.promisify(fs.unlink)
const { unlink } = fs.promises || { unlink: util.promisify(fs.unlink) }
const Arborist = require('@npmcli/arborist')
const log = require('npmlog')

Expand Down
14 changes: 10 additions & 4 deletions lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,21 @@ const version = async args => {
case 0:
return list()
case 1:
return output(await libversion(args[0], {
...npm.flatOptions,
path: npm.prefix,
}))
return version_(args)
default:
throw usage
}
}

const version_ = async (args) => {
const prefix = npm.flatOptions.tagVersionPrefix
const version = await libversion(args[0], {
...npm.flatOptions,
path: npm.prefix,
})
return output(`${prefix}${version}`)
}

const list = async () => {
const results = {}
const { promisify } = require('util')
Expand Down
Loading