/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
scripts/shared/isGitRepo.js
35 строк
728 B
Alex Hunt
Reorganise shared script utils (#52473)
08 июл 2025, 16:10
08 июл 2025, 16:10
fc5e33b
Код
Авторство
О чём код?
/** * 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. * * @flow strict-local * @format */ 'use strict'; const childProcess = require('child_process'); /*:: type Commit = string; */ function isGitRepo() /*: boolean */ { try { const result = childProcess.execSync( 'git rev-parse --is-inside-work-tree', { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], }, ); return result.trim() === 'true'; } catch (error) { console.error(`Failed to check git repository status: ${error}`); } return false; } module.exports = isGitRepo;