Skip to content

Commit

Permalink
Merge 0f219cc into cf7da1e
Browse files Browse the repository at this point in the history
  • Loading branch information
ruyadorno committed May 1, 2020
2 parents cf7da1e + 0f219cc commit 4e31073
Show file tree
Hide file tree
Showing 27 changed files with 198 additions and 459 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Node CI

on: [push]
on: [push, pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
node-version: [6.x, 8.x, 10.x, 12.x]
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest, macOS-latest]

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ html/*.png

*.pyc


Session.vim
.nyc_output
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 6.14.5 (2020-05-01)

### BUG FIXES

* [`33ec41f18`](https://github.com/npm/cli/commit/33ec41f18f557146607cb14a7a38c707fce6d42c) [#758](https://github.com/npm/cli/pull/758) fix: relativize file links when inflating shrinkwrap ([@jsnajdr](https://github.com/jsnajdr))
* [`94ed456df`](https://github.com/npm/cli/commit/94ed456dfb0b122fd4192429024f034d06c3c454) [#1162](https://github.com/npm/cli/pull/1162) fix: npm init help output ([@mum-never-proud](https://github.com/mum-never-proud))

### DEPENDENCIES

* [`5587ac01f`](https://github.com/npm/cli/commit/5587ac01ffd0d2ea830a6bbb67bb34a611ffc409) `npm-registry-fetch@4.0.4`
* [`fc5d94c39`](https://github.com/npm/npm-registry-fetch/commit/fc5d94c39ca218d78df77249ab3a6bf1d9ed9db1) fix: removed default timeout
* [`07a4d8884`](https://github.com/npm/cli/commit/07a4d8884448359bac485a49c05fd2d23d06834b) `graceful-fs@4.2.4`
* [`8228d1f2e`](https://github.com/npm/cli/commit/8228d1f2e427ad9adee617266108acd1ee39b4a5) `mkdirp@0.5.5`
* [`e6d208317`](https://github.com/npm/cli/commit/e6d20831740a84aea766da2a2913cf82a4d56ada) `nopt@4.0.3`

## 6.14.4 (2020-03-24)

### DEPENDENCIES
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ All interactions in the npm repository are covered by the [npm Code of Conduct](
# Make sure you install the dependencies first before running tests.
$ npm install
# Run tests for the CLI (it could take awhile).
# Run tests for the CLI (it could take a while).
$ npm run test
```

Expand All @@ -97,7 +97,7 @@ $ make link
#################
# ALTERNATIVELY
#################
# If ou're working on a feature or bug, you can run the same command on your
# If you're working on a feature or bug, you can run the same command on your
# working branch and link that code.
# Create new branch to work from (there are many ways)
Expand Down Expand Up @@ -130,7 +130,7 @@ let you know that it's sent the request to start the benchmark suite.

![image](https://user-images.githubusercontent.com/2818462/72312698-e2e57f80-3656-11ea-9fcf-4a8f6b97b0d1.png)

If you've updated your pull-reuqest and you'd like to run the the benchmark suite again, simple update your original comment, by adding `test this please ✅` again, or simply just adding another emoji to the **end**. _(The trigger is the phrase "test this please ✅" at the beginning of a comment. Updates will trigger as well, so long as the phrase stays at the beginning.)_.
If you've updated your pull-request and you'd like to run the the benchmark suite again, simple update your original comment, by adding `test this please ✅` again, or simply just adding another emoji to the **end**. _(The trigger is the phrase "test this please ✅" at the beginning of a comment. Updates will trigger as well, so long as the phrase stays at the beginning.)_.

![image](https://user-images.githubusercontent.com/2818462/72313006-ec231c00-3657-11ea-9bd9-227634d67362.png)

Expand Down
42 changes: 28 additions & 14 deletions docs/content/using-npm/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,15 @@ suites, then those executables will be added to the `PATH` for
executing the scripts. So, if your package.json has this:

```json
{ "name" : "foo"
, "dependencies" : { "bar" : "0.1.x" }
, "scripts": { "start" : "bar ./test" } }
{
"name" : "foo",
"dependencies" : {
"bar" : "0.1.x"
},
"scripts": {
"start" : "bar ./test"
}
}
```

then you could run `npm start` to execute the `bar` script, which is
Expand Down Expand Up @@ -176,9 +182,15 @@ there is a config param of `<name>[@<version>]:<key>`. For example,
if the package.json has this:

```json
{ "name" : "foo"
, "config" : { "port" : "8080" }
, "scripts" : { "start" : "node server.js" } }
{
"name" : "foo",
"config" : {
"port" : "8080"
},
"scripts" : {
"start" : "node server.js"
}
}
```

and the server.js is this:
Expand Down Expand Up @@ -213,10 +225,11 @@ process.env.npm_package_scripts_install === "foo.js"
For example, if your package.json contains this:

```json
{ "scripts" :
{ "install" : "scripts/install.js"
, "postinstall" : "scripts/postinstall.js"
, "uninstall" : "scripts/uninstall.js"
{
"scripts" : {
"install" : "scripts/install.js",
"postinstall" : "scripts/install.js",
"uninstall" : "scripts/uninstall.js"
}
}
```
Expand All @@ -232,10 +245,11 @@ If you want to run a make command, you can do so. This works just
fine:

```json
{ "scripts" :
{ "preinstall" : "./configure"
, "install" : "make && make install"
, "test" : "make test"
{
"scripts" : {
"preinstall" : "./configure",
"install" : "make && make install",
"test" : "make test"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function init (args, cb) {
'This utility will walk you through creating a package.json file.',
'It only covers the most common items, and tries to guess sensible defaults.',
'',
'See `npm help json` for definitive documentation on these fields',
'See `npm help init` for definitive documentation on these fields',
'and exactly what they do.',
'',
'Use `npm install <pkg>` afterwards to install a package and',
Expand Down
8 changes: 6 additions & 2 deletions lib/install/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ function doesChildVersionMatch (child, requested, requestor) {
var childReq = child.package._requested
if (childReq) {
if (childReq.rawSpec === requested.rawSpec) return true
if (childReq.type === requested.type && childReq.saveSpec === requested.saveSpec) return true
if (childReq.type === requested.type) {
if (childReq.saveSpec === requested.saveSpec) return true
if (childReq.fetchSpec === requested.fetchSpec) return true
}
}
// If _requested didn't exist OR if it didn't match then we'll try using
// _from. We pass it through npa to normalize the specifier.
Expand Down Expand Up @@ -200,6 +203,7 @@ function removeObsoleteDep (child, log) {
})
}

exports.packageRelativePath = packageRelativePath
function packageRelativePath (tree) {
if (!tree) return ''
var requested = tree.package._requested || {}
Expand Down Expand Up @@ -570,7 +574,7 @@ function addDependency (name, versionSpec, tree, log, done) {
try {
var req = childDependencySpecifier(tree, name, versionSpec)
if (tree.swRequires && tree.swRequires[name]) {
var swReq = childDependencySpecifier(tree, name, tree.swRequires[name], tree.package._where)
var swReq = childDependencySpecifier(tree, name, tree.swRequires[name])
}
} catch (err) {
return done(err)
Expand Down
7 changes: 5 additions & 2 deletions lib/install/get-requested.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
'use strict'
const npa = require('npm-package-arg')
const moduleName = require('../utils/module-name.js')

const packageRelativePath = require('./deps').packageRelativePath
module.exports = function (child, reqBy) {
if (!child.requiredBy.length) return
if (!reqBy) reqBy = child.requiredBy[0]
const deps = reqBy.package.dependencies || {}
const devDeps = reqBy.package.devDependencies || {}
const optDeps = reqBy.package.optionalDependencies || {}
const name = moduleName(child)
return npa.resolve(name, deps[name] || devDeps[name], reqBy.realpath)
const spec = deps[name] || devDeps[name] || optDeps[name]
const where = packageRelativePath(reqBy)
return npa.resolve(name, spec, where)
}
23 changes: 22 additions & 1 deletion lib/install/inflate-shrinkwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ function tarballToVersion (name, tb) {
return match[2] || match[1]
}

function relativizeLink (name, spec, topPath, requested) {
if (!spec.startsWith('file:')) {
return
}

let requestedPath = requested.fetchSpec
if (requested.type === 'file') {
requestedPath = path.dirname(requestedPath)
}

const relativized = path.relative(requestedPath, path.resolve(topPath, spec.slice(5)))
return 'file:' + relativized
}

function inflatableChild (onDiskChild, name, topPath, tree, sw, requested, opts) {
validate('OSSOOOO|ZSSOOOO', arguments)
const usesIntegrity = (
Expand All @@ -101,7 +115,14 @@ function inflatableChild (onDiskChild, name, topPath, tree, sw, requested, opts)
sw.resolved = sw.version
sw.version = regTarball
}
if (sw.requires) Object.keys(sw.requires).map(_ => { sw.requires[_] = tarballToVersion(_, sw.requires[_]) || sw.requires[_] })
if (sw.requires) {
Object.keys(sw.requires).forEach(name => {
const spec = sw.requires[name]
sw.requires[name] = tarballToVersion(name, spec) ||
relativizeLink(name, spec, topPath, requested) ||
spec
})
}
const modernLink = requested.type === 'directory' && !sw.from
if (hasModernMeta(onDiskChild) && childIsEquivalent(sw, requested, onDiskChild)) {
// The version on disk matches the shrinkwrap entry.
Expand Down
30 changes: 19 additions & 11 deletions node_modules/graceful-fs/graceful-fs.js

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

22 changes: 11 additions & 11 deletions node_modules/graceful-fs/package.json

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

4 changes: 2 additions & 2 deletions node_modules/mkdirp/README.markdown

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

4 changes: 2 additions & 2 deletions node_modules/mkdirp/index.js

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

Loading

0 comments on commit 4e31073

Please sign in to comment.