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

v7.20.1 #3570

Merged
merged 13 commits into from Jul 22, 2021
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -788,3 +788,4 @@ Ivan <ivanaguilar01@live.com.mx>
Aluneed <31174087+aluneed@users.noreply.github.com>
relrelb <relrelbachar@gmail.com>
Cameron Tacklind <cameron@tacklind.com>
Demira Dimitrova <demiradimitrova@github.com>
38 changes: 38 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,41 @@
## v7.20.1 (2021-07-22)

### BUG FIXES

* [`009ad1e68`](https://github.com/npm/cli/commit/009ad1e683aa061d7e5c78b9362b0bd1b14ee643)
[#3561](https://github.com/npm/cli/issues/3561)
fix(exit-handler): always warn if not called
([@wraithgar](https://github.com/wraithgar))
* [`eb67054c8`](https://github.com/npm/cli/commit/eb67054c8303348b25f9717c8f82c8d8d494a242)
[#3563](https://github.com/npm/cli/issues/3563)
fix(config): consolidate use of npm.color
([@wraithgar](https://github.com/wraithgar))

### DOCUMENTATION

* [`a014f3d28`](https://github.com/npm/cli/commit/a014f3d284e49cd085cfd060a71a161b93bca9d1)
[#3562](https://github.com/npm/cli/issues/3562)
fix(docs): typo in `npm cmd` docs
([@wraithgar](https://github.com/wraithgar))
* [`1fe1c9b74`](https://github.com/npm/cli/commit/1fe1c9b74ea3c3d5bb5b3696b954422b9b55dd91)
[#3523](https://github.com/npm/cli/issues/3523)
fix(docs): updated policy urls
([@DemiraDimitrova](https://github.com/DemiraDimitrova))

### DEPENDENCIES

* [`d7f29e8c9`](https://github.com/npm/cli/commit/d7f29e8c94ae77661390f82ae72efc1bd6fcfbc3)
`read-package-json-fast@2.0.3`:
- feat: load directories.bin as a bin object
* [`b1fefa73d`](https://github.com/npm/cli/commit/b1fefa73db2f8d9c55b4447ffc1cdbaf8e9bb298)
`npmlog@5.0.0`
* Drop support for node 6 and 8
* [`b6e09971a`](https://github.com/npm/cli/commit/b6e09971a8f9a3c92188838b69be0a0dda27f0bb)
remove ignored files from node_modules
([@Ruy Adorno](https://github.com/Ruy Adorno))
* [`cf737c505`](https://github.com/npm/cli/commit/cf737c505e76a473850c5244b17f3469efbc3c02)
`debug@4.3.2`

## v7.20.0 (2021-07-15)

### FEATURES
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -2,7 +2,7 @@

## Code of Conduct

All interactions in the **npm** organization on GitHub are considered to be covered by our standard [Code of Conduct](https://www.npmjs.com/policies/conduct).
All interactions in the **npm** organization on GitHub are considered to be covered by our standard [Code of Conduct](https://docs.npmjs.com/policies/conduct).

## Development

Expand Down
2 changes: 1 addition & 1 deletion docs/content/commands/npm-pkg.md
Expand Up @@ -16,7 +16,7 @@ npm pkg delete <field> [.<subfield> ...]

A command that automates the management of `package.json` files.
`npm pkg` provide 3 different sub commands that allow you to modify or retrieve
values for given object keys in your `packge.json`.
values for given object keys in your `package.json`.

The syntax to retrieve and set fields is a dot separated representation of
the nested object properties to be found within your `package.json`, it's the
Expand Down
2 changes: 1 addition & 1 deletion docs/content/commands/npm-unpublish.md
Expand Up @@ -7,7 +7,7 @@ description: Remove a package from the registry
### Synopsis

To learn more about how the npm registry treats unpublish, see our <a
href="https://www.npmjs.com/policies/unpublish" target="_blank"
href="https://docs.npmjs.com/policies/unpublish" target="_blank"
rel="noopener noreferrer"> unpublish policies</a>

#### Unpublishing a single version of a package
Expand Down
2 changes: 1 addition & 1 deletion docs/content/commands/npm.md
Expand Up @@ -31,7 +31,7 @@ Run `npm help` to get a list of available commands.
npm comes preconfigured to use npm's public registry at
https://registry.npmjs.org by default. Use of the npm public registry is
subject to terms of use available at
https://www.npmjs.com/policies/terms.
https://docs.npmjs.com/policies/terms.

You can configure npm to use any compatible registry you like, and even
run your own registry. Use of someone else's registry is governed by
Expand Down
2 changes: 1 addition & 1 deletion docs/content/using-npm/registry.md
Expand Up @@ -12,7 +12,7 @@ package info.

npm is configured to use the **npm public registry** at
<https://registry.npmjs.org> by default. Use of the npm public registry is
subject to terms of use available at <https://www.npmjs.com/policies/terms>.
subject to terms of use available at <https://docs.npmjs.com/policies/terms>.

You can configure npm to use any compatible registry you like, and even run
your own registry. Use of someone else's registry may be governed by their
Expand Down
4 changes: 1 addition & 3 deletions lib/exec.js
Expand Up @@ -68,7 +68,6 @@ class Exec extends BaseCommand {
async _exec (_args, { locationMsg, path, runPath }) {
const args = [..._args]
const call = this.npm.config.get('call')
const color = this.npm.config.get('color')
const {
flatOptions,
localBin,
Expand All @@ -87,7 +86,6 @@ class Exec extends BaseCommand {
...flatOptions,
args,
call,
color,
localBin,
locationMsg,
log,
Expand All @@ -103,7 +101,7 @@ class Exec extends BaseCommand {

async _execWorkspaces (args, filters) {
await this.setWorkspaces(filters)
const color = this.npm.config.get('color')
const color = this.npm.color

for (const path of this.workspacePaths) {
const locationMsg = await getLocationMsg({ color, path })
Expand Down
2 changes: 1 addition & 1 deletion lib/fund.js
Expand Up @@ -109,7 +109,7 @@ class Fund extends ArboristWorkspaceCmd {
}

printHuman (fundingInfo) {
const color = !!this.npm.color
const color = this.npm.color
const unicode = this.npm.config.get('unicode')
const seenUrls = new Map()

Expand Down
2 changes: 1 addition & 1 deletion lib/ls.js
Expand Up @@ -67,7 +67,7 @@ class LS extends ArboristWorkspaceCmd {

async ls (args) {
const all = this.npm.config.get('all')
const color = !!this.npm.color
const color = this.npm.color
const depth = this.npm.config.get('depth')
const dev = this.npm.config.get('dev')
const development = this.npm.config.get('development')
Expand Down
8 changes: 7 additions & 1 deletion lib/npm.js
Expand Up @@ -232,7 +232,7 @@ const npm = module.exports = new class extends EventEmitter {
process.emit('timeEnd', 'npm:load:setTitle')

process.emit('time', 'npm:load:setupLog')
this.color = setupLog(this.config)
setupLog(this.config)
process.emit('timeEnd', 'npm:load:setupLog')
process.env.COLOR = this.color ? '1' : '0'

Expand Down Expand Up @@ -261,6 +261,12 @@ const npm = module.exports = new class extends EventEmitter {
return flat
}

get color () {
// This is a special derived value that takes into consideration not only
// the config, but whether or not we are operating in a tty.
return this.flatOptions.color
}

get lockfileVersion () {
return 2
}
Expand Down
2 changes: 1 addition & 1 deletion lib/run-script.js
Expand Up @@ -137,7 +137,7 @@ class RunScript extends BaseCommand {
path = path || this.npm.localPrefix
const { scripts, name, _id } = await rpj(`${path}/package.json`)
const pkgid = _id || name
const color = !!this.npm.color
const color = this.npm.color

if (!scripts)
return []
Expand Down
3 changes: 3 additions & 0 deletions lib/utils/config/definitions.js
Expand Up @@ -438,6 +438,9 @@ define('cidr', {
flatten,
})

// This should never be directly used, the flattened value is the derived value
// and is sent to other modules, and is also exposed as `npm.color` for use
// inside npm itself.
define('color', {
default: !process.env.NO_COLOR || process.env.NO_COLOR === '0',
usage: '--color|--no-color|--color always',
Expand Down
19 changes: 10 additions & 9 deletions lib/utils/exit-handler.js
Expand Up @@ -52,16 +52,17 @@ process.on('exit', code => {

if (!code)
npm.log.info('ok')
else {
else
npm.log.verbose('code', code)
if (!exitHandlerCalled) {
npm.log.error('', 'Exit handler never called!')
console.error('')
npm.log.error('', 'This is an error with npm itself. Please report this error at:')
npm.log.error('', ' <https://github.com/npm/cli/issues>')
// TODO this doesn't have an npm.config.loaded guard
writeLogFile()
}

if (!exitHandlerCalled) {
process.exitCode = code || 1
npm.log.error('', 'Exit handler never called!')
console.error('')
npm.log.error('', 'This is an error with npm itself. Please report this error at:')
npm.log.error('', ' <https://github.com/npm/cli/issues>')
// TODO this doesn't have an npm.config.loaded guard
writeLogFile()
}
// In timing mode we always write the log file
if (npm.config.loaded && npm.config.get('timing') && !wroteLogFile)
Expand Down
3 changes: 1 addition & 2 deletions lib/utils/setup-log.js
Expand Up @@ -18,6 +18,7 @@ module.exports = (config) => {
const stderrTTY = process.stderr.isTTY
const dumbTerm = process.env.TERM === 'dumb'
const stderrNotDumb = stderrTTY && !dumbTerm
// this logic is duplicated in the config 'color' flattener
const enableColorStderr = color === 'always' ? true
: color === false ? false
: stderrTTY
Expand Down Expand Up @@ -58,6 +59,4 @@ module.exports = (config) => {
log.enableProgress()
else
log.disableProgress()

return enableColorStdout
}
1 change: 0 additions & 1 deletion node_modules/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.