Skip to content

Commit bae8cd4

Browse files
authored
Merge pull request #250 from akd-io/feature/247-add-support-for-netlify
Add support for Vercel and Netlify
2 parents f3ac613 + 775cde2 commit bae8cd4

File tree

16 files changed

+143
-1
lines changed

16 files changed

+143
-1
lines changed

apps/website/templates/LandingPage/components/TechnologiesForm.tsx

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ type OptionKey =
4545
| "formattingPreCommitHook"
4646
| "reactQuery"
4747
| "plausible"
48+
| "vercel"
49+
| "netlify"
4850

4951
const options = {
5052
pnpm: { key: "pnpm", value: "pnpm", label: "pnpm" },
@@ -112,6 +114,16 @@ const options = {
112114
value: "plausible",
113115
label: "Plausible",
114116
},
117+
vercel: {
118+
key: "vercel",
119+
value: "vercel",
120+
label: "Vercel",
121+
},
122+
netlify: {
123+
key: "netlify",
124+
value: "netlify",
125+
label: "Netlify",
126+
},
115127
} satisfies {
116128
[Key in OptionKey]: {
117129
key: Key
@@ -157,6 +169,10 @@ const serverStateManagementLibraryOptionKeys = [
157169
optionKeys.reactQuery,
158170
] satisfies OptionKey[]
159171
const analyticsOptionKeys = [optionKeys.plausible] satisfies OptionKey[]
172+
const deploymentOptionKeys = [
173+
optionKeys.vercel,
174+
optionKeys.netlify,
175+
] satisfies OptionKey[]
160176

161177
type ProjectName = string
162178
type PackageManager = (typeof packageManagerOptionKeys)[number]
@@ -170,6 +186,7 @@ type ContinuousIntegration = (typeof continuousIntegrationOptionKeys)[number]
170186
type ServerStateManagementLibrary =
171187
(typeof serverStateManagementLibraryOptionKeys)[number]
172188
type Analytics = (typeof analyticsOptionKeys)[number]
189+
type Deployment = (typeof deploymentOptionKeys)[number]
173190

174191
type TechnologiesFormData = {
175192
projectName: ProjectName
@@ -183,6 +200,7 @@ type TechnologiesFormData = {
183200
continuousIntegration: ContinuousIntegration[]
184201
serverStateManagementLibraries: ServerStateManagementLibrary[]
185202
analytics: Analytics[]
203+
deployment: Deployment[]
186204
}
187205
const defaultFormData: TechnologiesFormData = {
188206
projectName: "my-app",
@@ -196,6 +214,7 @@ const defaultFormData: TechnologiesFormData = {
196214
continuousIntegration: [optionKeys.githubActions],
197215
serverStateManagementLibraries: [optionKeys.reactQuery],
198216
analytics: [],
217+
deployment: [optionKeys.vercel],
199218
}
200219
const formDataKeys = objectToKeyToKeyMap(defaultFormData)
201220

@@ -213,6 +232,7 @@ const categoryLabels = {
213232
continuousIntegration: "Continuous Integration",
214233
serverStateManagementLibraries: "Server State Management",
215234
analytics: "Analytics",
235+
deployment: "Deployment",
216236
} as const
217237

218238
export const TechnologiesForm: React.FC = () => {
@@ -250,6 +270,7 @@ export const TechnologiesForm: React.FC = () => {
250270
pushArgs(formData.continuousIntegration)
251271
pushArgs(formData.serverStateManagementLibraries)
252272
pushArgs(formData.analytics)
273+
pushArgs(formData.deployment)
253274

254275
const projectNameSegments = formData.projectName.split("/")
255276
const lastPartOfProjectName = projectNameSegments.pop()!
@@ -271,7 +292,8 @@ export const TechnologiesForm: React.FC = () => {
271292
| "animation"
272293
| "continuousIntegration"
273294
| "serverStateManagementLibraries"
274-
| "analytics",
295+
| "analytics"
296+
| "deployment",
275297
optionKeys: Array<keyof typeof options>,
276298
validators?: {
277299
[key in keyof typeof options]?: Array<{
@@ -567,6 +589,16 @@ export const TechnologiesForm: React.FC = () => {
567589
continuousIntegrationOptionKeys
568590
)}
569591
</Flex>
592+
593+
<Flex direction="column" gap="4">
594+
<Heading as="h3" size="md">
595+
{categoryLabels.deployment}
596+
</Heading>
597+
{CheckboxesOfOptionKeys(
598+
formDataKeys.deployment,
599+
deploymentOptionKeys
600+
)}
601+
</Flex>
570602
</Flex>
571603
</Flex>
572604

packages/create-next-stack/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ The table below provides an overview of the technologies currently supported by
6262
| GitHub Actions | [Website](https://github.com/features/actions) - [Docs](https://docs.github.com/en/actions) - [Workflow syntax](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions) |
6363
| Plausible Analytics | [Website](https://plausible.io/) - [Docs](https://plausible.io/docs) - [GitHub](https://github.com/plausible/analytics) |
6464
| next-plausible | [Website](https://next-plausible.vercel.app/) - [GitHub](https://github.com/4lejandrito/next-plausible) |
65+
| Vercel | [Website](https://vercel.com/) - [Docs](https://vercel.com/docs) - [CLI Docs](https://vercel.com/docs/cli) |
66+
| Netlify | [Website](https://www.netlify.com/) - [Docs](https://docs.netlify.com/) - [CLI Docs](https://cli.netlify.com/) |
6567

6668
<!-- CNS-END-OF-TECHNOLOGIES-TABLE -->
6769

@@ -96,6 +98,7 @@ FLAGS
9698
Emotion)
9799
--material-ui Adds Material UI. (Component library) (Requires
98100
Emotion)
101+
--netlify Adds Netlify. (Hosting)
99102
--package-manager=<option> (required) Sets the preferred package manager.
100103
(Required)
101104
<options: pnpm|yarn|npm>
@@ -109,6 +112,7 @@ FLAGS
109112
(Required) <styling-method> =
110113
emotion|styled-components|tailwind-css|css-modul
111114
es|css-modules-with-sass
115+
--vercel Adds Vercel. (Hosting)
112116
```
113117

114118
<!-- CNS-END-OF-HELP-OUTPUT -->

packages/create-next-stack/src/main/commands/create-next-stack.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ export default class CreateNextStack extends Command {
104104
plausible: Flags.boolean({
105105
description: "Adds Plausible. (Analytics)",
106106
}),
107+
108+
// Hosting
109+
netlify: Flags.boolean({
110+
description: "Adds Netlify. (Hosting)",
111+
}),
112+
vercel: Flags.boolean({
113+
description: "Adds Vercel. (Hosting)",
114+
}),
107115
}
108116

109117
async run(): Promise<void> {

packages/create-next-stack/src/main/plugins/create-next-stack/sort-orders/scripts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export const scriptsSortOrder: string[] = [
1212
"lint",
1313
"format",
1414
"format:check",
15+
"deploy:vercel",
16+
"deploy:netlify",
1517
]
1618

1719
export const getSortedFilteredScripts = (inputs: ValidCNSInputs) => {

packages/create-next-stack/src/main/plugins/create-next-stack/sort-orders/technologies.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export const technologiesSortOrder: string[] = [
3232
"githubActions",
3333
"plausible",
3434
"nextPlausible",
35+
"vercel",
36+
"netlify",
3537
]
3638

3739
export const getTechnologies = (
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { createPlugin } from "../plugin"
2+
3+
export const netlifyPlugin = createPlugin({
4+
id: "netlify",
5+
name: "Netlify",
6+
description: "Adds support for Netlify",
7+
active: ({ flags }) => Boolean(flags["netlify"]),
8+
devDependencies: {
9+
"netlify-cli": {
10+
name: "netlify-cli",
11+
version: "^15.6.0",
12+
},
13+
},
14+
scripts: [
15+
{
16+
name: "deploy:netlify",
17+
command: "netlify deploy",
18+
description: "Deploy a preview deployment to Netlify",
19+
},
20+
],
21+
technologies: [
22+
{
23+
id: "netlify",
24+
name: "Netlify",
25+
description:
26+
"Netlify is a modern hosting platform for websites and web apps. With zero configuration, it will build and deploy your site globally and serverlessly with a single command. It can also be set up to do continuous deployments by integrating it with your repository host.",
27+
links: [
28+
{ title: "Website", url: "https://www.netlify.com/" },
29+
{ title: "Docs", url: "https://docs.netlify.com/" },
30+
{ title: "CLI Docs", url: "https://cli.netlify.com/" },
31+
],
32+
},
33+
],
34+
todos: [
35+
"Integrate Netlify with your repository host for continuous deployments at https://app.netlify.com/start. The Netlify CLI, mainly used for preview deployments, won't auto-detect Next.js until you do.",
36+
],
37+
} as const)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { createPlugin } from "../plugin"
2+
3+
export const vercelPlugin = createPlugin({
4+
id: "vercel",
5+
name: "Vercel",
6+
description: "Adds support for Vercel",
7+
active: ({ flags }) => Boolean(flags["vercel"]),
8+
devDependencies: {
9+
vercel: {
10+
name: "vercel",
11+
version: "^30.2.2",
12+
},
13+
},
14+
scripts: [
15+
{
16+
name: "deploy:vercel",
17+
command: "vercel",
18+
description: "Deploy a preview deployment to Vercel",
19+
},
20+
],
21+
technologies: [
22+
{
23+
id: "vercel",
24+
name: "Vercel",
25+
description:
26+
"Vercel is a modern hosting platform for websites and web apps. With zero configuration, it will build and deploy your site globally and serverlessly with a single command. It can also be set up to do continuous deployments by integrating it with your repository host.",
27+
links: [
28+
{ title: "Website", url: "https://vercel.com/" },
29+
{ title: "Docs", url: "https://vercel.com/docs" },
30+
{ title: "CLI Docs", url: "https://vercel.com/docs/cli" },
31+
],
32+
},
33+
],
34+
todos: [
35+
"Integrate Vercel with your repository host for continuous deployments at https://vercel.com/new",
36+
],
37+
} as const)

packages/create-next-stack/src/main/setup/setup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { framerMotionPlugin } from "../plugins/framer-motion"
1717
import { githubActionsPlugin } from "../plugins/github-actions"
1818
import { mantinePlugin } from "../plugins/mantine/mantine"
1919
import { materialUIPlugin } from "../plugins/material-ui/material-ui"
20+
import { netlifyPlugin } from "../plugins/netlify"
2021
import { nextPlugin } from "../plugins/next"
2122
import { npmPlugin } from "../plugins/npm"
2223
import { plausiblePlugin } from "../plugins/plausible"
@@ -30,6 +31,7 @@ import { sassPlugin } from "../plugins/sass/sass"
3031
import { styledComponentsPlugin } from "../plugins/styled-components"
3132
import { tailwindCSSPlugin } from "../plugins/tailwind-css"
3233
import { typescriptPlugin } from "../plugins/typescript"
34+
import { vercelPlugin } from "../plugins/vercel"
3335
import { yarnPlugin } from "../plugins/yarn"
3436
import { steps } from "../steps"
3537
import { printFinalMessages } from "./print-final-messages"
@@ -60,6 +62,8 @@ export const plugins: Plugin[] = [
6062
reactIconsPlugin,
6163
reactQueryPlugin,
6264
plausiblePlugin,
65+
vercelPlugin,
66+
netlifyPlugin,
6367
]
6468

6569
export const filterPlugins = (inputs: ValidCNSInputs): Plugin[] =>

packages/create-next-stack/src/tests/e2e/tests/css-modules-with-sass/css-modules-with-sass-all-flags.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ test(
1717
"--react-icons",
1818
"--react-query",
1919
"--plausible",
20+
"--vercel",
21+
"--netlify",
2022
".",
2123
])
2224
},

packages/create-next-stack/src/tests/e2e/tests/css-modules/css-modules-all-flags.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ test(
1717
"--react-icons",
1818
"--react-query",
1919
"--plausible",
20+
"--vercel",
21+
"--netlify",
2022
".",
2123
])
2224
},

0 commit comments

Comments
 (0)