X7ROOT File Manager
Current Path:
/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/lib
opt
/
alt
/
alt-nodejs6
/
root
/
usr
/
lib
/
node_modules
/
npm
/
lib
/
ðŸ“
..
📄
access.js
(3.23 KB)
📄
adduser.js
(3.98 KB)
📄
bin.js
(515 B)
📄
bugs.js
(857 B)
📄
build.js
(8.5 KB)
ðŸ“
cache
📄
cache.js
(10.17 KB)
📄
completion.js
(7.06 KB)
ðŸ“
config
📄
config.js
(8.27 KB)
📄
dedupe.js
(5.27 KB)
📄
deprecate.js
(1.4 KB)
📄
dist-tag.js
(3.67 KB)
📄
docs.js
(1.03 KB)
📄
edit.js
(985 B)
📄
explore.js
(1.63 KB)
📄
fetch-package-metadata.js
(11.5 KB)
📄
fetch-package-metadata.md
(1.76 KB)
📄
get.js
(235 B)
📄
help-search.js
(5.65 KB)
📄
help.js
(6.19 KB)
📄
init.js
(1.27 KB)
ðŸ“
install
📄
install-test.js
(507 B)
📄
install.js
(25.49 KB)
📄
link.js
(5.55 KB)
📄
logout.js
(1.1 KB)
📄
ls.js
(13.94 KB)
📄
npm.js
(11.23 KB)
📄
outdated.js
(12.1 KB)
📄
owner.js
(7.55 KB)
📄
pack.js
(1.79 KB)
📄
ping.js
(556 B)
📄
prefix.js
(330 B)
📄
prune.js
(1.5 KB)
📄
publish.js
(5.02 KB)
📄
rebuild.js
(2.11 KB)
📄
repo.js
(1.43 KB)
📄
restart.js
(64 B)
📄
root.js
(316 B)
📄
run-script.js
(5.16 KB)
📄
search.js
(7.76 KB)
📄
set.js
(276 B)
📄
shrinkwrap.js
(6.54 KB)
📄
star.js
(1.17 KB)
📄
stars.js
(1.1 KB)
📄
start.js
(62 B)
📄
stop.js
(61 B)
📄
substack.js
(509 B)
📄
tag.js
(1.08 KB)
📄
team.js
(1.41 KB)
📄
test.js
(294 B)
📄
unbuild.js
(3.97 KB)
📄
uninstall.js
(2.31 KB)
📄
unpublish.js
(3.55 KB)
📄
update.js
(1.76 KB)
ðŸ“
utils
📄
version.js
(7.71 KB)
📄
view.js
(9.12 KB)
📄
visnup.js
(4.01 KB)
📄
whoami.js
(1.42 KB)
📄
xmas.js
(1.57 KB)
Editing: publish.js
module.exports = publish var npm = require('./npm.js') var log = require('npmlog') var path = require('path') var readJson = require('read-package-json') var lifecycle = require('./utils/lifecycle.js') var chain = require('slide').chain var mapToRegistry = require('./utils/map-to-registry.js') var cachedPackageRoot = require('./cache/cached-package-root.js') var createReadStream = require('graceful-fs').createReadStream var npa = require('npm-package-arg') var semver = require('semver') var getPublishConfig = require('./utils/get-publish-config.js') var output = require('./utils/output.js') publish.usage = 'npm publish [<tarball>|<folder>] [--tag <tag>] [--access <public|restricted>]' + "\n\nPublishes '.' if no argument supplied" + '\n\nSets tag `latest` if no --tag specified' publish.completion = function (opts, cb) { // publish can complete to a folder with a package.json // or a tarball, or a tarball url. // for now, not yet implemented. return cb() } function publish (args, isRetry, cb) { if (typeof cb !== 'function') { cb = isRetry isRetry = false } if (args.length === 0) args = ['.'] if (args.length !== 1) return cb(publish.usage) log.verbose('publish', args) var t = npm.config.get('tag').trim() if (semver.validRange(t)) { var er = new Error('Tag name must not be a valid SemVer range: ' + t) return cb(er) } var arg = args[0] // if it's a local folder, then run the prepublish there, first. readJson(path.resolve(arg, 'package.json'), function (er, data) { if (er && er.code !== 'ENOENT' && er.code !== 'ENOTDIR') return cb(er) if (data) { if (!data.name) return cb(new Error('No name provided')) if (!data.version) return cb(new Error('No version provided')) } // Error is OK. Could be publishing a URL or tarball, however, that means // that we will not have automatically run the prepublish script, since // that gets run when adding a folder to the cache. if (er) return cacheAddPublish(arg, false, isRetry, cb) else cacheAddPublish(arg, true, isRetry, cb) }) } // didPre in this case means that we already ran the prepublish script, // and that the 'dir' is an actual directory, and not something silly // like a tarball or name@version thing. // That means that we can run publish/postpublish in the dir, rather than // in the cache dir. function cacheAddPublish (dir, didPre, isRetry, cb) { npm.commands.cache.add(dir, null, null, false, function (er, data) { if (er) return cb(er) log.silly('publish', data) var cachedir = path.resolve(cachedPackageRoot(data), 'package') chain( [ !didPre && [lifecycle, data, 'prepublish', cachedir], [publish_, dir, data, isRetry, cachedir], [lifecycle, data, 'publish', didPre ? dir : cachedir], [lifecycle, data, 'postpublish', didPre ? dir : cachedir] ], cb ) }) } function publish_ (arg, data, isRetry, cachedir, cb) { if (!data) return cb(new Error('no package.json file found')) var mappedConfig = getPublishConfig( data.publishConfig, npm.config, npm.registry ) var config = mappedConfig.config var registry = mappedConfig.client data._npmVersion = npm.version data._nodeVersion = process.versions.node delete data.modules if (data.private) { return cb(new Error( 'This package has been marked as private\n' + "Remove the 'private' field from the package.json to publish it." )) } mapToRegistry(data.name, config, function (er, registryURI, auth, registryBase) { if (er) return cb(er) var tarballPath = cachedir + '.tgz' // we just want the base registry URL in this case log.verbose('publish', 'registryBase', registryBase) log.silly('publish', 'uploading', tarballPath) data._npmUser = { name: auth.username, email: auth.email } var params = { metadata: data, body: createReadStream(tarballPath), auth: auth } // registry-frontdoor cares about the access level, which is only // configurable for scoped packages if (config.get('access')) { if (!npa(data.name).scope && config.get('access') === 'restricted') { return cb(new Error("Can't restrict access to unscoped packages.")) } params.access = config.get('access') } log.showProgress('publish:' + data._id) registry.publish(registryBase, params, function (er) { if (er && er.code === 'EPUBLISHCONFLICT' && npm.config.get('force') && !isRetry) { log.warn('publish', 'Forced publish over ' + data._id) return npm.commands.unpublish([data._id], function (er) { // ignore errors. Use the force. Reach out with your feelings. // but if it fails again, then report the first error. publish([arg], er || true, cb) }) } // report the unpublish error if this was a retry and unpublish failed if (er && isRetry && isRetry !== true) return cb(isRetry) if (er) return cb(er) output('+ ' + data._id) cb() }) }) }
Upload File
Create Folder