Skip to content

Commit

Permalink
chore: manually hoist latest versions of some of our deps
Browse files Browse the repository at this point in the history
I manually installed `@npmcli/fs` and `minipass-fetch` to the root of
our the dependency tree so that the deduped version would now live at
the root of `node_modules/` and any conflicting versions would be deduped
inside of its nested parent `node_modules/` directory. Once this was
locked in `package-lock.json` removing them from the `package.json` does
not undo the hoisting and deduping.

This has no effect on the resolved versions bundled with `npm` but it
does make it easier to visually scan the output of `query` commands to
be sure we are not inadvertently deduping dependencies in the future.
  • Loading branch information
lukekarrys committed Oct 19, 2022
1 parent 6a27a7b commit 7563a94
Show file tree
Hide file tree
Showing 52 changed files with 117 additions and 1,734 deletions.
13 changes: 2 additions & 11 deletions node_modules/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@
!/brace-expansion
!/builtins
!/cacache
!/cacache/node_modules/
/cacache/node_modules/*
!/cacache/node_modules/@npmcli/
/cacache/node_modules/@npmcli/*
!/cacache/node_modules/@npmcli/fs
!/chalk
!/chownr
!/cidr-regex
Expand Down Expand Up @@ -142,9 +137,6 @@
!/libnpmversion
!/lru-cache
!/make-fetch-happen
!/make-fetch-happen/node_modules/
/make-fetch-happen/node_modules/*
!/make-fetch-happen/node_modules/minipass-fetch
!/minimatch
!/minipass-collect
!/minipass-fetch
Expand All @@ -163,6 +155,7 @@
/node-gyp/node_modules/*
!/node-gyp/node_modules/@npmcli/
/node-gyp/node_modules/@npmcli/*
!/node-gyp/node_modules/@npmcli/fs
!/node-gyp/node_modules/@npmcli/move-file
!/node-gyp/node_modules/are-we-there-yet
!/node-gyp/node_modules/brace-expansion
Expand All @@ -176,6 +169,7 @@
!/node-gyp/node_modules/glob
!/node-gyp/node_modules/make-fetch-happen
!/node-gyp/node_modules/minimatch
!/node-gyp/node_modules/minipass-fetch
!/node-gyp/node_modules/nopt
!/node-gyp/node_modules/npmlog
!/node-gyp/node_modules/ssri
Expand All @@ -192,9 +186,6 @@
!/npm-pick-manifest
!/npm-profile
!/npm-registry-fetch
!/npm-registry-fetch/node_modules/
/npm-registry-fetch/node_modules/*
!/npm-registry-fetch/node_modules/minipass-fetch
!/npm-user-validate
!/npmlog
!/once
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion node_modules/@npmcli/fs/lib/cp/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('../fs.js')
const fs = require('fs/promises')
const getOptions = require('../common/get-options.js')
const node = require('../common/node.js')
const polyfill = require('./polyfill.js')
Expand Down
4 changes: 2 additions & 2 deletions node_modules/@npmcli/fs/lib/cp/polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {
ERR_FS_CP_UNKNOWN,
ERR_FS_EISDIR,
ERR_INVALID_ARG_TYPE,
} = require('../errors.js')
} = require('./errors.js')
const {
constants: {
errno: {
Expand All @@ -45,7 +45,7 @@ const {
symlink,
unlink,
utimes,
} = require('../fs.js')
} = require('fs/promises')
const {
dirname,
isAbsolute,
Expand Down
17 changes: 7 additions & 10 deletions node_modules/@npmcli/fs/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
'use strict'

const cp = require('./cp/index.js')
const withTempDir = require('./with-temp-dir.js')

module.exports = {
...require('./fs.js'),
copyFile: require('./copy-file.js'),
cp: require('./cp/index.js'),
mkdir: require('./mkdir.js'),
mkdtemp: require('./mkdtemp.js'),
rm: require('./rm/index.js'),
withTempDir: require('./with-temp-dir.js'),
withOwner: require('./with-owner.js'),
withOwnerSync: require('./with-owner-sync.js'),
writeFile: require('./write-file.js'),
cp,
withTempDir,
}
10 changes: 4 additions & 6 deletions node_modules/@npmcli/fs/lib/with-temp-dir.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const { join, sep } = require('path')

const getOptions = require('./common/get-options.js')
const mkdir = require('./mkdir.js')
const mkdtemp = require('./mkdtemp.js')
const rm = require('./rm/index.js')
const { mkdir, mkdtemp, rm } = require('fs/promises')

// create a temp directory, ensure its permissions match its parent, then call
// the supplied function passing it the path to the directory. clean up after
Expand All @@ -12,10 +10,10 @@ const withTempDir = async (root, fn, opts) => {
const options = getOptions(opts, {
copy: ['tmpPrefix'],
})
// create the directory, and fix its ownership
await mkdir(root, { recursive: true, owner: 'inherit' })
// create the directory
await mkdir(root, { recursive: true })

const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''), { owner: 'inherit' })
const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''))
let err
let result

Expand Down
18 changes: 10 additions & 8 deletions node_modules/@npmcli/fs/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
{
"name": "@npmcli/fs",
"version": "2.1.2",
"version": "3.0.0",
"description": "filesystem utilities for the npm cli",
"main": "lib/index.js",
"files": [
"bin/",
"lib/"
],
"scripts": {
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"snap": "tap",
"test": "tap",
"npmclilint": "npmcli-lint",
Expand All @@ -33,18 +30,23 @@
"license": "ISC",
"devDependencies": {
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.5.0",
"@npmcli/template-oss": "4.5.1",
"tap": "^16.0.1"
},
"dependencies": {
"@gar/promisify": "^1.1.3",
"semver": "^7.3.5"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.5.0"
"version": "4.5.1"
},
"tap": {
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
}
}
9 changes: 0 additions & 9 deletions node_modules/cacache/node_modules/@npmcli/fs/lib/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion node_modules/minipass-fetch/lib/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class Body {
}

async json () {
const buf = await this[CONSUME_BODY]()
try {
const buf = await this[CONSUME_BODY]()
return JSON.parse(buf.toString())
} catch (er) {
throw new FetchError(
Expand Down
20 changes: 10 additions & 10 deletions node_modules/minipass-fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"name": "minipass-fetch",
"version": "2.1.1",
"version": "3.0.0",
"description": "An implementation of window.fetch in Node.js using Minipass streams",
"license": "MIT",
"main": "lib/index.js",
"scripts": {
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags",
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"prepublishOnly": "git push origin --follow-tags",
"posttest": "npm run lint",
"template-oss-apply": "template-oss-apply --force"
},
"tap": {
"coverage-map": "map.js",
"check-coverage": true
"check-coverage": true,
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
},
"devDependencies": {
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.5.0",
"@npmcli/eslint-config": "^3.1.0",
"@npmcli/template-oss": "4.5.1",
"@ungap/url-search-params": "^0.2.2",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "~1.7.3",
Expand Down Expand Up @@ -57,11 +57,11 @@
"lib/"
],
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.5.0"
"version": "4.5.1"
}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs/promises')
const fs = require('../fs.js')
const getOptions = require('../common/get-options.js')
const node = require('../common/node.js')
const polyfill = require('./polyfill.js')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {
ERR_FS_CP_UNKNOWN,
ERR_FS_EISDIR,
ERR_INVALID_ARG_TYPE,
} = require('./errors.js')
} = require('../errors.js')
const {
constants: {
errno: {
Expand All @@ -45,7 +45,7 @@ const {
symlink,
unlink,
utimes,
} = require('fs/promises')
} = require('../fs.js')
const {
dirname,
isAbsolute,
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions node_modules/node-gyp/node_modules/@npmcli/fs/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
...require('./fs.js'),
copyFile: require('./copy-file.js'),
cp: require('./cp/index.js'),
mkdir: require('./mkdir.js'),
mkdtemp: require('./mkdtemp.js'),
rm: require('./rm/index.js'),
withTempDir: require('./with-temp-dir.js'),
withOwner: require('./with-owner.js'),
withOwnerSync: require('./with-owner-sync.js'),
writeFile: require('./write-file.js'),
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { join, sep } = require('path')

const getOptions = require('./common/get-options.js')
const { mkdir, mkdtemp, rm } = require('fs/promises')
const mkdir = require('./mkdir.js')
const mkdtemp = require('./mkdtemp.js')
const rm = require('./rm/index.js')

// create a temp directory, ensure its permissions match its parent, then call
// the supplied function passing it the path to the directory. clean up after
Expand All @@ -10,10 +12,10 @@ const withTempDir = async (root, fn, opts) => {
const options = getOptions(opts, {
copy: ['tmpPrefix'],
})
// create the directory
await mkdir(root, { recursive: true })
// create the directory, and fix its ownership
await mkdir(root, { recursive: true, owner: 'inherit' })

const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''))
const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''), { owner: 'inherit' })
let err
let result

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"name": "@npmcli/fs",
"version": "3.0.0",
"version": "2.1.2",
"description": "filesystem utilities for the npm cli",
"main": "lib/index.js",
"files": [
"bin/",
"lib/"
],
"scripts": {
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"snap": "tap",
"test": "tap",
"npmclilint": "npmcli-lint",
Expand All @@ -30,23 +33,18 @@
"license": "ISC",
"devDependencies": {
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "4.5.1",
"@npmcli/template-oss": "3.5.0",
"tap": "^16.0.1"
},
"dependencies": {
"@gar/promisify": "^1.1.3",
"semver": "^7.3.5"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.5.1"
},
"tap": {
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
"version": "3.5.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"name": "minipass-fetch",
"version": "3.0.0",
"version": "2.1.2",
"description": "An implementation of window.fetch in Node.js using Minipass streams",
"license": "MIT",
"main": "lib/index.js",
"scripts": {
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags",
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"prepublishOnly": "git push origin --follow-tags",
"posttest": "npm run lint",
"template-oss-apply": "template-oss-apply --force"
},
"tap": {
"coverage-map": "map.js",
"check-coverage": true,
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
"check-coverage": true
},
"devDependencies": {
"@npmcli/eslint-config": "^3.1.0",
"@npmcli/template-oss": "4.5.1",
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.5.0",
"@ungap/url-search-params": "^0.2.2",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "~1.7.3",
Expand Down Expand Up @@ -57,11 +57,11 @@
"lib/"
],
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.5.1"
"version": "3.5.0"
}
}
Loading

0 comments on commit 7563a94

Please sign in to comment.