pnpm
Version:
Fast, disk space efficient package manager
94 lines • 2.52 kB
JavaScript
;
// Avoid "Possible EventEmitter memory leak detected" warnings
// because it breaks pnpm's CLI output
process.setMaxListeners(0);
let argv = process.argv.slice(2);
if (argv.includes('--help') || argv.includes('-h') || argv.includes('--h')) {
argv = ['help'].concat(argv);
}
(async () => {
switch (argv[0]) {
case '-v':
case '--version':
const pkg = (await Promise.resolve().then(() => require('../pnpmPkgJson'))).default;
console.log(pkg.version);
break;
case 'help':
const help = (await Promise.resolve().then(() => require('../cmd/help'))).default;
help(argv.slice(1));
break;
// commands that are passed through to npm:
case 'access':
case 'adduser':
case 'bin':
case 'bugs':
case 'c':
case 'config':
case 'deprecate':
case 'dist-tag':
case 'docs':
case 'edit':
case 'get':
case 'info':
case 'init':
case 'login':
case 'logout':
case 'owner':
case 'pack':
case 'ping':
case 'prefix':
case 'profile':
case 'publish':
case 'repo':
case 'restart':
case 's':
case 'se':
case 'search':
case 'set':
case 'star':
case 'stars':
case 'start':
case 'stop':
case 'team':
case 'token':
case 'unpublish':
case 'unstar':
case 'v':
case 'version':
case 'view':
case 'whoami':
case 'xmas':
await passThruToNpm();
break;
case 't':
case 'tst':
case 'test':
case 'run':
case 'run-script':
if (argv.includes('--filter')) {
await runPnpm();
}
else {
await passThruToNpm();
}
break;
default:
await runPnpm();
break;
}
})();
async function runPnpm() {
const errorHandler = (await Promise.resolve().then(() => require('../err'))).default;
try {
const main = (await Promise.resolve().then(() => require('../main'))).default;
await main(argv);
}
catch (err) {
errorHandler(err);
}
}
async function passThruToNpm() {
const runNpm = (await Promise.resolve().then(() => require('../cmd/runNpm'))).default;
runNpm(argv);
}
//# sourceMappingURL=pnpm.js.map