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

deps/updates #4691

Merged
merged 24 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"@mdx-js/mdx": "^1.6.22",
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/fs": "^2.1.0",
"@npmcli/promise-spawn": "^1.3.2",
"@npmcli/promise-spawn": "^3.0.0",
"@npmcli/template-oss": "3.2.2",
"cmark-gfm": "^0.9.0",
"jsdom": "^18.1.0",
"marked-man": "^0.7.0",
"tap": "^15.2.3",
"tap": "^16.0.1",
"which": "^2.0.2",
"yaml": "^1.10.0"
},
Expand Down
16 changes: 13 additions & 3 deletions lib/workspaces/get-workspaces.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
const { resolve } = require('path')
const { resolve, relative } = require('path')
const mapWorkspaces = require('@npmcli/map-workspaces')
const minimatch = require('minimatch')
const rpj = require('read-package-json-fast')

// minimatch wants forward slashes only for glob patterns
const globify = pattern => pattern.split('\\').join('/')

// Returns an Map of paths to workspaces indexed by workspace name
// { foo => '/path/to/foo' }
const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom }) => {
Expand All @@ -20,9 +23,16 @@ const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom

for (const filterArg of filters) {
for (const [workspaceName, workspacePath] of workspaces.entries()) {
let relativePath = relative(relativeFrom, workspacePath)
if (filterArg.startsWith('./')) {
relativePath = `./${relativePath}`
}
const relativeFilter = relative(path, filterArg)
if (filterArg === workspaceName
|| resolve(relativeFrom || path, filterArg) === workspacePath
|| minimatch(workspacePath, `${resolve(relativeFrom || path, filterArg)}/*`)) {
|| resolve(relativeFrom, filterArg) === workspacePath
|| minimatch(relativePath, `${globify(relativeFilter)}/*`)
|| minimatch(relativePath, `${globify(filterArg)}/*`)
) {
res.set(workspaceName, workspacePath)
}
}
Expand Down
4 changes: 2 additions & 2 deletions node_modules/@npmcli/config/lib/env-replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = (f, env) => f.replace(envExpr, (orig, esc, name) => {

// consume the escape chars that are relevant.
if (esc.length % 2) {
return orig.substr((esc.length + 1) / 2)
return orig.slice((esc.length + 1) / 2)
}

return (esc.substr(esc.length / 2)) + val
return (esc.slice(esc.length / 2)) + val
})
8 changes: 4 additions & 4 deletions node_modules/@npmcli/config/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class Config {
if (!/^npm_config_/i.test(envKey) || envVal === '') {
continue
}
const key = envKey.substr('npm_config_'.length)
const key = envKey.slice('npm_config_'.length)
.replace(/(?!^)_/g, '-') // don't replace _ at the start of the key
.toLowerCase()
conf[key] = envVal
Expand Down Expand Up @@ -396,13 +396,13 @@ class Config {
validate (where) {
if (!where) {
let valid = true
for (const [where] of this.data.entries()) {
for (const [entryWhere] of this.data.entries()) {
// no need to validate our defaults, we know they're fine
// cli was already validated when parsed the first time
if (where === 'default' || where === 'builtin' || where === 'cli') {
if (entryWhere === 'default' || entryWhere === 'builtin' || entryWhere === 'cli') {
continue
}
const ret = this.validate(where)
const ret = this.validate(entryWhere)
valid = valid && ret
}
return valid
Expand Down
2 changes: 1 addition & 1 deletion node_modules/@npmcli/config/lib/parse-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const parseField = (f, key, opts, listElement = false) => {
if (isPath) {
const homePattern = platform === 'win32' ? /^~(\/|\\)/ : /^~\//
if (homePattern.test(f) && home) {
f = resolve(home, f.substr(2))
f = resolve(home, f.slice(2))
} else {
f = resolve(f)
}
Expand Down
28 changes: 15 additions & 13 deletions node_modules/@npmcli/config/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@npmcli/config",
"version": "4.0.1",
"version": "4.0.2",
"files": [
"bin",
"lib"
"bin/",
"lib/"
],
"main": "lib/index.js",
"description": "Configuration management for the npm cli",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/config"
"url": "https://github.com/npm/config.git"
},
"author": "GitHub Inc.",
"license": "ISC",
Expand All @@ -19,23 +19,24 @@
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"lint": "eslint '**/*.js'",
"postlint": "npm-template-check",
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"posttest": "npm run lint",
"template-copy": "npm-template-copy --force"
"template-oss-apply": "template-oss-apply --force"
},
"tap": {
"check-coverage": true,
"coverage-map": "map.js"
},
"devDependencies": {
"@npmcli/template-oss": "^2.8.1",
"tap": "^15.1.6"
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.2.2",
"tap": "^16.0.1"
},
"dependencies": {
"@npmcli/map-workspaces": "^2.0.1",
"ini": "^2.0.0",
"@npmcli/map-workspaces": "^2.0.2",
"ini": "^3.0.0",
"mkdirp-infer-owner": "^2.0.0",
"nopt": "^5.0.0",
"proc-log": "^2.0.0",
Expand All @@ -44,9 +45,10 @@
"walk-up-path": "^1.0.0"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16"
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
"version": "2.8.1"
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.2.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const colors = {
removed: ansi.red,
added: ansi.green,
header: ansi.yellow,
section: ansi.magenta
section: ansi.magenta,
}

function colorize (str, opts) {
Expand All @@ -13,10 +13,10 @@ function colorize (str, opts) {
headerLength = 2
}

const color = (str, colorId) => {
const color = (colorStr, colorId) => {
const { open, close } = colors[colorId]
// avoid highlighting the "\n" (would highlight till the end of the line)
return str.replace(/[^\n\r]+/g, open + '$&' + close)
return colorStr.replace(/[^\n\r]+/g, open + '$&' + close)
}

// this RegExp will include all the `\n` chars into the lines, easier to join
Expand Down
37 changes: 23 additions & 14 deletions node_modules/@npmcli/disparity-colors/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"name": "@npmcli/disparity-colors",
"version": "1.0.1",
"version": "2.0.0",
"main": "lib/index.js",
"files": [
"index.js"
"bin/",
"lib/"
],
"engines": {
"node": ">=10"
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"description": "Colorizes unified diff output",
"repository": "https://github.com/npm/disparity-colors",
"repository": {
"type": "git",
"url": "https://github.com/npm/disparity-colors.git"
},
"keywords": [
"disparity",
"npm",
Expand All @@ -24,7 +29,7 @@
"cli",
"tty"
],
"author": "npm Inc. <[email protected]>",
"author": "GitHub Inc.",
"contributors": [
{
"name": "Ruy Adorno",
Expand All @@ -34,27 +39,31 @@
],
"license": "ISC",
"scripts": {
"lint": "standard index.js",
"lint": "eslint \"**/*.js\"",
"pretest": "npm run lint",
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
"prepublishOnly": "git push origin --follow-tags",
"postlint": "template-oss-check",
"template-oss-apply": "template-oss-apply --force",
"lintfix": "npm run lint -- --fix",
"posttest": "npm run lint"
},
"tap": {
"check-coverage": true
},
"standard": {
"ignore": [
"/tap-snapshots/"
]
},
"devDependencies": {
"standard": "^16.0.3",
"tap": "^14.11.0"
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.2.2",
"tap": "^16.0.1"
},
"dependencies": {
"ansi-styles": "^4.3.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.2.2"
}
}
8 changes: 4 additions & 4 deletions node_modules/@npmcli/git/lib/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const shallowHosts = new Set([
// we have to use url.parse until we add the same shim that hosted-git-info has
// to handle scp:// urls
const { parse } = require('url') // eslint-disable-line node/no-deprecated-api
const { basename, resolve } = require('path')
const path = require('path')

const revs = require('./revs.js')
const getRevs = require('./revs.js')
const spawn = require('./spawn.js')
const { isWindows } = require('./utils.js')

Expand All @@ -31,7 +31,7 @@ const fs = require('fs')
const mkdirp = require('mkdirp')

module.exports = (repo, ref = 'HEAD', target = null, opts = {}) =>
revs(repo, opts).then(revs => clone(
getRevs(repo, opts).then(revs => clone(
repo,
revs,
ref,
Expand All @@ -48,7 +48,7 @@ const maybeShallow = (repo, opts) => {
}

const defaultTarget = (repo, /* istanbul ignore next */ cwd = process.cwd()) =>
resolve(cwd, basename(repo.replace(/[/\\]?\.git$/, '')))
path.resolve(cwd, path.basename(repo.replace(/[/\\]?\.git$/, '')))

const clone = (repo, revs, ref, revDoc, target, opts) => {
if (!revDoc) {
Expand Down
6 changes: 3 additions & 3 deletions node_modules/@npmcli/git/lib/lines-to-revs.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,19 @@ const lineToRevDoc = line => {
// ignore the pointer.
// For now, though, we have to save both, because some tags
// don't have peels, if they were not annotated.
const ref = rawRef.substr('refs/tags/'.length)
const ref = rawRef.slice('refs/tags/'.length)
return { sha, ref, rawRef, type }
}

if (type === 'branch') {
const ref = rawRef.substr('refs/heads/'.length)
const ref = rawRef.slice('refs/heads/'.length)
return { sha, ref, rawRef, type }
}

if (type === 'pull') {
// NB: merged pull requests installable with #pull/123/merge
// for the merged pr, or #pull/123 for the PR head
const ref = rawRef.substr('refs/'.length).replace(/\/head$/, '')
const ref = rawRef.slice('refs/'.length).replace(/\/head$/, '')
return { sha, ref, rawRef, type }
}

Expand Down
12 changes: 6 additions & 6 deletions node_modules/@npmcli/git/lib/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ module.exports = (gitArgs, opts = {}) => {
? gitArgs
: ['--no-replace-objects', ...gitArgs]

let retry = opts.retry
if (retry === null || retry === undefined) {
retry = {
let retryOpts = opts.retry
if (retryOpts === null || retryOpts === undefined) {
retryOpts = {
retries: opts.fetchRetries || 2,
factor: opts.fetchRetryFactor || 10,
maxTimeout: opts.fetchRetryMaxtimeout || 60000,
minTimeout: opts.fetchRetryMintimeout || 1000,
}
}
return promiseRetry((retry, number) => {
return promiseRetry((retryFn, number) => {
if (number !== 1) {
log.silly('git', `Retrying git command: ${
args.join(' ')} attempt # ${number}`)
Expand All @@ -38,7 +38,7 @@ module.exports = (gitArgs, opts = {}) => {
if (!gitError.shouldRetry(number)) {
throw gitError
}
retry(gitError)
retryFn(gitError)
})
}, retry)
}, retryOpts)
}
Loading