diff --git a/workspaces/libnpmexec/lib/index.js b/workspaces/libnpmexec/lib/index.js index 78633a8cadb3c..37e07dd93bc62 100644 --- a/workspaces/libnpmexec/lib/index.js +++ b/workspaces/libnpmexec/lib/index.js @@ -1,20 +1,21 @@ 'use strict' +const { dirname, resolve } = require('node:path') +const crypto = require('node:crypto') const { mkdir } = require('node:fs/promises') const Arborist = require('@npmcli/arborist') const ciInfo = require('ci-info') -const crypto = require('node:crypto') const { log, input } = require('proc-log') const npa = require('npm-package-arg') const pacote = require('pacote') const { read } = require('read') const semver = require('semver') +const PackageJson = require('@npmcli/package-json') const { fileExists, localFileExists } = require('./file-exists.js') const getBinFromManifest = require('./get-bin-from-manifest.js') const noTTY = require('./no-tty.js') const runScript = require('./run-script.js') const isWindows = require('./is-windows.js') -const { dirname, resolve } = require('node:path') const binPaths = [] @@ -293,6 +294,9 @@ const exec = async (opts) => { }) } binPaths.push(resolve(installDir, 'node_modules/.bin')) + const pkgJson = await PackageJson.load(installDir) + pkgJson.update({ _npx: { packages } }) + await pkgJson.save() } return await run()