create-cloudflare 0.0.0-dfbf03f87 → 0.0.0-dfea523ea
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +490 -463
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/templates/angular/pages/c3.ts +1 -0
- package/templates/astro/pages/c3.ts +1 -0
- package/templates/astro/workers/templates/ts/wrangler.jsonc +1 -1
- package/templates/common/c3.ts +5 -1
- package/templates/docusaurus/pages/c3.ts +1 -0
- package/templates/gatsby/pages/c3.ts +1 -0
- package/templates/hello-world/ts/test/env.d.ts +3 -0
- package/templates/hello-world/ts/worker-configuration.d.ts +6 -2
- package/templates/hello-world-assets-only/c3.ts +2 -2
- package/templates/hello-world-durable-object/c3.ts +4 -1
- package/templates/hello-world-with-assets/c3.ts +7 -3
- package/templates/hello-world-with-assets/js/public/index.html +2 -2
- package/templates/hello-world-with-assets/py/public/index.html +2 -2
- package/templates/hello-world-with-assets/ts/public/index.html +2 -2
- package/templates/hello-world-with-assets/ts/test/env.d.ts +0 -6
- package/templates/hello-world-with-assets/ts/test/tsconfig.json +1 -1
- package/templates/hello-world-with-assets/ts/worker-configuration.d.ts +6 -3
- package/templates/hono/pages/c3.ts +3 -1
- package/templates/hono/pages/templates/wrangler.jsonc +1 -2
- package/templates/next/c3.ts +7 -221
- package/templates/next/pages/c3.ts +225 -0
- package/{templates-experimental/next → templates/next/workers}/c3.ts +6 -7
- package/templates/next/workers/templates/open-next.config.ts +9 -0
- package/{templates-experimental/next → templates/next/workers}/templates/wrangler.jsonc +1 -1
- package/templates/nuxt/pages/c3.ts +1 -0
- package/templates/openapi/c3.ts +5 -1
- package/templates/pre-existing/c3.ts +6 -2
- package/templates/queues/c3.ts +5 -1
- package/templates/qwik/pages/c3.ts +1 -0
- package/templates/react/pages/c3.ts +1 -0
- package/templates/react/workers/js/src/App.jsx +1 -1
- package/templates/react/workers/js/{api → worker}/index.js +1 -1
- package/templates/react/workers/js/wrangler.jsonc +2 -2
- package/templates/react/workers/ts/src/App.tsx +1 -1
- package/templates/react/workers/ts/tsconfig.worker.json +1 -1
- package/templates/react/workers/ts/{api → worker}/index.ts +2 -3
- package/templates/react/workers/ts/wrangler.jsonc +2 -2
- package/templates/remix/pages/c3.ts +1 -0
- package/templates/scheduled/c3.ts +5 -1
- package/templates/scheduled/ts/src/index.ts +7 -0
- package/templates/svelte/pages/c3.ts +1 -0
- package/templates/vue/pages/c3.ts +1 -0
- package/templates/vue/workers/js/server/index.js +2 -2
- package/templates/vue/workers/js/wrangler.jsonc +0 -1
- package/templates/vue/workers/ts/server/index.ts +2 -3
- package/templates/vue/workers/ts/wrangler.jsonc +0 -1
- package/templates-experimental/next/templates/open-next.config.ts +0 -6
- /package/templates/next/{README.md → pages/README.md} +0 -0
- /package/templates/next/{app → pages/app}/js/app/api/hello/route.js +0 -0
- /package/templates/next/{app → pages/app}/js/app/not-found.js +0 -0
- /package/templates/next/{app → pages/app}/ts/app/api/hello/route.ts +0 -0
- /package/templates/next/{app → pages/app}/ts/app/not-found.tsx +0 -0
- /package/templates/next/{env.d.ts → pages/env.d.ts} +0 -0
- /package/templates/next/pages/{js → pages/js}/pages/api/hello.js +0 -0
- /package/templates/next/pages/{ts → pages/ts}/pages/api/hello.ts +0 -0
- /package/templates/next/{wrangler.jsonc → pages/wrangler.jsonc} +0 -0
- /package/{templates-experimental/next → templates/next/workers}/templates/.dev.vars +0 -0
- /package/{templates-experimental/next → templates/next/workers}/templates/__dot__gitignore +0 -0
- /package/{templates-experimental/next → templates/next/workers}/templates/cloudflare-env.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-dfea523ea",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/parser": "^7.21.3",
|
|
31
31
|
"@babel/types": "^7.21.4",
|
|
32
32
|
"@clack/prompts": "^0.6.3",
|
|
33
|
-
"@cloudflare/workers-types": "^4.
|
|
33
|
+
"@cloudflare/workers-types": "^4.20250410.0",
|
|
34
34
|
"@iarna/toml": "^3.0.0",
|
|
35
35
|
"@types/command-exists": "^1.2.0",
|
|
36
36
|
"@types/cross-spawn": "^6.0.2",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"degit": "^2.8.4",
|
|
53
53
|
"dns2": "^2.1.0",
|
|
54
54
|
"dotenv": "^16.0.0",
|
|
55
|
-
"esbuild": "0.
|
|
55
|
+
"esbuild": "0.25.2",
|
|
56
56
|
"execa": "^7.1.1",
|
|
57
57
|
"glob": "^10.3.3",
|
|
58
58
|
"haikunator": "^2.1.2",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"wrap-ansi": "^9.0.0",
|
|
71
71
|
"xdg-app-paths": "^8.3.0",
|
|
72
72
|
"yargs": "^17.7.2",
|
|
73
|
-
"@cloudflare/cli": "1.1.1",
|
|
74
73
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
75
74
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
76
|
-
"@cloudflare/vite-plugin": "0.0.0-
|
|
77
|
-
"
|
|
78
|
-
"
|
|
75
|
+
"@cloudflare/vite-plugin": "0.0.0-dfea523ea",
|
|
76
|
+
"wrangler": "0.0.0-dfea523ea",
|
|
77
|
+
"@cloudflare/cli": "1.1.1",
|
|
78
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
81
81
|
"node": ">=18.14.1"
|
package/templates/common/c3.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TemplateConfig } from "../../src/templates";
|
|
2
|
+
|
|
3
|
+
const config: TemplateConfig = {
|
|
2
4
|
configVersion: 1,
|
|
3
5
|
id: "common",
|
|
4
6
|
displayName: "Example router & proxy Worker",
|
|
@@ -17,3 +19,5 @@ export default {
|
|
|
17
19
|
},
|
|
18
20
|
},
|
|
19
21
|
};
|
|
22
|
+
|
|
23
|
+
export default config;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
// Generated by Wrangler
|
|
1
|
+
// Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 2905fd8e181cd2f4083a615fa51f1913)
|
|
2
2
|
// After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
|
|
3
|
-
|
|
3
|
+
declare namespace Cloudflare {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-empty-object-type
|
|
5
|
+
interface Env {
|
|
6
|
+
}
|
|
4
7
|
}
|
|
8
|
+
interface Env extends Cloudflare.Env {}
|
|
@@ -4,9 +4,9 @@ const config: TemplateConfig = {
|
|
|
4
4
|
configVersion: 1,
|
|
5
5
|
id: "hello-world-assets-only",
|
|
6
6
|
path: "templates/hello-world-assets-only",
|
|
7
|
-
displayName: "
|
|
7
|
+
displayName: "Static site",
|
|
8
8
|
description:
|
|
9
|
-
"For static sites
|
|
9
|
+
"For static sites or when using your own backend. Uses Workers Static Assets.",
|
|
10
10
|
platform: "workers",
|
|
11
11
|
copyFiles: {
|
|
12
12
|
path: "./templates",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TemplateConfig } from "../../src/templates";
|
|
2
|
+
|
|
3
|
+
const config: TemplateConfig = {
|
|
2
4
|
configVersion: 1,
|
|
3
5
|
id: "hello-world-durable-object",
|
|
4
6
|
displayName: "Worker + Durable Objects",
|
|
@@ -16,3 +18,4 @@ export default {
|
|
|
16
18
|
},
|
|
17
19
|
},
|
|
18
20
|
};
|
|
21
|
+
export default config;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TemplateConfig } from "../../src/templates";
|
|
2
|
+
|
|
3
|
+
const config: TemplateConfig = {
|
|
2
4
|
configVersion: 1,
|
|
3
5
|
id: "hello-world-with-assets",
|
|
4
6
|
path: "templates/hello-world-with-assets",
|
|
5
|
-
displayName: "
|
|
6
|
-
description:
|
|
7
|
+
displayName: "SSR / full-stack app",
|
|
8
|
+
description:
|
|
9
|
+
"For sites with a backend API, or server-side rendering (SSR). Uses Static Assets with a Worker.",
|
|
7
10
|
platform: "workers",
|
|
8
11
|
copyFiles: {
|
|
9
12
|
variants: {
|
|
@@ -19,3 +22,4 @@ export default {
|
|
|
19
22
|
},
|
|
20
23
|
},
|
|
21
24
|
};
|
|
25
|
+
export default config;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
9
|
<h1 id="heading"></h1>
|
|
10
|
-
<button id="button">Fetch a random UUID</button>
|
|
11
|
-
<
|
|
10
|
+
<button id="button" type="button">Fetch a random UUID</button>
|
|
11
|
+
<output id="random" for="button"></output>
|
|
12
12
|
<script>
|
|
13
13
|
fetch('/message')
|
|
14
14
|
.then((resp) => resp.text())
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
9
|
<h1 id="heading"></h1>
|
|
10
|
-
<button id="button">Fetch a random UUID</button>
|
|
11
|
-
<
|
|
10
|
+
<button id="button" type="button">Fetch a random UUID</button>
|
|
11
|
+
<output id="random" for="button"></output>
|
|
12
12
|
<script>
|
|
13
13
|
fetch('/message')
|
|
14
14
|
.then((resp) => resp.text())
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
9
|
<h1 id="heading"></h1>
|
|
10
|
-
<button id="button">Fetch a random UUID</button>
|
|
11
|
-
<
|
|
10
|
+
<button id="button" type="button">Fetch a random UUID</button>
|
|
11
|
+
<output id="random" for="button"></output>
|
|
12
12
|
<script>
|
|
13
13
|
fetch('/message')
|
|
14
14
|
.then((resp) => resp.text())
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
// Generated by Wrangler
|
|
2
|
-
|
|
3
|
-
interface Env {
|
|
1
|
+
// Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 187132f48ddf0f604882ba8213fe386f)
|
|
2
|
+
declare namespace Cloudflare {
|
|
3
|
+
interface Env {
|
|
4
|
+
ASSETS: Fetcher;
|
|
5
|
+
}
|
|
4
6
|
}
|
|
7
|
+
interface Env extends Cloudflare.Env {}
|
|
@@ -29,14 +29,16 @@ const config: TemplateConfig = {
|
|
|
29
29
|
},
|
|
30
30
|
path: "templates/hono/pages",
|
|
31
31
|
platform: "pages",
|
|
32
|
+
hidden: true,
|
|
32
33
|
generate,
|
|
33
34
|
transformPackageJson: async () => ({
|
|
34
35
|
scripts: {
|
|
35
36
|
"cf-typegen": "wrangler types --env-interface CloudflareBindings",
|
|
37
|
+
preview: "vite build && wrangler pages dev",
|
|
36
38
|
},
|
|
37
39
|
}),
|
|
38
40
|
devScript: "dev",
|
|
39
41
|
deployScript: "deploy",
|
|
40
|
-
previewScript: "
|
|
42
|
+
previewScript: "preview",
|
|
41
43
|
};
|
|
42
44
|
export default config;
|
package/templates/next/c3.ts
CHANGED
|
@@ -1,223 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { inputPrompt, spinner } from "@cloudflare/cli/interactive";
|
|
5
|
-
import { runFrameworkGenerator } from "frameworks/index";
|
|
6
|
-
import {
|
|
7
|
-
copyFile,
|
|
8
|
-
probePaths,
|
|
9
|
-
readFile,
|
|
10
|
-
readJSON,
|
|
11
|
-
usesEslint,
|
|
12
|
-
usesTypescript,
|
|
13
|
-
writeFile,
|
|
14
|
-
writeJSON,
|
|
15
|
-
} from "helpers/files";
|
|
16
|
-
import { detectPackageManager } from "helpers/packageManagers";
|
|
17
|
-
import { installPackages } from "helpers/packages";
|
|
18
|
-
import { getTemplatePath } from "../../src/templates";
|
|
19
|
-
import type { TemplateConfig } from "../../src/templates";
|
|
20
|
-
import type { C3Context } from "types";
|
|
1
|
+
import pages from "./pages/c3";
|
|
2
|
+
import workers from "./workers/c3";
|
|
3
|
+
import type { MultiPlatformTemplateConfig } from "../../src/templates";
|
|
21
4
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const generate = async (ctx: C3Context) => {
|
|
25
|
-
const projectName = ctx.project.name;
|
|
26
|
-
|
|
27
|
-
await runFrameworkGenerator(ctx, [projectName]);
|
|
28
|
-
|
|
29
|
-
const wranglerConfig = readFile(join(getTemplatePath(ctx), "wrangler.jsonc"));
|
|
30
|
-
writeFile(join(ctx.project.path, "wrangler.jsonc"), wranglerConfig);
|
|
31
|
-
updateStatus("Created wrangler.jsonc file");
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const updateNextConfig = (usesTs: boolean) => {
|
|
35
|
-
const s = spinner();
|
|
36
|
-
|
|
37
|
-
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
38
|
-
s.start(`Updating \`${configFile}\``);
|
|
39
|
-
|
|
40
|
-
const configContent = readFile(configFile);
|
|
41
|
-
|
|
42
|
-
const updatedConfigFile =
|
|
43
|
-
`import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';
|
|
44
|
-
|
|
45
|
-
// Here we use the @cloudflare/next-on-pages next-dev module to allow us to
|
|
46
|
-
// use bindings during local development (when running the application with
|
|
47
|
-
// \`next dev\`). This function is only necessary during development and
|
|
48
|
-
// has no impact outside of that. For more information see:
|
|
49
|
-
// https://github.com/cloudflare/next-on-pages/blob/main/internal-packages/next-dev/README.md
|
|
50
|
-
setupDevPlatform().catch(console.error);
|
|
51
|
-
|
|
52
|
-
`.replace(/\n\t*/g, "\n") + configContent;
|
|
53
|
-
|
|
54
|
-
writeFile(configFile, updatedConfigFile);
|
|
55
|
-
|
|
56
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const configure = async (ctx: C3Context) => {
|
|
60
|
-
const projectPath = ctx.project.path;
|
|
61
|
-
|
|
62
|
-
// Add a compatible function handler example
|
|
63
|
-
const path = probePaths([
|
|
64
|
-
`${projectPath}/pages/api`,
|
|
65
|
-
`${projectPath}/src/pages/api`,
|
|
66
|
-
`${projectPath}/src/app/api`,
|
|
67
|
-
`${projectPath}/app/api`,
|
|
68
|
-
`${projectPath}/src/app`,
|
|
69
|
-
`${projectPath}/app`,
|
|
70
|
-
]);
|
|
71
|
-
|
|
72
|
-
if (!path) {
|
|
73
|
-
throw new Error("Could not find the `/api` or `/app` directory");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const usesTs = usesTypescript(ctx);
|
|
77
|
-
|
|
78
|
-
if (usesTs) {
|
|
79
|
-
copyFile(
|
|
80
|
-
join(getTemplatePath(ctx), "env.d.ts"),
|
|
81
|
-
join(projectPath, "env.d.ts"),
|
|
82
|
-
);
|
|
83
|
-
updateStatus("Created an env.d.ts file");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
|
|
87
|
-
|
|
88
|
-
if (installEslintPlugin) {
|
|
89
|
-
await writeEslintrc(ctx);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
updateNextConfig(usesTs);
|
|
93
|
-
|
|
94
|
-
copyFile(
|
|
95
|
-
join(getTemplatePath(ctx), "README.md"),
|
|
96
|
-
join(projectPath, "README.md"),
|
|
97
|
-
);
|
|
98
|
-
updateStatus("Updated the README file");
|
|
99
|
-
|
|
100
|
-
await addDevDependencies(installEslintPlugin);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const shouldInstallNextOnPagesEslintPlugin = async (
|
|
104
|
-
ctx: C3Context,
|
|
105
|
-
): Promise<boolean> => {
|
|
106
|
-
const eslintUsage = usesEslint(ctx);
|
|
107
|
-
|
|
108
|
-
if (!eslintUsage.used) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (eslintUsage.configType !== ".eslintrc.json") {
|
|
113
|
-
warn(
|
|
114
|
-
`Expected .eslintrc.json from Next.js scaffolding but found ${eslintUsage.configType} instead`,
|
|
115
|
-
);
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return await inputPrompt({
|
|
120
|
-
type: "confirm",
|
|
121
|
-
question: "Do you want to use the next-on-pages eslint-plugin?",
|
|
122
|
-
label: "eslint-plugin",
|
|
123
|
-
defaultValue: true,
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export const writeEslintrc = async (ctx: C3Context): Promise<void> => {
|
|
128
|
-
const eslintConfig = readJSON(`${ctx.project.path}/.eslintrc.json`) as {
|
|
129
|
-
plugins: string[];
|
|
130
|
-
extends: string | string[];
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
eslintConfig.plugins ??= [];
|
|
134
|
-
eslintConfig.plugins.push("eslint-plugin-next-on-pages");
|
|
135
|
-
|
|
136
|
-
if (typeof eslintConfig.extends === "string") {
|
|
137
|
-
eslintConfig.extends = [eslintConfig.extends];
|
|
138
|
-
}
|
|
139
|
-
eslintConfig.extends ??= [];
|
|
140
|
-
eslintConfig.extends.push("plugin:eslint-plugin-next-on-pages/recommended");
|
|
141
|
-
|
|
142
|
-
writeJSON(`${ctx.project.path}/.eslintrc.json`, eslintConfig);
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const addDevDependencies = async (installEslintPlugin: boolean) => {
|
|
146
|
-
const packages = [
|
|
147
|
-
"@cloudflare/next-on-pages@1",
|
|
148
|
-
"@cloudflare/workers-types",
|
|
149
|
-
"vercel",
|
|
150
|
-
...(installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []),
|
|
151
|
-
];
|
|
152
|
-
await installPackages(packages, {
|
|
153
|
-
dev: true,
|
|
154
|
-
startText: "Adding the Cloudflare Pages adapter",
|
|
155
|
-
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`,
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export default {
|
|
160
|
-
configVersion: 1,
|
|
161
|
-
id: "next",
|
|
162
|
-
frameworkCli: "create-next-app",
|
|
163
|
-
platform: "pages",
|
|
5
|
+
const config: MultiPlatformTemplateConfig = {
|
|
164
6
|
displayName: "Next.js",
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
async selectVariant(ctx) {
|
|
169
|
-
const isApp = probePaths([
|
|
170
|
-
`${ctx.project.path}/src/app`,
|
|
171
|
-
`${ctx.project.path}/app`,
|
|
172
|
-
]);
|
|
173
|
-
|
|
174
|
-
const isTypescript = usesTypescript(ctx);
|
|
175
|
-
|
|
176
|
-
const dir = isApp ? "app" : "pages";
|
|
177
|
-
return `${dir}/${isTypescript ? "ts" : "js"}`;
|
|
178
|
-
},
|
|
179
|
-
destinationDir(ctx) {
|
|
180
|
-
const srcPath = probePaths([`${ctx.project.path}/src`]);
|
|
181
|
-
return srcPath ? "./src" : "./";
|
|
182
|
-
},
|
|
183
|
-
variants: {
|
|
184
|
-
"app/ts": {
|
|
185
|
-
path: "./app/ts",
|
|
186
|
-
},
|
|
187
|
-
"app/js": {
|
|
188
|
-
path: "./app/js",
|
|
189
|
-
},
|
|
190
|
-
"pages/ts": {
|
|
191
|
-
path: "./pages/ts",
|
|
192
|
-
},
|
|
193
|
-
"pages/js": {
|
|
194
|
-
path: "./pages/js",
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
transformPackageJson: async (_, ctx) => {
|
|
199
|
-
const isNpm = npm === "npm";
|
|
200
|
-
const isBun = npm === "bun";
|
|
201
|
-
const isNpmOrBun = isNpm || isBun;
|
|
202
|
-
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
203
|
-
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
204
|
-
const pmCommand = isNpmOrBun ? npx : npm;
|
|
205
|
-
const pagesBuildRunCommand = `${
|
|
206
|
-
isNpm ? "npm run" : isBun ? "bun" : pmCommand
|
|
207
|
-
} pages:build`;
|
|
208
|
-
return {
|
|
209
|
-
scripts: {
|
|
210
|
-
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
211
|
-
preview: `${pagesBuildRunCommand} && wrangler pages dev`,
|
|
212
|
-
deploy: `${pagesBuildRunCommand} && wrangler pages deploy`,
|
|
213
|
-
...(usesTypescript(ctx) && {
|
|
214
|
-
"cf-typegen": `wrangler types --env-interface CloudflareEnv env.d.ts`,
|
|
215
|
-
}),
|
|
216
|
-
},
|
|
217
|
-
};
|
|
218
|
-
},
|
|
219
|
-
devScript: "dev",
|
|
220
|
-
previewScript: "preview",
|
|
221
|
-
deployScript: "deploy",
|
|
222
|
-
compatibilityFlags: ["nodejs_compat"],
|
|
223
|
-
} as TemplateConfig;
|
|
7
|
+
platformVariants: { pages, workers },
|
|
8
|
+
};
|
|
9
|
+
export default config;
|