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
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2022-03-29 01:55:02 +0300
committerLuke Karrys <luke@lukekarrys.com>2022-03-30 00:51:53 +0300
commitaac01b89caf6336a2eb34d696296303cdadd5c08 (patch)
treec322cc32001ab169bd2e9e335ba7e4a45f31b4aa /workspaces/libnpmexec
parentb48a2bfde3745fa21ea4fc18d6f562fd82f82545 (diff)
deps: @npmcli/template-oss@3.2.1
- `no-shadow` was disabled for the cli and arborist due to the amount of changes required. These should be fixed later. - Manually updated linting in the cli root to match closer to what template-oss does - Included docs to be managed with template-oss. This required adding an empty test for now, with the plan to add real tests later.
Diffstat (limited to 'workspaces/libnpmexec')
-rw-r--r--workspaces/libnpmexec/.editorconfig3
-rw-r--r--workspaces/libnpmexec/.eslintrc.js3
-rw-r--r--workspaces/libnpmexec/.gitignore22
-rw-r--r--workspaces/libnpmexec/.npmrc3
-rw-r--r--workspaces/libnpmexec/CONTRIBUTING.md68
-rw-r--r--workspaces/libnpmexec/SECURITY.md3
-rw-r--r--workspaces/libnpmexec/lib/file-exists.js2
-rw-r--r--workspaces/libnpmexec/lib/index.js4
-rw-r--r--workspaces/libnpmexec/package.json20
-rw-r--r--workspaces/libnpmexec/test/index.js44
-rw-r--r--workspaces/libnpmexec/test/registry/server.js16
11 files changed, 56 insertions, 132 deletions
diff --git a/workspaces/libnpmexec/.editorconfig b/workspaces/libnpmexec/.editorconfig
deleted file mode 100644
index 0f3bb618c..000000000
--- a/workspaces/libnpmexec/.editorconfig
+++ /dev/null
@@ -1,3 +0,0 @@
-[*.js]
-indent_style = space
-indent_size = 2
diff --git a/workspaces/libnpmexec/.eslintrc.js b/workspaces/libnpmexec/.eslintrc.js
index 022767bc3..0e8ad0071 100644
--- a/workspaces/libnpmexec/.eslintrc.js
+++ b/workspaces/libnpmexec/.eslintrc.js
@@ -1,4 +1,4 @@
-// This file is automatically added by @npmcli/template-oss. Do not edit.
+/* This file is automatically added by @npmcli/template-oss. Do not edit. */
const { readdirSync: readdir } = require('fs')
@@ -7,6 +7,7 @@ const localConfigs = readdir(__dirname)
.map((file) => `./${file}`)
module.exports = {
+ root: true,
extends: [
'@npmcli',
...localConfigs,
diff --git a/workspaces/libnpmexec/.gitignore b/workspaces/libnpmexec/.gitignore
index 6ed44c72b..617e50ca0 100644
--- a/workspaces/libnpmexec/.gitignore
+++ b/workspaces/libnpmexec/.gitignore
@@ -4,20 +4,18 @@
/*
# keep these
-!/.commitlintrc.js
-!/.npmrc
-!/.eslintrc*
-!/.github
+!/.eslintrc.local.*
!**/.gitignore
-!/package.json
-!/docs
-!/bin
-!/lib
+!/docs/
+!/tap-snapshots/
+!/test/
!/map.js
-!/tap-snapshots
-!/test
-!/scripts
+!/scripts/
!/README*
!/LICENSE*
-!/SECURITY*
!/CHANGELOG*
+!/.eslintrc.js
+!/.gitignore
+!/bin/
+!/lib/
+!/package.json
diff --git a/workspaces/libnpmexec/.npmrc b/workspaces/libnpmexec/.npmrc
deleted file mode 100644
index 878b7ddef..000000000
--- a/workspaces/libnpmexec/.npmrc
+++ /dev/null
@@ -1,3 +0,0 @@
-;This file is automatically added by @npmcli/template-oss. Do not edit.
-
-package-lock=false
diff --git a/workspaces/libnpmexec/CONTRIBUTING.md b/workspaces/libnpmexec/CONTRIBUTING.md
deleted file mode 100644
index 045ba4b2e..000000000
--- a/workspaces/libnpmexec/CONTRIBUTING.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# Contributing
-## Table of Contents
-
-* [Introduction](#introduction)
-* [Running Tests](#running-tests)
-* [Coverage](#coverage)
-* [Types of Contributions](#types-of-contributions)
- * [Contributing an Issue?](#contributing-an-issue)
- * [Contributing a Question?](#contributing-a-question)
- * [Contributing a Bug Fix?](#contributing-a-bug-fix)
- * [Contributing a Feature?](#contributing-a-feature)
-* [Development Dependencies](#development-dependencies)
-* [Dependencies](#dependencies)
-
-## Introduction
-
-Welcome to the **libnpmexec** Contributor Guide! This document outlines the libnpmexec's process for community interaction and contribution. This includes the issue tracker, pull requests, wiki pages, and, to a certain extent, outside communication in the context of the libnpmexec. This is an entry point for anyone wishing to contribute their time and effort to making libnpmexec a better tool for the JavaScript community!
-
-All interactions in the **libnpmexec** repository are covered by the [npm Code of Conduct](https://www.npmjs.com/policies/conduct)
-
-
-## Running Tests
-
-```
-# Make sure you install the dependencies first before running tests.
-$ npm install
-
-# Run tests for the CLI (it could take awhile).
-$ npm run test
-```
-
-## Coverage
-
-We try and make sure that each new feature or bug fix has tests to go along with them in order to keep code coverages consistent and increasing. We are actively striving for 100% code coverage!
-
-## Types of Contributions
-
-> Before contributing something, double check the issue you're creating doesn't already exist in the repository but doing a quick search. Search of the [current issues](https://github.com/npm/libnpmexec/issues).
-
-### Contributing a Question?
-
-Huh? 🤔 Got a situation you're not sure about?! Perfect!
-
-You can create a new question [here](https://github.com/npm/libnpmexec/issues/new?template=question.md&title=%5BQUESTION%5D+%3Ctitle%3E)!
-
-### Contributing a Bug Fix?
-
-We'd be happy to triage and help! Head over to the issues and [create a new one](https://github.com/npm/libnpmexec/issues/new?template=bug.md&title=%5BBUG%5D+%3Ctitle%3E)!
-
-
-### Contributing a Feature?
-
-Snazzy, we're always up for fancy new things! If the feature is fairly minor [create a new one](https://github.com/npm/libnpmexec/issues/new?template=feature.md&title=%5BFEATURE%5D+%3Ctitle%3E), and the team can triage it and prioritize it into our backlog. However, if the feature is a little more complex, then it's best to create an [RFC](https://en.wikipedia.org/wiki/Request_for_Comments) in our [RFC repository](https://github.com/npm/rfcs). Exactly how to do that is outlined in that repository. If you're not sure _exactly_ how to implement your idea, or don't want to make a document about your idea, then please create an issue on that repository. We consider these RRFC's, or a "Requesting Request For Comment".
-
-## Development Dependencies
-
-You'll need a few things installed in order to update and test **libnpmexec** during development:
-
-
-* [node](https://nodejs.org/) v10 or greater
-
-> We recommend that you have a [node version manager](https://github.com/nvm-sh/nvm) installed if you plan on fixing bugs that might be present in a specific version of node. With a version manager you can easily switch versions of node and test if your changes to the CLI project are working.
-
-* [git](https://git-scm.com/) v2.11+
-
-
-## Dependencies
-<!-- Optional Section -->
diff --git a/workspaces/libnpmexec/SECURITY.md b/workspaces/libnpmexec/SECURITY.md
deleted file mode 100644
index a93106d0c..000000000
--- a/workspaces/libnpmexec/SECURITY.md
+++ /dev/null
@@ -1,3 +0,0 @@
-<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->
-
-Please send vulnerability reports through [hackerone](https://hackerone.com/github).
diff --git a/workspaces/libnpmexec/lib/file-exists.js b/workspaces/libnpmexec/lib/file-exists.js
index 05dddc89f..f89cfc217 100644
--- a/workspaces/libnpmexec/lib/file-exists.js
+++ b/workspaces/libnpmexec/lib/file-exists.js
@@ -4,7 +4,7 @@ const stat = promisify(require('fs').stat)
const walkUp = require('walk-up-path')
const fileExists = (file) => stat(file)
- .then((stat) => stat.isFile())
+ .then((res) => res.isFile())
.catch(() => false)
const localFileExists = async (dir, binName, root = '/') => {
diff --git a/workspaces/libnpmexec/lib/index.js b/workspaces/libnpmexec/lib/index.js
index 3c7be1149..81d152a20 100644
--- a/workspaces/libnpmexec/lib/index.js
+++ b/workspaces/libnpmexec/lib/index.js
@@ -119,11 +119,11 @@ const exec = async (opts) => {
...flatOptions,
path,
})
- const tree = await localArb.loadActual()
+ const localTree = await localArb.loadActual()
// do we have all the packages in manifest list?
const needInstall =
- manis.some(manifest => manifestMissing({ tree, manifest }))
+ manis.some(manifest => manifestMissing({ tree: localTree, manifest }))
if (needInstall) {
const { npxCache } = flatOptions
diff --git a/workspaces/libnpmexec/package.json b/workspaces/libnpmexec/package.json
index 9af42b299..f40ee4b43 100644
--- a/workspaces/libnpmexec/package.json
+++ b/workspaces/libnpmexec/package.json
@@ -2,17 +2,17 @@
"name": "libnpmexec",
"version": "4.0.2",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"main": "lib/index.js",
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"description": "npm exec (npx) programmatic API",
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmexec"
},
"keywords": [
@@ -33,16 +33,16 @@
],
"license": "ISC",
"scripts": {
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"posttest": "npm run lint",
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"color": true,
@@ -50,7 +50,8 @@
"files": "test/*.js"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.1",
"bin-links": "^3.0.0",
"tap": "^15.0.6"
},
@@ -69,6 +70,7 @@
"walk-up-path": "^1.0.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.1"
}
}
diff --git a/workspaces/libnpmexec/test/index.js b/workspaces/libnpmexec/test/index.js
index e44bc00c7..bd1b67cec 100644
--- a/workspaces/libnpmexec/test/index.js
+++ b/workspaces/libnpmexec/test/index.js
@@ -310,13 +310,13 @@ t.test('run multiple from registry', async t => {
t.test('no args', async t => {
const path = t.testdir({})
const runPath = path
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'../lib/run-script': ({ args }) => {
t.ok(args.length === 0, 'should call run-script with no args')
},
})
- await libexec({
+ await mockexec({
...baseOpts,
path,
runPath,
@@ -334,7 +334,7 @@ t.test('prompt, accepts', async t => {
const cache = resolve(testdir, 'cache')
const npxCache = resolve(testdir, 'npxCache')
t.test('with clearProgress function', async t => {
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'@npmcli/ci-detect': () => false,
npmlog: {
clearProgress () {
@@ -349,7 +349,7 @@ t.test('prompt, accepts', async t => {
'../lib/no-tty.js': () => false,
})
- await libexec({
+ await mockexec({
...baseOpts,
args: ['@ruyadorno/create-index'],
cache,
@@ -365,7 +365,7 @@ t.test('prompt, accepts', async t => {
})
t.test('without clearProgress function', async t => {
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'@npmcli/ci-detect': () => false,
read (opts, cb) {
cb(null, 'y')
@@ -373,7 +373,7 @@ t.test('prompt, accepts', async t => {
'../lib/no-tty.js': () => false,
})
- await libexec({
+ await mockexec({
...baseOpts,
args: ['@ruyadorno/create-index'],
cache,
@@ -400,7 +400,7 @@ t.test('prompt, refuses', async t => {
const cache = resolve(testdir, 'cache')
const npxCache = resolve(testdir, 'npxCache')
t.test('with clearProgress function', async t => {
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'@npmcli/ci-detect': () => false,
npmlog: {
clearProgress () {
@@ -415,7 +415,7 @@ t.test('prompt, refuses', async t => {
})
await t.rejects(
- libexec({
+ mockexec({
...baseOpts,
args: ['@ruyadorno/create-index'],
cache,
@@ -439,7 +439,7 @@ t.test('prompt, refuses', async t => {
})
t.test('without clearProgress function', async t => {
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'@npmcli/ci-detect': () => false,
read (opts, cb) {
cb(null, 'n')
@@ -448,7 +448,7 @@ t.test('prompt, refuses', async t => {
})
await t.rejects(
- libexec({
+ mockexec({
...baseOpts,
args: ['@ruyadorno/create-index'],
cache,
@@ -517,11 +517,11 @@ t.test('no prompt if no tty', async t => {
const runPath = path
const cache = resolve(testdir, 'cache')
const npxCache = resolve(testdir, 'npxCache')
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'../lib/no-tty.js': () => true,
})
- await libexec({
+ await mockexec({
...baseOpts,
args: ['@ruyadorno/create-index'],
cache,
@@ -546,11 +546,11 @@ t.test('no prompt if CI', async t => {
const runPath = path
const cache = resolve(testdir, 'cache')
const npxCache = resolve(testdir, 'npxCache')
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'@npmcli/ci-detect': () => true,
})
- await libexec({
+ await mockexec({
...baseOpts,
args: ['@ruyadorno/create-index'],
cache,
@@ -575,7 +575,7 @@ t.test('no prompt if CI, multiple packages', async t => {
const runPath = path
const cache = resolve(testdir, 'cache')
const npxCache = resolve(testdir, 'npxCache')
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'@npmcli/ci-detect': () => true,
'proc-log': {
warn (title, msg) {
@@ -587,7 +587,7 @@ t.test('no prompt if CI, multiple packages', async t => {
},
})
- await libexec({
+ await mockexec({
...baseOpts,
call: 'create-index',
packages: ['@ruyadorno/create-index', '@ruyadorno/create-test'],
@@ -629,41 +629,41 @@ t.test('sane defaults', async t => {
t.test('scriptShell default value', t => {
t.test('/bin/sh platforms', t => {
t.plan(1)
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'../lib/is-windows.js': false,
'../lib/run-script.js': (opt) => {
t.equal(opt.scriptShell, 'sh', 'should use expected shell value')
},
})
- libexec({ args: [], runPath: t.testDirName })
+ mockexec({ args: [], runPath: t.testDirName })
})
t.test('win32 defined ComSpec env var', t => {
t.plan(1)
const comspec = process.env.ComSpec
process.env.ComSpec = 'CMD'
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'../lib/is-windows.js': true,
'../lib/run-script.js': ({ scriptShell }) => {
t.equal(scriptShell, 'CMD', 'should use expected ComSpec value')
process.env.ComSpec = comspec
},
})
- libexec({ args: [], runPath: t.testDirName })
+ mockexec({ args: [], runPath: t.testDirName })
})
t.test('win32 cmd', t => {
t.plan(1)
const comspec = process.env.ComSpec
process.env.ComSpec = ''
- const libexec = t.mock('../lib/index.js', {
+ const mockexec = t.mock('../lib/index.js', {
'../lib/is-windows.js': true,
'../lib/run-script.js': ({ scriptShell }) => {
t.equal(scriptShell, 'cmd', 'should use expected cmd default value')
process.env.ComSpec = comspec
},
})
- libexec({ args: [], runPath: t.testDirName })
+ mockexec({ args: [], runPath: t.testDirName })
})
t.end()
diff --git a/workspaces/libnpmexec/test/registry/server.js b/workspaces/libnpmexec/test/registry/server.js
index 1db583a93..f35acfdeb 100644
--- a/workspaces/libnpmexec/test/registry/server.js
+++ b/workspaces/libnpmexec/test/registry/server.js
@@ -83,7 +83,7 @@ const startServer = cb => {
opts.headers.host = opts.host
opts.path = '/v1/advisories/bulk'
https.request(opts)
- .on('response', upstream => handleUpstream(upstream))
+ .on('response', r => handleUpstream(r))
.end(Buffer.concat(body))
} else {
handleUpstream(upstream)
@@ -195,9 +195,9 @@ const startServer = cb => {
const ct = upstream.headers['content-type']
const isJson = ct.includes('application/json')
- const file = isJson ? f + '.json' : f
- console.error('PROXY', `${req.url} -> ${file} ${ct}`)
- mkdirp.sync(dirname(file))
+ const proxyFile = isJson ? f + '.json' : f
+ console.error('PROXY', `${req.url} -> ${proxyFile} ${ct}`)
+ mkdirp.sync(dirname(proxyFile))
const data = []
res.statusCode = upstream.statusCode
res.setHeader('content-type', ct)
@@ -207,13 +207,13 @@ const startServer = cb => {
if (!errorStatus) {
if (isJson) {
const obj = JSON.parse(out.toString())
- writeFileSync(file, JSON.stringify(obj, 0, 2) + '\n')
+ writeFileSync(proxyFile, JSON.stringify(obj, 0, 2) + '\n')
const mrm = require('minify-registry-metadata')
- const minFile = file.replace(/\.json$/, '.min.json')
+ const minFile = proxyFile.replace(/\.json$/, '.min.json')
writeFileSync(minFile, JSON.stringify(mrm(obj), 0, 2) + '\n')
- console.error('WROTE JSONS', [file, minFile])
+ console.error('WROTE JSONS', [proxyFile, minFile])
} else {
- writeFileSync(file, out)
+ writeFileSync(proxyFile, out)
}
}
res.end(out)