Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
447bdb8
unit test for unsupported version checker
isaacs Jul 9, 2020
c5cdfb2
add unit test for cmd-list module
isaacs Jul 9, 2020
d675d69
remove some unused utils and outdated tests
isaacs Jul 10, 2020
a12d702
Module to get project scope from prefix
isaacs Jul 10, 2020
a2368c2
module to listen to process log events
isaacs Jul 10, 2020
9ecaddd
module for dereferencing aliases to canonical cmd names
isaacs Jul 10, 2020
3535fca
module to setup log settings based on configs
isaacs Jul 10, 2020
f937a1c
module to delete old debug log files
isaacs Jul 10, 2020
c7c0447
Remove the log-stream config, fix some references to removed modules
isaacs Jul 10, 2020
67d7ffd
remove onload-script config
isaacs Jul 10, 2020
6799f25
Update open-url and help to fix browser help docs
isaacs Jul 10, 2020
8e1e68c
add @npmcli/ci-detect dependency
isaacs Jul 10, 2020
5edb3b5
remove reference to npm.rollbacks list
isaacs Jul 10, 2020
5075e82
First pass refactoring npm.js and npm-cli.js
isaacs Jul 10, 2020
b5bcaf4
update dependencies, refactor config loading to async
isaacs Jul 11, 2020
d12fbe0
move npm-cache-filename to dev deps
isaacs Jul 13, 2020
6c3d221
module to set user-agent config
isaacs Jul 13, 2020
99b4bd5
Assign usage/completion to npm.commands[x] for completion support
isaacs Jul 14, 2020
9e5874c
use set-user-agent util
isaacs Jul 14, 2020
a3e89ee
move update-notifier into separate module
isaacs Jul 14, 2020
ec1337b
update chalk, remove is-ci
isaacs Jul 14, 2020
b8be88a
update parse-conflict-json
isaacs Jul 14, 2020
6630581
remove direct dep on npm-install-checks
isaacs Jul 14, 2020
58c69e9
add tests for is-windows* modules
isaacs Jul 14, 2020
7a6e16b
tests for error-message util
isaacs Jul 14, 2020
0451572
remove unnecessary is-registry util
isaacs Jul 14, 2020
c6f0616
refactor and test perf.js util
isaacs Jul 14, 2020
bc27fcb
protect against non-strings when dereferencing commands
isaacs Jul 14, 2020
b1c16f6
code style cleanup in error-handler util
isaacs Jul 14, 2020
75ac93d
add test for output util
isaacs Jul 16, 2020
ed5c98b
make ll a first-class command to make the cmd implementation easier
isaacs Jul 16, 2020
7dcbb5d
tests for main npm module
isaacs Jul 16, 2020
8af672f
refactor and test for main cli script
isaacs Jul 17, 2020
8857fb3
make default help banner more helpful
isaacs Jul 17, 2020
c4a4857
disable progress when --silent is set
isaacs Jul 20, 2020
3437399
test coverage and bugfix for reify-output util
isaacs Jul 20, 2020
3e4a2c5
move reify-output util test to proper location
isaacs Jul 20, 2020
2eeb21a
Full dependency reboot
isaacs Jul 23, 2020
977bcf7
Do not exit error if install has an audit advisory
isaacs Jul 23, 2020
63ac2a4
Make ll completion test pass by comparing toString() values
isaacs Jul 23, 2020
cce81d5
test: properly clean reify-output snapshot
isaacs Jul 23, 2020
11ef4de
Use eslint directly instead of standard
isaacs Jul 23, 2020
c97a878
lint the lib folder
isaacs Jul 23, 2020
9a12a7e
script to bundle and gitignore deps as appropriate
isaacs Jul 23, 2020
7ffd198
@npmcli/arborist@0.0.5
isaacs Jul 24, 2020
d69aa6b
reset and update all deps
isaacs Jul 24, 2020
96d0f25
reset deps using npm v7
isaacs Jul 24, 2020
021db3a
install: execute scripts on local install with no args
isaacs Jul 24, 2020
9481645
update CI test script for travis
isaacs Jul 24, 2020
26f1e52
@npmcli/arborist@0.0.9, fix self-install
isaacs Jul 25, 2020
cd4f487
Pass options to arborist.reify() in dedupe, prune
isaacs Jul 27, 2020
17969d5
update minipass-pipeline to fix caching bug
isaacs Jul 28, 2020
4905fa8
remove unnecessary package overrides from licensee config
isaacs Jul 28, 2020
d6755f0
Reset deps (again)
isaacs Jul 28, 2020
5f08b61
@npmcli/arborist@0.0.10
isaacs Jul 29, 2020
ed5c7dc
test: more affordances for Windows
isaacs Jul 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
215 changes: 215 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
{
"parserOptions": {
"ecmaVersion": 2020,
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},

"env": {
"es6": true,
"node": true
},

"plugins": [
"import",
"node",
"promise",
"standard"
],

"globals": {
"document": "readonly",
"navigator": "readonly",
"window": "readonly"
},

"rules": {
"accessor-pairs": "error",
"array-bracket-spacing": ["error", "never"],
"arrow-spacing": ["error", { "before": true, "after": true }],
"block-spacing": ["error", "always"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"camelcase": ["error", { "properties": "never" }],
"comma-dangle": ["error", {
"arrays": "never",
"objects": "never",
"imports": "never",
"exports": "never",
"functions": "never"
}],
"comma-spacing": ["error", { "before": false, "after": true }],
"comma-style": ["error", "last"],
"computed-property-spacing": ["error", "never"],
"constructor-super": "error",
"curly": ["error", "multi-line"],
"dot-location": ["error", "property"],
"dot-notation": ["error", { "allowKeywords": true }],
"eol-last": "error",
"eqeqeq": ["error", "always", { "null": "ignore" }],
"func-call-spacing": ["error", "never"],
"generator-star-spacing": ["error", { "before": true, "after": true }],
"handle-callback-err": ["error", "^(err|error)$" ],
"indent": ["error", 2, {
"SwitchCase": 1,
"VariableDeclarator": 1,
"outerIIFEBody": 1,
"MemberExpression": 1,
"FunctionDeclaration": { "parameters": 1, "body": 1 },
"FunctionExpression": { "parameters": 1, "body": 1 },
"CallExpression": { "arguments": 1 },
"ArrayExpression": 1,
"ObjectExpression": 1,
"ImportDeclaration": 1,
"flatTernaryExpressions": false,
"ignoreComments": false,
"ignoredNodes": ["TemplateLiteral *"]
}],
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
"keyword-spacing": ["error", { "before": true, "after": true }],
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
"new-cap": ["error", { "newIsCap": true, "capIsNew": false, "properties": true }],
"new-parens": "error",
"no-array-constructor": "error",
"no-async-promise-executor": "error",
"no-caller": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-condition": ["error", { "checkLoops": false }],
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-eval": "error",
"no-ex-assign": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-boolean-cast": "error",
"no-extra-parens": ["error", "functions"],
"no-fallthrough": "error",
"no-floating-decimal": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-implied-eval": "error",
"no-inner-declarations": ["error", "functions"],
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-iterator": "error",
"no-labels": ["error", { "allowLoop": false, "allowSwitch": false }],
"no-lone-blocks": "error",
"no-misleading-character-class": "error",
"no-prototype-builtins": "error",
"no-useless-catch": "error",
"no-mixed-operators": ["error", {
"groups": [
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"]
],
"allowSamePrecedence": true
}],
"no-mixed-spaces-and-tabs": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }],
"no-negated-in-lhs": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-require": "error",
"no-new-symbol": "error",
"no-new-wrappers": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "error",
"no-path-concat": "error",
"no-proto": "error",
"no-redeclare": ["error", { "builtinGlobals": false }],
"no-regex-spaces": "error",
"no-return-assign": ["error", "except-parens"],
"no-self-assign": ["error", { "props": true }],
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-tabs": "error",
"no-template-curly-in-string": "error",
"no-this-before-super": "error",
"no-throw-literal": "off",
"no-trailing-spaces": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-unexpected-multiline": "error",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true, "allowTaggedTemplates": true }],
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }],
"no-use-before-define": ["error", { "functions": false, "classes": false, "variables": false }],
"no-useless-call": "error",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
"no-useless-escape": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-void": "error",
"no-whitespace-before-property": "error",
"no-with": "error",
"object-curly-newline": ["error", { "multiline": true, "consistent": true }],
"object-curly-spacing": ["error", "always"],
"object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }],
"one-var": ["error", { "initialized": "never" }],
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before", "|>": "before" } }],
"padded-blocks": ["error", { "blocks": "never", "switches": "never", "classes": "never" }],
"prefer-const": ["error", {"destructuring": "all"}],
"prefer-promise-reject-errors": "error",
"quote-props": ["error", "as-needed"],
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": false }],
"rest-spread-spacing": ["error", "never"],
"semi": ["error", "never"],
"semi-spacing": ["error", { "before": false, "after": true }],
"space-before-blocks": ["error", "always"],
"space-before-function-paren": ["error", "always"],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
"spaced-comment": ["error", "always", {
"line": { "markers": ["*package", "!", "/", ",", "="] },
"block": { "balanced": true, "markers": ["*package", "!", ",", ":", "::", "flow-include"], "exceptions": ["*"] }
}],
"symbol-description": "error",
"template-curly-spacing": ["error", "never"],
"template-tag-spacing": ["error", "never"],
"unicode-bom": ["error", "never"],
"use-isnan": "error",
"valid-typeof": ["error", { "requireStringLiterals": true }],
"wrap-iife": ["error", "any", { "functionPrototypeMethods": true }],
"yield-star-spacing": ["error", "both"],
"yoda": ["error", "never"],

"import/export": "error",
"import/first": "error",
"import/no-absolute-path": ["error", { "esmodule": true, "commonjs": true, "amd": false }],
"import/no-duplicates": "error",
"import/no-named-default": "error",
"import/no-webpack-loader-syntax": "error",

"node/no-deprecated-api": "error",
"node/process-exit-as-throw": "error",

"promise/param-names": "off",

"standard/no-callback-literal": "error"
}
}
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,5 @@ jobs:
# if: matrix.os == 'ubuntu-latest'
# run: sudo PATH=$PATH $(which node) . test -- --coverage --timeout 600

- name: Lint
run: node . run lint

- name: Validate licenses
run: node . run licenses
8 changes: 1 addition & 7 deletions .licensee.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@
],
"blueOak": "bronze"
},
"corrections": true,
"packages": {
"config-chain": "1.1.12",
"cyclist": "0.2.2",
"json-schema": "0.2.3",
"qrcode-terminal": "0.12.0"
}
"corrections": true
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ install:
- "node . install"

script:
- "node . run tap -- \"test/tap/*.js\" -t600 -Rclassic -c"
- "node . test -- -t600 -Rclassic -c"
153 changes: 1 addition & 152 deletions bin/npm-cli.js
Original file line number Diff line number Diff line change
@@ -1,153 +1,2 @@
#!/usr/bin/env node
;(function () { // wrapper in case we're in module_context mode
// windows: running "npm blah" in this folder will invoke WSH, not node.
/* global WScript */
if (typeof WScript !== 'undefined') {
WScript.echo(
'npm does not work when run\n' +
'with the Windows Scripting Host\n\n' +
"'cd' to a different directory,\n" +
"or type 'npm.cmd <args>',\n" +
"or type 'node npm <args>'."
)
WScript.quit(1)
return
}

process.title = 'npm'

var unsupported = require('../lib/utils/unsupported.js')
unsupported.checkForBrokenNode()

var log = require('npmlog')
log.pause() // will be unpaused when config is loaded.
log.info('it worked if it ends with', 'ok')

unsupported.checkForUnsupportedNode()

var npm = require('../lib/npm.js')
var npmconf = require('../lib/config/core.js')
var errorHandler = require('../lib/utils/error-handler.js')

var configDefs = npmconf.defs
var shorthands = configDefs.shorthands
var types = configDefs.types
var nopt = require('nopt')

// if npm is called as "npmg" or "npm_g", then
// run in global mode.
if (process.argv[1][process.argv[1].length - 1] === 'g') {
process.argv.splice(1, 1, 'npm', '-g')
}

log.verbose('cli', process.argv)

var conf = nopt(types, shorthands)
npm.argv = conf.argv.remain
if (npm.deref(npm.argv[0])) npm.command = npm.argv.shift()
else conf.usage = true

if (conf.version) {
console.log(npm.version)
return errorHandler.exit(0)
}

if (conf.versions) {
npm.command = 'version'
conf.usage = false
npm.argv = []
}

log.info('using', 'npm@%s', npm.version)
log.info('using', 'node@%s', process.version)

process.on('uncaughtException', errorHandler)
process.on('unhandledRejection', errorHandler)

if (conf.usage && npm.command !== 'help') {
npm.argv.unshift(npm.command)
npm.command = 'help'
}

var isGlobalNpmUpdate = conf.global && ['install', 'update'].includes(npm.command) && npm.argv.includes('npm')

// now actually fire up npm and run the command.
// this is how to use npm programmatically:
conf._exit = true
npm.load(conf, function (er) {
if (er) return errorHandler(er)
if (
!isGlobalNpmUpdate &&
npm.config.get('update-notifier') &&
!unsupported.checkVersion(process.version).unsupported
) {
const pkg = require('../package.json')
let notifier = require('update-notifier')({pkg})
const isCI = require('ci-info').isCI
if (
notifier.update &&
notifier.update.latest !== pkg.version &&
!isCI
) {
const color = require('ansicolors')
const useColor = npm.config.get('color')
const useUnicode = npm.config.get('unicode')
const old = notifier.update.current
const latest = notifier.update.latest
let type = notifier.update.type
if (useColor) {
switch (type) {
case 'major':
type = color.red(type)
break
case 'minor':
type = color.yellow(type)
break
case 'patch':
type = color.green(type)
break
}
}
const changelog = `https://github.com/npm/cli/releases/tag/v${latest}`
notifier.notify({
message: `New ${type} version of ${pkg.name} available! ${
useColor ? color.red(old) : old
} ${useUnicode ? '→' : '->'} ${
useColor ? color.green(latest) : latest
}\n` +
`${
useColor ? color.yellow('Changelog:') : 'Changelog:'
} ${
useColor ? color.cyan(changelog) : changelog
}\n` +
`Run ${
useColor
? color.green(`npm install -g ${pkg.name}`)
: `npm i -g ${pkg.name}`
} to update!`
})
}
}
npm.commands[npm.command](npm.argv, function (err) {
// https://genius.com/Lin-manuel-miranda-your-obedient-servant-lyrics
if (
!err &&
npm.config.get('ham-it-up') &&
!npm.config.get('json') &&
!npm.config.get('parseable') &&
npm.command !== 'completion'
) {
console.error(
`\n ${
npm.config.get('unicode') ? '🎵 ' : ''
} I Have the Honour to Be Your Obedient Servant,${
npm.config.get('unicode') ? '🎵 ' : ''
} ~ npm ${
npm.config.get('unicode') ? '📜🖋 ' : ''
}\n`
)
}
errorHandler.apply(this, arguments)
})
})
})()
require('../lib/cli.js')(process)
Loading