/home/techb158/.nvm/versions/node/v16.20.2/lib/node_modules/npm/lib/commands
NameSizeModeActions
access.js55850644editdlrm
adduser.js22530644editdlrm
audit.js122340644editdlrm
bin.js7290644editdlrm
birthday.js5080644editdlrm
bugs.js8150644editdlrm
cache.js72470644editdlrm
ci.js37150644editdlrm
completion.js91240644editdlrm
config.js83080644editdlrm
dedupe.js14050644editdlrm
deprecate.js21090644editdlrm
diff.js82910644editdlrm
dist-tag.js56040644editdlrm
docs.js4470644editdlrm
doctor.js94460644editdlrm
edit.js20470644editdlrm
exec.js24990644editdlrm
explain.js36390644editdlrm
explore.js23870644editdlrm
find-dupes.js6020644editdlrm
fund.js65240644editdlrm
get.js5240644editdlrm
help-search.js57550644editdlrm
help.js46370644editdlrm
hook.js40270644editdlrm
init.js69720644editdlrm
install-ci-test.js3770644editdlrm
install-test.js3740644editdlrm
install.js52360644editdlrm
link.js51410644editdlrm
ll.js2340644editdlrm
logout.js13770644editdlrm
ls.js173510644editdlrm
org.js43050644editdlrm
outdated.js90500644editdlrm
owner.js60180644editdlrm
pack.js24190644editdlrm
ping.js8740644editdlrm
pkg.js35540644editdlrm
prefix.js3430644editdlrm
profile.js115250644editdlrm
prune.js7790644editdlrm
publish.js64810644editdlrm
query.js28730644editdlrm
rebuild.js22140644editdlrm
repo.js12720644editdlrm
restart.js3510644editdlrm
root.js2980644editdlrm
run-script.js70670644editdlrm
search.js27810644editdlrm
set-script.js26980644editdlrm
set.js5720644editdlrm
shrinkwrap.js27050644editdlrm
star.js19110644editdlrm
stars.js10520644editdlrm
start.js3410644editdlrm
stop.js3360644editdlrm
team.js45450644editdlrm
test.js3360644editdlrm
token.js69540644editdlrm
uninstall.js15520644editdlrm
unpublish.js46170644editdlrm
unstar.js1820644editdlrm
update.js17380644editdlrm
version.js36900644editdlrm
view.js147230644editdlrm
whoami.js5140644editdlrm
Edit: /home/techb158/.nvm/versions/node/v16.20.2/lib/node_modules/npm/lib/commands/ci.js (3715B)
const util = require('util') const Arborist = require('@npmcli/arborist') const rimraf = util.promisify(require('rimraf')) const reifyFinish = require('../utils/reify-finish.js') const runScript = require('@npmcli/run-script') const fs = require('fs') const readdir = util.promisify(fs.readdir) const log = require('../utils/log-shim.js') const validateLockfile = require('../utils/validate-lockfile.js') const ArboristWorkspaceCmd = require('../arborist-cmd.js') const Install = require('./install.js') class CI extends ArboristWorkspaceCmd { static description = 'Clean install a project' static name = 'ci' static params = Install.params async exec () { if (this.npm.global) { throw Object.assign(new Error('`npm ci` does not work for global packages'), { code: 'ECIGLOBAL', }) } const where = this.npm.prefix const opts = { ...this.npm.flatOptions, packageLock: true, // npm ci should never skip lock files path: where, save: false, // npm ci should never modify the lockfile or package.json workspaces: this.workspaceNames, } const arb = new Arborist(opts) await arb.loadVirtual().catch(er => { log.verbose('loadVirtual', er.stack) const msg = 'The `npm ci` command can only install with an existing package-lock.json or\n' + 'npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or\n' + 'later to generate a package-lock.json file, then try again.' throw this.usageError(msg) }) // retrieves inventory of packages from loaded virtual tree (lock file) const virtualInventory = new Map(arb.virtualTree.inventory) // build ideal tree step needs to come right after retrieving the virtual // inventory since it's going to erase the previous ref to virtualTree await arb.buildIdealTree() // verifies that the packages from the ideal tree will match // the same versions that are present in the virtual tree (lock file) // throws a validation error in case of mismatches const errors = validateLockfile(virtualInventory, arb.idealTree.inventory) if (errors.length) { throw this.usageError( '`npm ci` can only install packages when your package.json and ' + 'package-lock.json or npm-shrinkwrap.json are in sync. Please ' + 'update your lock file with `npm install` ' + 'before continuing.\n\n' + errors.join('\n') ) } // Only remove node_modules after we've successfully loaded the virtual // tree and validated the lockfile await this.npm.time('npm-ci:rm', async () => { const path = `${where}/node_modules` // get the list of entries so we can skip the glob for performance const entries = await readdir(path, null).catch(er => []) return Promise.all(entries.map(f => rimraf(`${path}/${f}`, { glob: false }))) }) await arb.reify(opts) const ignoreScripts = this.npm.config.get('ignore-scripts') // run the same set of scripts that `npm install` runs. if (!ignoreScripts) { const scripts = [ 'preinstall', 'install', 'postinstall', 'prepublish', // XXX should we remove this finally?? 'preprepare', 'prepare', 'postprepare', ] const scriptShell = this.npm.config.get('script-shell') || undefined for (const event of scripts) { await runScript({ path: where, args: [], scriptShell, stdio: 'inherit', stdioString: true, banner: !this.npm.silent, event, }) } } await reifyFinish(this.npm, arb) } } module.exports = CI