Skip to content

Commit a260cd3

Browse files
authored
Merge pull request #35 from selemondev/feat/deployments
feat: add deployment CLIs
2 parents bad5368 + 888a2b8 commit a260cd3

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

src/core/questions/react/createReactQuestions.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import eslintPrompt from "./eslint"
1212
import stateManagement from './stateManagement'
1313
import reactQuery from './reactQuery'
1414
import program from '../../program'
15+
import { packageJsonMap } from '../../utils/react/ejsMapConstant'
1516
async function createReactQuestions(): Promise<void> {
1617
try {
1718
options.name = program.args[0] ?? (await createQuestion(projectName)).name;
@@ -34,7 +35,19 @@ async function createReactQuestions(): Promise<void> {
3435
await createQuestion(packageManager)
3536
}
3637

37-
await createQuestion(deploy);
38+
const VercelCLI = packageJsonMap.get('vercelCLI');
39+
40+
const NetlifyCLI = packageJsonMap.get('netlifyCLI');
41+
42+
const deploymentCLI = await createQuestion(deploy);
43+
44+
options.VercelCLI = deploymentCLI?.deploy === 'vercel' && VercelCLI;
45+
46+
options.NetlifyCLI = deploymentCLI?.deploy === 'netlify' && NetlifyCLI;
47+
48+
options.useVercelCLI = !!options.VercelCLI;
49+
50+
options.useNetlifyCLI = !!options.NetlifyCLI;
3851

3952
await createQuestion(initializeGit);
4053

src/core/utils/react/options.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export interface Options {
1010
Zustand?: string
1111
Eslint?: string
1212
Vitest?: string
13+
VercelCLI?: string
14+
NetlifyCLI?: string
1315
TanStackReactQuery?: string
1416
name?: string
1517
version?: string
@@ -22,6 +24,8 @@ export interface Options {
2224
useEslint?: boolean
2325
useEslintTs?: boolean
2426
useRouter?: boolean
27+
useVercelCLI?: boolean
28+
useNetlifyCLI?: boolean
2529
useReactQuery?: boolean
2630
useTailwind?: boolean
2731
useTypeScript?: boolean

src/deps/react/dependencies.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,27 @@ const vitest = {
100100
dev: ['dev', 'dev', 'dev', 'dev']
101101
}
102102

103+
const vercelCLI = {
104+
name: ['vercel'],
105+
version: ["^34.1.7"],
106+
stableVersion: ["^34.1.7"],
107+
dev: ['dev']
108+
}
109+
110+
const netlifyCLI = {
111+
name: ['netlify-cli'],
112+
version: ["^17.30.0"],
113+
stableVersion: ["^17.30.0"],
114+
dev: ['dev']
115+
}
116+
103117
const constantDevDeps = {
104118
name: options.useTypeScript ? typescript.name : javascript.name,
105119
version: options.useTypeScript ? typescript.version : javascript.version,
106120
stableVersion: options.useTypeScript ? typescript.stableVersion : javascript.stableVersion,
107121
dev: options.useTypeScript ? typescript.dev : javascript.dev
108122
}
123+
109124
const constantProDeps = {
110125
name: ['react', 'react-dom'],
111126
version: ['^18.2.0', '^18.2.0'],
@@ -126,5 +141,7 @@ export {
126141
jotai,
127142
reactHooks,
128143
redux,
129-
router
144+
router,
145+
vercelCLI,
146+
netlifyCLI
130147
}

template/react-js/package.ejs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
<% if (useVitest) { -%>
5353
<%- Vitest %>
5454
<% } -%>
55+
<% if (useVercelCLI) { -%>
56+
<%- VercelCLI %>
57+
<% } -%>
58+
<% if (useNetlifyCLI) { -%>
59+
<%- NetlifyCLI %>
60+
<% } -%>
5561
"@vitejs/plugin-react": "^4.2.1",
5662
"vite": "^5.0.8"
5763
}

template/react-ts/package.ejs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555
<% if (useVitest) { -%>
5656
<%- Vitest %>
5757
<% } -%>
58+
<% if (useVercelCLI) { -%>
59+
<%- VercelCLI %>
60+
<% } -%>
61+
<% if (useNetlifyCLI) { -%>
62+
<%- NetlifyCLI %>
63+
<% } -%>
5864
"@vitejs/plugin-react": "^4.2.1",
5965
"vite": "^5.0.8"
6066
}

0 commit comments

Comments
 (0)