libnpmexec 1.2.0 → 2.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
@@ -17,7 +17,8 @@ The `npm exec` (`npx`) Programmatic API
17
17
  const libexec = require('libnpmexec')
18
18
  await libexec({
19
19
  args: ['yosay', 'Bom dia!'],
20
- cache: '~/.npm',
20
+ cache: '~/.npm/_cacache',
21
+ npxCache: '~/.npm/_npx',
21
22
  yes: true,
22
23
  })
23
24
  ```
@@ -30,6 +31,7 @@ await libexec({
30
31
  - `args`: List of pkgs to execute **Array<String>**, defaults to `[]`
31
32
  - `call`: An alternative command to run when using `packages` option **String**, defaults to empty string.
32
33
  - `cache`: The path location to where the npm cache folder is placed **String**
34
+ - `npxCache`: The path location to where the npx cache folder is placed **String**
33
35
  - `color`: Output should use color? **Boolean**, defaults to `false`
34
36
  - `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.
35
37
  - `locationMsg`: Overrides "at location" message when entering interactive mode **String**
@@ -2,12 +2,12 @@ const crypto = require('crypto')
2
2
 
3
3
  const { resolve } = require('path')
4
4
 
5
- const cacheInstallDir = ({ cache, packages }) => {
6
- if (!cache)
7
- throw new Error('Must provide a valid cache path')
5
+ const cacheInstallDir = ({ npxCache, packages }) => {
6
+ if (!npxCache)
7
+ throw new Error('Must provide a valid npxCache path')
8
8
 
9
9
  // only packages not found in ${prefix}/node_modules
10
- return resolve(cache, '_npx', getHash(packages))
10
+ return resolve(npxCache, getHash(packages))
11
11
  }
12
12
 
13
13
  const getHash = (packages) =>
package/lib/index.js CHANGED
@@ -124,8 +124,8 @@ const exec = async (opts) => {
124
124
  manis.some(manifest => manifestMissing({ tree, manifest }))
125
125
 
126
126
  if (needInstall) {
127
- const { cache } = flatOptions
128
- const installDir = cacheInstallDir({ cache, packages })
127
+ const { npxCache } = flatOptions
128
+ const installDir = cacheInstallDir({ npxCache, packages })
129
129
  await mkdirp(installDir)
130
130
  const arb = new Arborist({
131
131
  ...flatOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libnpmexec",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "files": [
5
5
  "lib"
6
6
  ],
package/CHANGELOG.md DELETED
@@ -1,17 +0,0 @@
1
- # Changelog
2
-
3
- ## v1.1.0
4
-
5
- - Add add walk up dir lookup logic to satisfy local bins,
6
- similar to `@npmcli/run-script`
7
-
8
- ## v1.0.1
9
-
10
- - Fix `scriptShell` option name.
11
-
12
- ## v1.0.0
13
-
14
- - Initial implementation, moves the code that used to live in the **npm cli**,
15
- ref: https://github.com/npm/cli/blob/release/v7.10.0/lib/exec.js into this
16
- separate module, providing a programmatic API to the **npm exec** functionality.
17
-