From e5f4c76b75645cfed9cbe77ac61dafb19e37eb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9A=E7=8E=A9=E5=B9=BB=E7=81=B5qwq?= <94176676+HuanLinOTO@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:02:52 +0800 Subject: [PATCH] fix(setup): fatel error on windows about git init commit --- packages/scripts/src/setup.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/scripts/src/setup.ts b/packages/scripts/src/setup.ts index 344ceb1..a9c6839 100644 --- a/packages/scripts/src/setup.ts +++ b/packages/scripts/src/setup.ts @@ -1,6 +1,6 @@ import { CAC } from 'cac' import { copyFile, mkdir, readFile, readJson, writeFile } from 'fs-extra' -import { execSync } from 'child_process' +import { execSync, spawn } from 'child_process' import { resolve } from 'path' import { cwd, meta } from '.' import { blue, red } from 'kleur' @@ -133,9 +133,9 @@ class Initiator { copyFile(this.source + '/.gitattributes', this.target + '/.gitattributes'), copyFile(this.source + '/_gitignore', this.target + '/.gitignore'), ]) - execSync('git init', { cwd: this.target, stdio: 'ignore' }) - execSync('git add .', { cwd: this.target, stdio: 'ignore' }) - execSync('git commit -m "initial commit"', { cwd: this.target, stdio: 'ignore' }) + spawn('git', ['init'], { cwd: this.target, stdio: 'ignore' }); + spawn('git', ['add', '.'], { cwd: this.target, stdio: 'ignore' }); + spawn('git', ['commit', '-m', '"initial commit"'], { cwd: this.target, stdio: 'ignore' }); } }