/
usr
/
lib
/
node_modules
/
npm
/
lib
/
/usr/lib/node_modules/npm/lib
mkdir
upload
Name
Size
Mode
Actions
auth/
-
0755
rm
config/
-
0755
rm
doctor/
-
0755
rm
install/
-
0755
rm
search/
-
0755
rm
utils/
-
0755
rm
access.js
5672
0644
edit
dl
rm
adduser.js
1337
0644
edit
dl
rm
audit.js
10811
0644
edit
dl
rm
bin.js
515
0644
edit
dl
rm
bugs.js
864
0644
edit
dl
rm
build.js
4545
0644
edit
dl
rm
cache.js
4773
0644
edit
dl
rm
ci.js
1341
0644
edit
dl
rm
completion.js
7278
0644
edit
dl
rm
config.js
7612
0644
edit
dl
rm
dedupe.js
4999
0644
edit
dl
rm
deprecate.js
2157
0644
edit
dl
rm
dist-tag.js
4204
0644
edit
dl
rm
docs.js
1063
0644
edit
dl
rm
doctor.js
4075
0644
edit
dl
rm
edit.js
1407
0644
edit
dl
rm
explore.js
1709
0644
edit
dl
rm
fetch-package-metadata.js
4064
0644
edit
dl
rm
fund.js
5026
0644
edit
dl
rm
get.js
235
0644
edit
dl
rm
help-search.js
5777
0644
edit
dl
rm
help.js
6507
0644
edit
dl
rm
hook.js
4727
0644
edit
dl
rm
init.js
2805
0644
edit
dl
rm
install-ci-test.js
486
0644
edit
dl
rm
install-test.js
507
0644
edit
dl
rm
install.js
37345
0644
edit
dl
rm
link.js
5739
0644
edit
dl
rm
logout.js
1289
0644
edit
dl
rm
ls.js
16480
0644
edit
dl
rm
npm.js
14719
0644
edit
dl
rm
org.js
4276
0644
edit
dl
rm
outdated.js
12572
0644
edit
dl
rm
owner.js
6754
0644
edit
dl
rm
pack.js
12068
0644
edit
dl
rm
ping.js
1141
0644
edit
dl
rm
prefix.js
330
0644
edit
dl
rm
profile.js
11401
0644
edit
dl
rm
prune.js
2281
0644
edit
dl
rm
publish.js
5264
0644
edit
dl
rm
rebuild.js
2143
0644
edit
dl
rm
repo.js
1471
0644
edit
dl
rm
restart.js
64
0644
edit
dl
rm
root.js
320
0644
edit
dl
rm
run-script.js
5540
0644
edit
dl
rm
search.js
3442
0644
edit
dl
rm
set.js
276
0644
edit
dl
rm
shrinkwrap.js
10056
0644
edit
dl
rm
star.js
2157
0644
edit
dl
rm
stars.js
1054
0644
edit
dl
rm
start.js
62
0644
edit
dl
rm
stop.js
61
0644
edit
dl
rm
substack.js
509
0644
edit
dl
rm
team.js
4724
0644
edit
dl
rm
test.js
374
0644
edit
dl
rm
token.js
6818
0644
edit
dl
rm
unbuild.js
4374
0644
edit
dl
rm
uninstall.js
2261
0644
edit
dl
rm
unpublish.js
3594
0644
edit
dl
rm
update.js
2213
0644
edit
dl
rm
version.js
10029
0644
edit
dl
rm
view.js
15473
0644
edit
dl
rm
visnup.js
4104
0644
edit
dl
rm
whoami.js
1809
0644
edit
dl
rm
xmas.js
1663
0644
edit
dl
rm
Edit:
/usr/lib/node_modules/npm/lib/build.js
(4545B)
// npm build command // everything about the installation after the creation of // the .npm/{name}/{version}/package folder. // linking the modules into the npm.root, // resolving dependencies, etc. // This runs AFTER install or link are completed. var npm = require('./npm.js') var log = require('npmlog') var chain = require('slide').chain var path = require('path') var fs = require('graceful-fs') var lifecycle = require('./utils/lifecycle.js') var readJson = require('read-package-json') var binLinks = require('bin-links') var binLinksConfig = require('./config/bin-links.js') var ini = require('ini') var writeFile = require('write-file-atomic') module.exports = build build.usage = 'npm build [<folder>]' build._didBuild = {} build._noLC = {} function build (args, global, didPre, didRB, cb) { if (typeof cb !== 'function') { cb = didRB didRB = false } if (typeof cb !== 'function') { cb = didPre didPre = false } if (typeof cb !== 'function') { cb = global global = npm.config.get('global') } if (!args.length) { readJson(path.resolve(npm.localPrefix, 'package.json'), function (er, pkg) { if (!args.length && pkg && pkg.scripts && pkg.scripts.build) { log.warn('build', '`npm build` called with no arguments. Did you mean to `npm run-script build`?') } cb() }) } else { // it'd be nice to asyncMap these, but actually, doing them // in parallel generally munges up the output from node-waf var builder = build_(global, didPre, didRB) chain(args.map(function (arg) { return function (cb) { builder(arg, cb) } }), cb) } } function build_ (global, didPre, didRB) { return function (folder, cb) { folder = path.resolve(folder) if (build._didBuild[folder]) log.info('build', 'already built', folder) build._didBuild[folder] = true log.info('build', folder) readJson(path.resolve(folder, 'package.json'), function (er, pkg) { if (er) return cb(er) chain([ !didPre && [lifecycle, pkg, 'preinstall', folder], [linkStuff, pkg, folder, global], !didRB && [rebuildBundles, pkg, folder], [writeBuiltinConf, pkg, folder], didPre !== build._noLC && [lifecycle, pkg, 'install', folder], didPre !== build._noLC && [lifecycle, pkg, 'postinstall', folder] ], cb) }) } } var writeBuiltinConf = build.writeBuiltinConf = function (pkg, folder, cb) { // the builtin config is "sticky". Any time npm installs // itself globally, it puts its builtin config file there var parent = path.dirname(folder) var dir = npm.globalDir // Make this count for canary, too if ((pkg.name !== 'npm' && pkg.name !== 'npmc') || !npm.config.get('global') || !npm.config.usingBuiltin || dir !== parent) { return cb() } var data = ini.stringify(npm.config.sources.builtin.data) writeFile(path.resolve(folder, 'npmrc'), data, cb) } var linkStuff = build.linkStuff = function (pkg, folder, global, cb) { // allow to opt out of linking binaries. if (npm.config.get('bin-links') === false) return cb() return binLinks(pkg, folder, global, binLinksConfig(pkg), cb) } function rebuildBundles (pkg, folder, cb) { if (!npm.config.get('rebuild-bundle')) return cb() var deps = Object.keys(pkg.dependencies || {}) .concat(Object.keys(pkg.devDependencies || {})) var bundles = pkg.bundleDependencies || pkg.bundledDependencies || [] fs.readdir(path.resolve(folder, 'node_modules'), function (er, files) { // error means no bundles if (er) return cb() log.verbose('rebuildBundles', files) // don't asyncMap these, because otherwise build script output // gets interleaved and is impossible to read chain(files.filter(function (file) { // rebuild if: // not a .folder, like .bin or .hooks return !file.match(/^[._-]/) && // not some old 0.x style bundle file.indexOf('@') === -1 && // either not a dep, or explicitly bundled (deps.indexOf(file) === -1 || bundles.indexOf(file) !== -1) }).map(function (file) { file = path.resolve(folder, 'node_modules', file) return function (cb) { if (build._didBuild[file]) return cb() log.verbose('rebuild bundle', file) // if file is not a package dir, then don't do it. fs.lstat(path.resolve(file, 'package.json'), function (er) { if (er) return cb() build_(false)(file, cb) }) } }), cb) }) }
Save
cmd:
run