Skip to content
This repository was archived by the owner on Dec 24, 2021. It is now read-only.

Commit 14d6d3b

Browse files
committed
refactor(deps): 🔥 remove create-git and commit manually
BREAKING CHANGE: - removed dependency and potential configs
1 parent 1bf6295 commit 14d6d3b

File tree

4 files changed

+54
-944
lines changed

4 files changed

+54
-944
lines changed

index.js

+10-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict'
22
const chalk = require('chalk')
33
const { execSync } = require('child_process')
4-
const createGit = require('create-git')
54
const createPackageJson = require('create-package-json')
65
const fs = require('fs-extra')
76
const path = require('path')
@@ -77,28 +76,20 @@ module.exports = async ({ directory, withFetch, withDocker, prompt }) => {
7776
}
7877

7978
await createPackageJson(packageOptions)
80-
log(`${step('NPM')} Initialized npm package and installed dependencies`)
79+
log(`${step('NPM')} Initialized npm package and installed dependencies.`)
8180

82-
await createGit({
83-
silent: prompt,
84-
cwd: directory,
85-
primaryBranch: 'master',
86-
ignoreExisting: true,
87-
initialCommitMessage: 'init: :tada: initial commit',
88-
remoteOrigin: '',
89-
ignoreTemplates: [],
90-
additionalRules: [],
91-
push: false,
92-
commitAll: true,
93-
})
94-
log(`${step('GIT')} Initialized git repository`)
81+
const createGitCommand = `cd ${directory} && git init`
82+
if (runCommand(createGitCommand)) log(`${step('GIT')} Initialized git repository.`)
9583

9684
const createLocalEnvCommand = `cd ${directory} && cp .env.example .env`
97-
const localEnvResult = runCommand(createLocalEnvCommand)
98-
if (localEnvResult) log(`${step('ENV')} Created local .env file`)
85+
if (runCommand(createLocalEnvCommand)) log(`${step('ENV')} Created local .env file.`)
9986

10087
const huskyCommand = `cd ${directory} && npm set-script prepare "husky install" && npm run prepare &&
10188
npx husky add .husky/pre-commit "npx lint-staged"`
102-
const huskyResult = runCommand(huskyCommand)
103-
if (huskyResult) log(`${step('HUSKY')} Initialized husky hook`)
89+
if (runCommand(huskyCommand)) log(`${step('HUSKY')} Initialized husky hook.`)
90+
91+
const initialCommitCommand = `cd ${directory} && git add . && git commit ${
92+
!prompt ? '--quiet' : ''
93+
} -m "init: :tada: initial commit"`
94+
if (runCommand(initialCommitCommand)) log(`${step('COMMIT')} Created initial commit.`)
10495
}

0 commit comments

Comments
 (0)