Files
react-native/.github/workflow-scripts/utils.js
T
Blake Friedman 4c0cd72208 Fix typo in template action watcher script (#47286)
Summary:
Trivial typo - static analysis would have been a good thing.

Changelog: [Internal]

Pull Request resolved: https://github.com/facebook/react-native/pull/47286

Test Plan: eyes

Reviewed By: NickGerleman

Differential Revision: D65145600

Pulled By: blakef

fbshipit-source-id: 567ef3637441aa84651dce03f45b80068c5f4290
2024-10-29 10:06:17 -07:00

30 lines
756 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();
}
module.exports.run = run;
async function sleep(seconds) {
return new Promise(resolve => setTimeout(resolve, seconds * 1000));
}
module.exports.sleep = sleep;
async function getNpmPackageInfo(pkg, versionOrTag) {
return fetch(`https://registry.npmjs.org/${pkg}/${versionOrTag}`).then(resp =>
resp.json(),
);
}
module.exports.getNpmPackageInfo = getNpmPackageInfo;
module.exports.log = (...args) => console.log(...args);