Skip to content

Commit

Permalink
fix: singlequote git commit issue on Windows (#223)
Browse files Browse the repository at this point in the history
* fix windows singlequote -> doublequote

* git commands soft error handling
  • Loading branch information
aliemir authored Mar 9, 2021
1 parent 928296b commit 5c3383f
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/saofile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from "path";
import validate from "validate-npm-package-name";
import { exec } from "child_process";
import { promisify } from "util";
import chalk from "chalk";

import { GeneratorConfig, Action } from "../@types/sao";
import {
Expand Down Expand Up @@ -295,15 +296,21 @@ const saoConfig: GeneratorConfig = {
* Create an initial commit
*/
if (!debug) {
// add
await promisify(exec)(
`git --git-dir=${saoInstance.outDir}/.git/ --work-tree=${saoInstance.outDir}/ add -A`,
);
// commit
await promisify(exec)(
`git --git-dir=${saoInstance.outDir}/.git/ --work-tree=${saoInstance.outDir}/ commit -m 'initial commit with superplate'`,
);
saoInstance.logger.info("created an initial commit.");
try {
// add
await promisify(exec)(
`git --git-dir=${saoInstance.outDir}/.git/ --work-tree=${saoInstance.outDir}/ add -A`,
);
// commit
await promisify(exec)(
`git --git-dir=${saoInstance.outDir}/.git/ --work-tree=${saoInstance.outDir}/ commit -m "initial commit with superplate"`,
);
saoInstance.logger.info("created an initial commit.");
} catch (_) {
console.log(
chalk.yellow`An error occured while creating git commit.`,
);
}
}

/**
Expand Down

0 comments on commit 5c3383f

Please sign in to comment.