mirror of
https://github.com/facebook/react.git
synced 2026-02-24 04:33:04 +00:00
Updates the release script to publish tags as well as take a `--ci`
option
Test plan:
```
$ yarn npm:publish --debug --frfr
yarn run v1.22.22
$ node scripts/release/publish --debug --frfr
ℹ Preparing to publish (for real) [debug=true]
ℹ Building packages
✔ Successfully built babel-plugin-react-compiler
✔ Successfully built eslint-plugin-react-compiler
✔ Successfully built react-compiler-healthcheck
NPM 2-factor auth code: ******
✔ Wrote package.json for babel-plugin-react-compiler@0.0.0-experimental-10cf18a-20240806
========== babel-plugin-react-compiler ==========
⠧ Publishing babel-plugin-react-compiler@0.0.0-experimental-10cf18a-20240806 to npm
+ babel-plugin-react-compiler@0.0.0-experimental-10cf18a-20240806
✔ Successfully published babel-plugin-react-compiler to npm
ℹ dry-run: npm dist-tag add babel-plugin-react-compiler@0.0.0-experimental-10cf18a-20240806 experimental --otp=******
✔ Successfully pushed dist-tag experimental for babel-plugin-react-compiler to npm
✔ Wrote package.json for eslint-plugin-react-compiler@0.0.0-experimental-532f76b-20240806
========== eslint-plugin-react-compiler ==========
⠹ Publishing eslint-plugin-react-compiler@0.0.0-experimental-532f76b-20240806 to npm
+ eslint-plugin-react-compiler@0.0.0-experimental-532f76b-20240806
✔ Successfully published eslint-plugin-react-compiler to npm
ℹ dry-run: npm dist-tag add eslint-plugin-react-compiler@0.0.0-experimental-532f76b-20240806 experimental --otp=******
✔ Successfully pushed dist-tag experimental for eslint-plugin-react-compiler to npm
✔ Wrote package.json for react-compiler-healthcheck@0.0.0-experimental-48a8743-20240806
========== react-compiler-healthcheck ==========
⠙ Publishing react-compiler-healthcheck@0.0.0-experimental-48a8743-20240806 to npm
+ react-compiler-healthcheck@0.0.0-experimental-48a8743-20240806
✔ Successfully published react-compiler-healthcheck to npm
ℹ dry-run: npm dist-tag add react-compiler-healthcheck@0.0.0-experimental-48a8743-20240806 experimental --otp=******
✔ Successfully pushed dist-tag experimental for react-compiler-healthcheck to npm
✅ All done
✨ Done in 50.64s.
```
ghstack-source-id: 405cc001c2
Pull Request resolved: https://github.com/facebook/react/pull/30614
42 lines
1020 B
JavaScript
42 lines
1020 B
JavaScript
const cp = require('child_process');
|
|
const util = require('util');
|
|
|
|
function execHelper(command, options, streamStdout = false) {
|
|
return new Promise((resolve, reject) => {
|
|
const proc = cp.exec(command, options, (error, stdout) =>
|
|
error ? reject(error) : resolve(stdout.trim())
|
|
);
|
|
if (streamStdout) {
|
|
proc.stdout.pipe(process.stdout);
|
|
}
|
|
});
|
|
}
|
|
|
|
function _spawn(command, args, options, cb) {
|
|
const child = cp.spawn(command, args, options);
|
|
child.on('close', exitCode => {
|
|
cb(null, exitCode);
|
|
});
|
|
return child;
|
|
}
|
|
const spawnHelper = util.promisify(_spawn);
|
|
|
|
async function getDateStringForCommit(commit) {
|
|
let dateString = await execHelper(
|
|
`git show -s --no-show-signature --format=%cd --date=format:%Y%m%d ${commit}`
|
|
);
|
|
|
|
// On CI environment, this string is wrapped with quotes '...'s
|
|
if (dateString.startsWith("'")) {
|
|
dateString = dateString.slice(1, 9);
|
|
}
|
|
|
|
return dateString;
|
|
}
|
|
|
|
module.exports = {
|
|
execHelper,
|
|
spawnHelper,
|
|
getDateStringForCommit,
|
|
};
|