libnpmexec 5.0.17 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,7 +31,7 @@ await libexec({
31
31
  - `call`: An alternative command to run when using `packages` option **String**, defaults to empty string.
32
32
  - `cache`: The path location to where the npm cache folder is placed **String**
33
33
  - `npxCache`: The path location to where the npx cache folder is placed **String**
34
- - `color`: Output should use color? **Boolean**, defaults to `false`
34
+ - `chalk`: Chalk instance to use for colors? **Required**
35
35
  - `localBin`: Location to the `node_modules/.bin` folder of the local project to start scanning for bin files **String**, defaults to `./node_modules/.bin`. **libexec** will walk up the directory structure looking for `node_modules/.bin` folders in parent folders that might satisfy the current `arg` and will use that bin if found.
36
36
  - `locationMsg`: Overrides "at location" message when entering interactive mode **String**
37
37
  - `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string.
package/lib/run-script.js CHANGED
@@ -1,4 +1,3 @@
1
- const chalk = require('chalk')
2
1
  const ciInfo = require('ci-info')
3
2
  const runScript = require('@npmcli/run-script')
4
3
  const readPackageJson = require('read-package-json-fast')
@@ -6,12 +5,6 @@ const npmlog = require('npmlog')
6
5
  const log = require('proc-log')
7
6
  const noTTY = require('./no-tty.js')
8
7
 
9
- const nocolor = {
10
- reset: s => s,
11
- bold: s => s,
12
- dim: s => s,
13
- }
14
-
15
8
  const run = async ({
16
9
  args,
17
10
  call,
@@ -25,8 +18,6 @@ const run = async ({
25
18
  }) => {
26
19
  // turn list of args into command string
27
20
  const script = call || args.shift() || scriptShell
28
- const color = !!flatOptions.color
29
- const colorize = color ? chalk : nocolor
30
21
 
31
22
  // do the fakey runScript dance
32
23
  // still should work if no package.json in cwd
@@ -49,14 +40,14 @@ const run = async ({
49
40
  return log.warn('exec', 'Interactive mode disabled in CI environment')
50
41
  }
51
42
 
52
- locationMsg = locationMsg || ` at location:\n${colorize.dim(runPath)}`
43
+ locationMsg = locationMsg || ` at location:\n${flatOptions.chalk.dim(runPath)}`
53
44
 
54
45
  output(`${
55
- colorize.reset('\nEntering npm script environment')
46
+ flatOptions.chalk.reset('\nEntering npm script environment')
56
47
  }${
57
- colorize.reset(locationMsg)
48
+ flatOptions.chalk.reset(locationMsg)
58
49
  }${
59
- colorize.bold('\nType \'exit\' or ^D when finished\n')
50
+ flatOptions.chalk.bold('\nType \'exit\' or ^D when finished\n')
60
51
  }`)
61
52
  }
62
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libnpmexec",
3
- "version": "5.0.17",
3
+ "version": "6.0.0",
4
4
  "files": [
5
5
  "bin/",
6
6
  "lib/"
@@ -42,7 +42,6 @@
42
42
  "template-oss-apply": "template-oss-apply --force"
43
43
  },
44
44
  "tap": {
45
- "color": true,
46
45
  "files": "test/*.js",
47
46
  "nyc-arg": [
48
47
  "--exclude",
@@ -54,6 +53,7 @@
54
53
  "@npmcli/mock-registry": "^1.0.0",
55
54
  "@npmcli/template-oss": "4.14.1",
56
55
  "bin-links": "^4.0.1",
56
+ "chalk": "^5.2.0",
57
57
  "just-extend": "^6.2.0",
58
58
  "just-safe-set": "^4.2.1",
59
59
  "minify-registry-metadata": "^3.0.0",
@@ -62,7 +62,6 @@
62
62
  "dependencies": {
63
63
  "@npmcli/arborist": "^6.2.9",
64
64
  "@npmcli/run-script": "^6.0.0",
65
- "chalk": "^4.1.0",
66
65
  "ci-info": "^3.7.1",
67
66
  "npm-package-arg": "^10.1.0",
68
67
  "npmlog": "^7.0.1",