mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
a52f5514ed
Summary: One of the steps we perform when doing a release is to run `npm view react-native` to verify that the release has been published and it is available with the right tag. As of today, we check this manually. This change aims at automating this check so that we don't have to do it manually ourselves. ## Changelog: [Internal] - Releases: automate the npm view check Pull Request resolved: https://github.com/facebook/react-native/pull/49164 Test Plan: Created a veriftyReleaseOnNPM-tests.js jest test to verify that the script works fine. <img width="667" alt="Screenshot 2025-02-04 at 15 18 24" src="https://github.com/user-attachments/assets/cf08155f-80da-4e15-a922-5c16f3fd806e" /> Reviewed By: cortinico Differential Revision: D69118622 Pulled By: cipolleschi fbshipit-source-id: a8d40cd2fcb164d8f7174de680b340510f3e8551
34 lines
704 B
JavaScript
34 lines
704 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
const {execSync} = require('child_process');
|
|
|
|
function run(cmd) {
|
|
return execSync(cmd, 'utf8').toString().trim();
|
|
}
|
|
|
|
async function sleep(seconds) {
|
|
return new Promise(resolve => setTimeout(resolve, seconds * 1000));
|
|
}
|
|
|
|
async function getNpmPackageInfo(pkg, versionOrTag) {
|
|
return fetch(`https://registry.npmjs.org/${pkg}/${versionOrTag}`).then(resp =>
|
|
resp.json(),
|
|
);
|
|
}
|
|
|
|
const log = (...args) => console.log(...args);
|
|
|
|
module.exports = {
|
|
log,
|
|
getNpmPackageInfo,
|
|
sleep,
|
|
run,
|
|
};
|