Skip to content

Commit

Permalink
feat: disable git if required (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bugs5382 committed Jan 15, 2024
2 parents 06fd35b + 5dea55b commit 4725074
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/index.ts
Expand Up @@ -37,7 +37,8 @@ export const main = async (): Promise<void> => {
}, {
choices: [
{ name: 'Github', value: 'github' },
{ name: 'Private Repo', value: 'private-repo' }
{ name: 'Private Repo', value: 'private-repo' },
{ name: 'Skip Git', value: 'skip-git' },
],
default: 0,
name: 'gitLocation',
Expand Down Expand Up @@ -67,7 +68,7 @@ export const main = async (): Promise<void> => {
type: 'input',
name: 'repoPrivateLocation',
message: 'Full URL of Git Repo:',
when: (answers) => answers.gitLocation !== 'github'
when: (answers) => answers.gitLocation !== 'github' && answers.gitLocation !== 'skip-git'
}, {
name: 'website',
message: 'Homepage of Author:',
Expand Down Expand Up @@ -154,18 +155,20 @@ export const main = async (): Promise<void> => {
}

// GIT: Initial
await git.init(cwd, 'initial')
if (gitLocation === 'github' && typeof repoOwner !== 'undefined' && typeof repoName !== 'undefined') {
await git.addRemote(cwd, repoOwner, repoName)
}

let gitUrl: string | undefined
let gitIssues: string | undefined
let gitReadme: string | undefined
if (gitLocation === 'github') {
gitUrl = `https://github.com/${repoOwner as string}/${repoName as string}`
gitIssues = `${gitUrl}/issues`
gitReadme = `${gitUrl}#readme`
let gitUrl: string | undefined
if (gitLocation !== 'skip-git') {
await git.init(cwd, 'initial')
if (gitLocation === 'github' && typeof repoOwner !== 'undefined' && typeof repoName !== 'undefined') {
await git.addRemote(cwd, repoOwner, repoName)
}

if (gitLocation === 'github') {
gitUrl = `https://github.com/${repoOwner as string}/${repoName as string}`
gitIssues = `${gitUrl}/issues`
gitReadme = `${gitUrl}#readme`
}
}

// Generate Licence
Expand Down
2 changes: 2 additions & 0 deletions src/modules/constants.ts
Expand Up @@ -135,6 +135,8 @@ export const VITE_REACT_SWC: Dependencies = {
'@types/react',
'@types/react-dom',
'@vitejs/plugin-react-swc',
'eslint-plugin-react-hooks',
'eslint-plugin-react-refresh',
'autoprefixer',
'prettier-plugin-tailwindcss',
'tailwindcss',
Expand Down

0 comments on commit 4725074

Please sign in to comment.