PATH:
opt
/
alt
/
alt-nodejs6
/
root
/
usr
/
lib
/
node_modules
/
npm
/
lib
// npm pack <pkg> // Packs the specified package into a .tgz file, which can then // be installed. module.exports = pack var install = require('./install.js') var cache = require('./cache.js') var fs = require('graceful-fs') var chain = require('slide').chain var path = require('path') var cwd = process.cwd() var writeStreamAtomic = require('fs-write-stream-atomic') var cachedPackageRoot = require('./cache/cached-package-root.js') var output = require('./utils/output.js') pack.usage = 'npm pack [[<@scope>/]<pkg>...]' // if it can be installed, it can be packed. pack.completion = install.completion function pack (args, silent, cb) { if (typeof cb !== 'function') { cb = silent silent = false } if (args.length === 0) args = ['.'] chain( args.map(function (arg) { return function (cb) { pack_(arg, cb) } }), function (er, files) { if (er || silent) return cb(er, files) printFiles(files, cb) } ) } function printFiles (files, cb) { files = files.map(function (file) { return path.relative(cwd, file) }) output(files.join('\n')) cb() } // add to cache, then cp to the cwd function pack_ (pkg, cb) { cache.add(pkg, null, null, false, function (er, data) { if (er) return cb(er) // scoped packages get special treatment var name = data.name if (name[0] === '@') name = name.substr(1).replace(/\//g, '-') var fname = name + '-' + data.version + '.tgz' var cached = path.join(cachedPackageRoot(data), 'package.tgz') var from = fs.createReadStream(cached) var to = writeStreamAtomic(fname) var errState = null from.on('error', cb_) to.on('error', cb_) to.on('close', cb_) from.pipe(to) function cb_ (er) { if (errState) return if (er) return cb(errState = er) cb(null, fname) } }) }
[-] start.js
[edit]
[-] shrinkwrap.js
[edit]
[-] view.js
[edit]
[-] repo.js
[edit]
[-] unpublish.js
[edit]
[-] fetch-package-metadata.js
[edit]
[-] stars.js
[edit]
[-] completion.js
[edit]
[-] team.js
[edit]
[-] dist-tag.js
[edit]
[-] help-search.js
[edit]
[-] edit.js
[edit]
[-] stop.js
[edit]
[-] whoami.js
[edit]
[+]
utils
[-] deprecate.js
[edit]
[-] substack.js
[edit]
[-] init.js
[edit]
[-] restart.js
[edit]
[-] link.js
[edit]
[-] owner.js
[edit]
[-] build.js
[edit]
[-] bin.js
[edit]
[-] tag.js
[edit]
[-] search.js
[edit]
[-] uninstall.js
[edit]
[-] test.js
[edit]
[+]
install
[-] xmas.js
[edit]
[-] install-test.js
[edit]
[-] publish.js
[edit]
[-] prune.js
[edit]
[-] install.js
[edit]
[-] bugs.js
[edit]
[-] ping.js
[edit]
[-] ls.js
[edit]
[-] access.js
[edit]
[-] fetch-package-metadata.md
[edit]
[-] config.js
[edit]
[-] explore.js
[edit]
[-] get.js
[edit]
[+]
cache
[-] prefix.js
[edit]
[-] outdated.js
[edit]
[-] docs.js
[edit]
[+]
..
[-] pack.js
[edit]
[-] unbuild.js
[edit]
[-] root.js
[edit]
[-] star.js
[edit]
[-] adduser.js
[edit]
[-] rebuild.js
[edit]
[-] npm.js
[edit]
[-] cache.js
[edit]
[-] help.js
[edit]
[-] logout.js
[edit]
[-] dedupe.js
[edit]
[-] visnup.js
[edit]
[-] version.js
[edit]
[-] update.js
[edit]
[-] set.js
[edit]
[-] run-script.js
[edit]
[+]
config