Skip to content

Commit d18d422

Browse files
committed
feat: add context to npx cache package.json
1 parent 3d8b257 commit d18d422

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

workspaces/libnpmexec/lib/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
'use strict'
22

3+
const { dirname, resolve } = require('node:path')
4+
const crypto = require('node:crypto')
35
const { mkdir } = require('node:fs/promises')
46
const Arborist = require('@npmcli/arborist')
57
const ciInfo = require('ci-info')
6-
const crypto = require('node:crypto')
78
const { log, input } = require('proc-log')
89
const npa = require('npm-package-arg')
910
const pacote = require('pacote')
1011
const { read } = require('read')
1112
const semver = require('semver')
13+
const PackageJson = require('@npmcli/package-json')
1214
const { fileExists, localFileExists } = require('./file-exists.js')
1315
const getBinFromManifest = require('./get-bin-from-manifest.js')
1416
const noTTY = require('./no-tty.js')
1517
const runScript = require('./run-script.js')
1618
const isWindows = require('./is-windows.js')
17-
const { dirname, resolve } = require('node:path')
1819

1920
const binPaths = []
2021

@@ -293,6 +294,9 @@ const exec = async (opts) => {
293294
})
294295
}
295296
binPaths.push(resolve(installDir, 'node_modules/.bin'))
297+
const pkgJson = await PackageJson.load(installDir)
298+
pkgJson.update({ _npx: { packages } })
299+
await pkgJson.save()
296300
}
297301

298302
return await run()

0 commit comments

Comments
 (0)