Skip to content

Instantly share code, notes, and snippets.

@atian25
Last active July 27, 2017 09:51
Show Gist options
  • Save atian25/cf7d4b282f570d857b8fee86856a0abf to your computer and use it in GitHub Desktop.
Save atian25/cf7d4b282f570d857b8fee86856a0abf to your computer and use it in GitHub Desktop.

quick npm owner add

#!/usr/bin/env node
const assert = require('assert');
const { execSync } = require('child_process');
const pkg = process.argv[2];
assert(pkg, 'Usage: npx <package name>');
run(`npm owner ls ${pkg}`);
[ 'fengmk2', 'popomore', 'dead_horse' ].forEach(user => {
run(`npm owner add ${user} ${pkg}`);
});
run(`npm owner ls ${pkg}`);
console.log('\nDone.');
function run(cmd) {
console.log('\x1b[33m➜ %s\x1b[0m',cmd);
execSync(cmd, { stdio: 'inherit' });
}
{
"name": "egg-npm-owner",
"version": "1.0.0",
"bin": "./index.js"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment