MCPcopy
hub / github.com/electron/forge / initGit

Function initGit

packages/api/core/src/api/init-scripts/init-git.ts:7–28  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

5const d = debug('electron-forge:init:git');
6
7export const initGit = async (dir: string): Promise<void> => {
8 await new Promise<void>((resolve, reject) => {
9 exec(
10 'git rev-parse --show-toplevel',
11 {
12 cwd: dir,
13 },
14 (err) => {
15 if (err) {
16 // not run within a Git repository
17 d('executing "git init" in directory:', dir);
18 exec('git init', { cwd: dir }, (initErr) =>
19 initErr ? reject(initErr) : resolve(),
20 );
21 } else {
22 d('.git directory already exists, skipping git initialization');
23 resolve();
24 }
25 },
26 );
27 });
28};

Callers 3

import.tsFile · 0.90
init.tsFile · 0.90
init-git.spec.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected