Files
react/scripts/release-manager/commands/utils/npm.js
T
Dan Abramov 34e4352cba Delete addons (#9209)
* Delete addons

* Remove ReactFragment dependency from tests

* Remove addons testing from fixtures

* Don't mention createFragment() in a warning

* Address feedback

* Remove unused variables

* Remove mention of deleted file

* Add a missing key to the test

* Fix lint
2017-03-20 16:15:01 +00:00

41 lines
1.2 KiB
JavaScript

'use strict';
const querystring = require('querystring');
const PACKAGES = [
'react-dom',
'react-native-renderer',
'react-test-renderer',
'react',
];
function whoami(app) {
return app.execInRepo('npm whoami');
}
function packagesNeedingAccess(app, username) {
let packages = JSON.parse(app.execInRepo(`npm access ls-packages ${username}`));
return PACKAGES.filter((pkg) => packages[pkg] !== 'read-write');
}
function generateAccessNeededIssue(username, packages) {
let data = {
title: `npm access request: ${username}`,
body: `In order to publish React to npm I need access to the following repositories:
${packages.map((pkg) => `- [${pkg}](https://npm.im/${pkg})`).join('\n')}`,
};
return `https://github.com/facebook/react/issues/new?${querystring.stringify(data)}`;
}
function grantAccess(app, username, packages) {
packages.forEach((pkg) => {
app.execInRepo(`npm owner add ${username} ${pkg}`);
});
}
module.exports.PACKAGES = PACKAGES;
module.exports.whoami = whoami;
module.exports.packagesNeedingAccess = packagesNeedingAccess;
module.exports.generateAccessNeededIssue = generateAccessNeededIssue;
module.exports.grantAccess = grantAccess;