UNPKG

create-react-native-library

Version:
34 lines (33 loc) 890 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createInitialGitCommit = createInitialGitCommit; var _spawn = require("./spawn"); async function createInitialGitCommit(folder) { let isInGitRepo = false; try { isInGitRepo = (await (0, _spawn.spawn)('git', ['rev-parse', '--is-inside-work-tree'])) === 'true'; } catch (e) { // Ignore error } if (!isInGitRepo) { try { await (0, _spawn.spawn)('git', ['init'], { cwd: folder }); await (0, _spawn.spawn)('git', ['branch', '-M', 'main'], { cwd: folder }); await (0, _spawn.spawn)('git', ['add', '.'], { cwd: folder }); await (0, _spawn.spawn)('git', ['commit', '-m', 'chore: initial commit'], { cwd: folder }); } catch (e) { // Ignore error } } } //# sourceMappingURL=initialCommit.js.map