UNPKG

create-react-native-library

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