Skip to content

Commit

Permalink
Feat add no need git params (#41)
Browse files Browse the repository at this point in the history
* feat: support noNeedGit params

* docs: changeset

* feat: bump version
  • Loading branch information
caohuilin authored May 31, 2022
1 parent 3da348e commit c341b4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/api/app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @modern-js/codesmith-api-app

## 1.2.4

### Patch Changes

- 1fddc7a: feat: support noNeedGit params

## 1.0.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/api/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"modern",
"modern.js"
],
"version": "1.2.3",
"version": "1.2.4",
"jsnext:source": "./src/index.ts",
"types": "./dist/types/index.d.ts",
"main": "./dist/js/node/index.js",
Expand Down
9 changes: 6 additions & 3 deletions packages/api/app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,14 @@ export class AppAPI {
installFunc?: () => Promise<void>,
) {
const {
config: { isMonorepoSubProject = false },
config: { isMonorepoSubProject = false, noNeedGit },
} = this.generatorContext;

const customNoNeedGit = noNeedGit || process.env.NoNeedGit === 'true';

const inGitRepo = isMonorepoSubProject || (await this.gitApi.isInGitRepo());

if (!inGitRepo) {
if (!inGitRepo && !customNoNeedGit) {
await this.gitApi.initGitRepo();
}

Expand All @@ -139,7 +142,7 @@ export class AppAPI {
}

try {
if (!isMonorepoSubProject) {
if (!isMonorepoSubProject && !customNoNeedGit) {
await this.gitApi.addAndCommit(commitMessage || 'feat: init');
this.generatorCore.logger.info(i18n.t(localeKeys.git.success));
}
Expand Down

0 comments on commit c341b4b

Please sign in to comment.