Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/utils
AgeCommit message (Collapse)Author
2020-12-09allow for passing object keys to searchopts to allow paginationnlf/search-optsnlf
PR-URL: https://github.com/npm/cli/pull/2303 Credit: @nlf Close: #2303 Reviewed-by: @isaacs
2020-12-09fix: arborist inventory change updateRuy Adorno
Update `lib/utils/completion/installed-deep.js` to ignore root nodes in the arborist update. PR-URL: https://github.com/npm/cli/pull/2301 Credit: @ruyadorno Close: #2301 Reviewed-by: @isaacs
2020-12-04chore: remove unused filesRuy Adorno
PR-URL: https://github.com/npm/cli/pull/2279 Credit: @ruyadorno Close: #2279 Reviewed-by: @darcyclarke
2020-12-04feat: add npm set-scriptYash-Singh1
Introduces the set-script command. It accepts two arguments, the script name and the command ref: https://github.com/npm/rfcs/blob/latest/accepted/0016-set-script-command.md PR-URL: https://github.com/npm/cli/pull/2237 Credit: @Yash-Singh1 Close: #2237 Reviewed-by: @ruyadorno
2020-12-03Use @npmcli/run-script for exec, explore; add interactive execisaacs
This removes all other arg/shell escaping mechanisms, as they are no longer needed, and will be un-done by puka in @npmcli/run-script anyway. Adds an interactive shell mode when `npm exec` is run without any arguments, allowing users to interactively test out commands in an npm script environment. Previously, this would do nothing, and just exit. Prevent weird behavior from `npm explore ../blah`. `explore` now can _only_ be used to explore packages that are actually found in the relevant `node_modules` folder.
2020-11-20fix: npm unstarRuy Adorno
- Refactored lib/star.js - Fixes `npm unstar` by adding a lib/unstar.js alias/cmd - Add tests for lib/star.js and lib/unstar.js Fixes: https://github.com/npm/statusboard/issues/174 PR-URL: https://github.com/npm/cli/pull/2204 Credit: @ruyadorno Close: #2204 Reviewed-by: @nlf
2020-11-17Preserve builtin conf when installing npm globallyisaacs
When a file named 'npmrc' is in the root of the npm module that is currently running, it adds config values that override the defaults (but not the global or user configs). This is a way for a system package installer to tell the npm that it installs to put its globals somewhere other than the default. In order to keep these configs around when users self-update npm with `npm i -g npm`, these config values must be "sticky", and ride along into the newly globally installed npm. This commit restores this behavior, fixing self-updating npm for Windows users, and any other systems that may make use of this functionality. Fixes: #2002 PR-URL: https://github.com/npm/cli/pull/2184 Credit: @isaacs Close: #2184 Reviewed-by: @ruyadorno
2020-11-13explain-dep: handle shortening edge from root projectisaacs
Fixes: #2134 Credit: @isaacs Close: #2156 Reviewed-by: @ruyadorno
2020-11-13send json errors to stderr, not stdoutisaacs
Fixes: #2150 Credit: @isaacs Close: #2155 Reviewed-by: @ruyadorno
2020-11-13fix: legacy auth tokensRuy Adorno
Add legacy `_auth` token to flatOptions in order to support it when reaching out to registries. Fixes: #2008 Credit: @ruyadorno Close: #2153 Reviewed-by: @isaacs
2020-11-03Support *all* conf keys in publishConfigisaacs
This adds a flatOptions.flatten() method, which takes an object full of config keys, and turns it into an options object. This method expects an object that already inherits from npm's defaults, and is thus expected to be internal only. This commit also removes some config keys which were used by npm dependencies at the start of the v7 beta process, but are no longer: - all lockfile configs (since we don't use lockfiles any more! for anything! and good riddance, they're a rats' nest of race conditions) - cacheMax/cacheMin (we only use preferOffline/offline/online now, so these are strictly legacy support as input and never shared with deps) Once this lands in cli, we can remove the publishConfig handling logic in npm-registry-fetch, as it will be redundant.
2020-10-30test: add tests for test/lib/utils/replace-info.jsRuy Adorno
2020-10-30chore: cherry-pick cleanup logsclaudiahdz
2020-10-30use sh as default unix shell, not bashisaacs
PR-URL: https://github.com/npm/cli/pull/2067 Credit: @isaacs Close: #2067 Reviewed-by: @nlf
2020-10-27pack: do not show individual files of bundled depsisaacs
We show a list of bundled dependencies, there's no need to ALSO show the individual files in each one. PR-URL: https://github.com/npm/cli/pull/2050 Credit: @isaacs Close: #2050 Reviewed-by: @nlf
2020-10-23update lint rules to match @npmcli/arboristisaacs
2020-10-23eslint-plugin-standard@4.0.2isaacs
2020-10-23docs: npm-dedupe through npm-installisaacs
2020-10-16Handle errors from audit endpoint appropriatelyisaacs
If we're running the 'audit' command, then a failed endpoint means that the command failed. Error out in that case. Otherwise, if it's a quick audit as part of another command, just return a value to indicate that we should not print audit info. This avoids showing '0 vulnerabilities found', which, while amusingly technically correct, is misleading and not very helpful. Fix: #1951 Credit: @isaacs Close: #1956 Reviewed-by: @darcyclarke
2020-10-13Integration code for @npmcli/arborist@1.0.0isaacs
Updates to ERESOLVE explanation code
2020-10-13fix: patch config.js to remove duplicate valuesDarcy Clarke
2020-10-13docs: v7 using npm config refreshRuy Adorno
Credit: @ruyadorno Close: #1938 Reviewed-by: @darcyclarke
2020-10-13fix: init config aliasesRuy Adorno
The `init-*` family of config properties should also support dot-separated aliases defined in a npmrc ini file. relates to: https://github.com/npm/init-package-json/commit/c0ace81ade25077eb60260dc87ec58875583f81b
2020-10-09add file-exists util functionnlf
2020-10-07remove user-agent related codenlf
2020-10-07remove unused group config type, add some commentsnlf
2020-10-07expose npm-version through config defaultsnlf
2020-10-07expose ci-name through default confignlf
2020-10-07chore: alphabetize config propertiesnlf
2020-09-30add proxyzhaoxuxu
PR-URL: https://github.com/npm/cli/pull/1859 Credit: @badeggg Close: #1859 Reviewed-by: @isaacs EDIT: changed flatOptions.noproxy to flatOptions.noProxy, since make-fetch-happen reads it from the camel-cased property.
2020-09-30chore: remove unused umask depRuy Adorno
2020-09-30uuid@8.3.0Ruy Adorno
2020-09-29Add 'fetch-timeout' configisaacs
This gets passed down to dependencies as 'timeout', so that the HTTP request libraries will all get the right value. Fix: https://github.com/npm/cli/issues/1780 PR-URL: https://github.com/npm/cli/pull/1870 Credit: @isaacs Close: #1870 Reviewed-by: @nlf
2020-09-29fix: npm ls <pkg> with depth cli configRuy Adorno
Using the cli option --depth is currently not resulting in the expected behavior of filtering depth level when running npm ls <pkg> - that's due the special behavior of printing all results when using a filter arg. This commit fixes it by adding support to limiting depth if a config value is set by the user. Fixes #1861 PR-URL: https://github.com/npm/cli/pull/1862 Credit: @ruyadorno Close: #1862 Reviewed-by: @nlf
2020-09-29fix: added count on reify-outputRuy Adorno
The added count on lib/utils/reify-output.js only looks up resulting keys from arb.diff and does not take into account the fact that some of these pkgs signaled as diff=ADD might in fact not have been installed, most common scenario are optional deps that could have failed their install in a given system or opt-out from configs. This fixes the counting number by looking up at arb.inventory and confirming it has the node that has been marked as added on diff result. Fix: #1813 PR-URL: https://github.com/npm/cli/pull/1858 Credit: @ruyadorno Close: #1858 Reviewed-by: @nlf
2020-09-29Fix EBADPLATFORM error message (#1876)Brian Jenkins
* Fix EBADPLATFORM error message Error format evolved out from under message generation's expectations. * Fix formatting
2020-09-22Add `--strict-peer-deps` optionisaacs
This is the CLI portion of https://github.com/npm/arborist/pull/136 PR-URL: https://github.com/npm/cli/pull/1819 Credit: @isaacs Close: #1819 Reviewed-by: @ruyadorno
2020-09-17chore: remove unused spec parameter, assign error codeNathan LaFreniere
2020-09-08Add 'npm explain' commandisaacs
Pass a specifier or folder path, and it'll explain what that dependency is doing there. PR-URL: https://github.com/npm/cli/pull/1776 Credit: @isaacs Close: #1776 Reviewed-by: @ruyadorno
2020-09-07Tighten up the output of dep node explanationsisaacs
Reduce visual noise, make the more important information more obvious.
2020-09-04Explain ERESOLVE errorsisaacs
When peerDependencies conflict, Arborist is now providing details of the nodes and their reasons for inclusion on the Error object, including whether or not this resolution error could be overridden using the --force flag. Print this data out in a minimal way as a warning if we override an ERESOLVE forcefully. When the ERESOLVE causes the install to fail, print a somewhat longer message, and save a MUCH longer full report to the cache folder. PR-URL: https://github.com/npm/cli/pull/1761 Credit: @isaacs Close: #1761 Reviewed-by: @darcyclarke, @ruyadorno
2020-09-04fix: scope configRuy Adorno
The `flatOptions.scope` option should not default to `projectScope` since that's causing projects that have a defined `projectScope` corresponding to configured scoped registries to try and download ALL packages (including the ones that should be downloaded from the public registry) to be fetch from that scoped registry url. fix #1654 PR-URL: https://github.com/npm/cli/pull/1758 Credit: @ruyadorno Close: #1758 Reviewed-by: @isaacs
2020-09-01test: add lib/utils/error-handler.js testsRuy Adorno
Add unit tests to `lib/utils/error-handler.js`, these are very special since the module handles some internal state through variables which are not exposed and binds itself to multiple global `process` events. Also two minor tweaks/fixes to the original implementation: - Refactored unused param in `reallyExit()` - Fixed String.prototype.match group capture usage PR-URL: https://github.com/npm/cli/pull/1742 Credit: @ruyadorno Close: #1742 Reviewed-by: @isaacs
2020-08-25Detect CI properly in flatOptions generationisaacs
* Also, test this with a mock, so that tests pass in CI. * test: streamline snapshot on config test * test: add workaround for node 10's broken promises * test: make cache dir cross-platform consistent in config test PR-URL: https://github.com/npm/cli/pull/1719 Credit: @isaacs Close: #1719 Reviewed-by: @ruyadorno
2020-08-25Remove reliance on the _exit pseudo-config in error handlerisaacs
This flag no longer exists. We just always exit now when we're done.
2020-08-23ensure npm-command header is sent properlyisaacs
Reported by @lumaxis
2020-08-21lint fixesisaacs
2020-08-21fix pulseWhileDone promise handlingisaacs
Small an oversight from the Bluebird -> Promise refactor. Fix #1695
2020-08-21help: show usage when help-search finds no resultsisaacs
Fix https://github.com/npm/cli/issues/1655
2020-08-20move flat-options.js from lib/config/ to lib/utils/isaacs
PR-URL: https://github.com/npm/cli/pull/1688 Credit: @isaacs Close: #1688 Reviewed-by: @ruyadorno