utils.js — react Source File
Architecture documentation for utils.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
/**
* 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.
*/
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,
};
Domain
Subdomains
Source
Frequently Asked Questions
What does utils.js do?
utils.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in utils.js?
utils.js defines 3 function(s): _spawn, execHelper, getDateStringForCommit.
Where is utils.js in the architecture?
utils.js is located at compiler/scripts/release/shared/utils.js (domain: BabelCompiler, subdomain: Entrypoint, directory: compiler/scripts/release/shared).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free