/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
v15.7.0
packages/react-devtools-scheduling-profiler/buildUtils.js
36 строк
826 B
E-Liang Tan
Scheduling Profiler: Redesign with DevTools styling (#19707)
03 сен 2020, 19:08
Не верифицирован
03 сен 2020, 19:08
38a512a
Код
Авторство
О чём код?
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ const {execSync} = require('child_process'); const {readFileSync} = require('fs'); const {resolve} = require('path'); function getGitCommit() { try { return execSync('git show -s --format=%h') .toString() .trim(); } catch (error) { // Mozilla runs this command from a git archive. // In that context, there is no Git revision. return null; } } function getVersionString() { const packageVersion = JSON.parse( readFileSync(resolve(__dirname, './package.json')), ).version; const commit = getGitCommit(); return `${packageVersion}-${commit}`; } module.exports = { getVersionString, };