Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

feat: support static site generation in cli (#3813)

Bogdan Chadkin50a71564f50a
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 8f511758bc..8c14e669c9 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -47,7 +47,6 @@
"parse5": "7.1.2",
"picocolors": "^1.0.1",
"strip-indent": "^4.0.0",
- "title-case": "^4.1.0",
"yargs": "^17.7.2",
"zod": "^3.22.4"
},
diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts
index cf2d6a9abe..f927cd6b96 100644
--- a/packages/cli/src/commands/build.ts
+++ b/packages/cli/src/commands/build.ts
@@ -24,9 +24,9 @@ export const buildOptions = (yargs: CommonYargsArgv) =>
type: "array",
string: true,
default: [] as string[],
- describe: `Template to use for the build [choices: ${PROJECT_TEMPALTES.join(
- ", "
- )}]`,
+ describe: `Template to use for the build [choices: ${PROJECT_TEMPALTES.map(
+ (item) => item.value
+ ).join(", ")}]`,
});
// @todo: use options.assets to define if we need to download assets
diff --git a/packages/cli/src/commands/init-flow.ts b/packages/cli/src/commands/init-flow.ts
index 2728157fa0..d4a2a01574 100644
--- a/packages/cli/src/commands/init-flow.ts
+++ b/packages/cli/src/commands/init-flow.ts
@@ -11,7 +11,6 @@ import {
text,
} from "@clack/prompts";
import { $ } from "execa";
-import { titleCase } from "title-case";
import { createFolderIfNotExists, isFileExists } from "../fs-utils";
import { PROJECT_TEMPALTES } from "../config";
import { link, validateShareLink } from "./link";
@@ -19,7 +18,7 @@ import { sync } from "./sync";
import { build, buildOptions } from "./build";
import type { StrictYargsOptionsToInterface } from "./yargs-types";
-type ProjectTemplates = (typeof PROJECT_TEMPALTES)[number];
+type ProjectTemplates = (typeof PROJECT_TEMPALTES)[number]["value"];
const exitIfCancelled = <Value>(value: Value | symbol): Value => {
if (isCancel(value)) {
@@ -74,10 +73,7 @@ export const initFlow = async (
projectTemplate = exitIfCancelled(
await select({
message: "Where would you like to deploy your project?",
- options: PROJECT_TEMPALTES.map((template) => ({
- value: template,
- label: titleCase(template),
- })),
+ options: PROJECT_TEMPALTES,
})
);
@@ -98,10 +94,7 @@ export const initFlow = async (
projectTemplate = exitIfCancelled(
await select({
message: "Where would you like to deploy your project?",
- options: PROJECT_TEMPALTES.map((template) => ({
- value: template,
- label: titleCase(template),
- })),
+ options: PROJECT_TEMPALTES,
})
);
}
diff --git a/packages/cli/src/config.ts b/packages/cli/src/config.ts
index 78184b004d..c9ac7dd938 100644
--- a/packages/cli/src/config.ts
+++ b/packages/cli/src/config.ts
@@ -53,8 +53,9 @@ export const jsonToGlobalConfig = (json: unknown) => {
export type GlobalConfig = z.infer<typeof zGlobalConfig>;
export const PROJECT_TEMPALTES = [
- "vanilla",
- "vercel",
- "netlify-functions",
- "netlify-edge-functions",
-] as const;
+ { value: "vanilla" as const, label: "Vanilla" },
+ { value: "vercel" as const, label: "Vercel" },
+ { value: "netlify-functions" as const, label: "Netlify Functions" },
+ { value: "netlify-edge-functions" as const, label: "Netlify Edge Functions" },
+ { value: "ssg" as const, label: "Static Site Generation (SSG)" },
+];
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 555c8294dd..74edd139f9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1025,9 +1025,6 @@ importers:
strip-indent:
specifier: ^4.0.0
version: 4.0.0
- title-case:
- specifier: ^4.1.0
- version: 4.1.0
yargs:
specifier: ^17.7.2
version: 17.7.2