create-cloudflare 0.0.0-56637e3b2 → 0.0.0-5695a6746
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 +283 -224
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/templates/analog/c3.ts +0 -24
- package/templates/analog/templates/env.d.ts +1 -1
- package/templates/angular/pages/c3.ts +4 -3
- package/templates/angular/pages/templates/wrangler.jsonc +5 -0
- package/templates/angular/workers/c3.ts +1 -0
- package/templates/astro/pages/c3.ts +1 -0
- package/templates/astro/workers/templates/js/wrangler.jsonc +2 -1
- package/templates/astro/workers/templates/ts/wrangler.jsonc +3 -2
- package/templates/common/ts/tsconfig.json +0 -3
- package/templates/docusaurus/pages/c3.ts +2 -0
- package/templates/docusaurus/workers/c3.ts +1 -0
- package/templates/gatsby/pages/c3.ts +2 -0
- package/templates/gatsby/workers/c3.ts +1 -0
- package/templates/hello-world/js/package.json +1 -1
- package/templates/hello-world/py/README.md +2 -2
- package/templates/hello-world/py/pyproject.toml +1 -1
- package/templates/hello-world/py/src/entry.py +3 -2
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/hello-world/ts/test/index.spec.ts +0 -1
- package/templates/hello-world/ts/test/tsconfig.json +1 -1
- package/templates/hello-world/ts/tsconfig.json +0 -2
- package/templates/hello-world-assets-only/c3.ts +2 -2
- package/templates/hello-world-durable-object/c3.ts +3 -0
- package/templates/hello-world-durable-object/py/.python-version +1 -0
- package/templates/hello-world-durable-object/py/README.md +23 -0
- package/templates/hello-world-durable-object/py/__dot__gitignore +68 -0
- package/templates/hello-world-durable-object/py/package.json +13 -0
- package/templates/hello-world-durable-object/py/pyproject.toml +9 -0
- package/templates/hello-world-durable-object/py/src/entry.py +66 -0
- package/templates/hello-world-durable-object/py/uv.lock +22 -0
- package/templates/hello-world-durable-object/py/wrangler.jsonc +27 -0
- package/templates/hello-world-durable-object/ts/tsconfig.json +0 -2
- package/templates/hello-world-durable-object-with-assets/c3.ts +3 -0
- package/templates/hello-world-durable-object-with-assets/py/.python-version +1 -0
- package/templates/hello-world-durable-object-with-assets/py/README.md +23 -0
- package/templates/hello-world-durable-object-with-assets/py/__dot__gitignore +68 -0
- package/templates/hello-world-durable-object-with-assets/py/package.json +13 -0
- package/templates/hello-world-durable-object-with-assets/py/public/index.html +19 -0
- package/templates/hello-world-durable-object-with-assets/py/pyproject.toml +9 -0
- package/templates/hello-world-durable-object-with-assets/py/src/entry.py +66 -0
- package/templates/hello-world-durable-object-with-assets/py/uv.lock +22 -0
- package/templates/hello-world-durable-object-with-assets/py/wrangler.jsonc +31 -0
- package/templates/hello-world-durable-object-with-assets/ts/tsconfig.json +0 -2
- package/templates/hello-world-with-assets/c3.ts +3 -2
- package/templates/hello-world-with-assets/js/package.json +1 -1
- package/templates/hello-world-with-assets/js/wrangler.jsonc +2 -1
- package/templates/hello-world-with-assets/py/.python-version +1 -0
- package/templates/hello-world-with-assets/py/README.md +23 -0
- package/templates/hello-world-with-assets/py/pyproject.toml +9 -0
- package/templates/hello-world-with-assets/py/src/entry.py +9 -7
- package/templates/hello-world-with-assets/py/uv.lock +22 -0
- package/templates/hello-world-with-assets/ts/package.json +1 -1
- package/templates/hello-world-with-assets/ts/test/tsconfig.json +1 -1
- package/templates/hello-world-with-assets/ts/tsconfig.json +0 -2
- package/templates/hello-world-with-assets/ts/wrangler.jsonc +2 -1
- package/templates/hono/pages/c3.ts +5 -1
- package/templates/hono/workers/c3.ts +3 -1
- package/templates/next/pages/c3.ts +7 -10
- package/templates/next/workers/c3.ts +10 -13
- package/templates/next/workers/templates/open-next.config.ts +5 -2
- package/templates/next/workers/templates/wrangler.jsonc +3 -2
- package/templates/nuxt/pages/c3.ts +3 -26
- package/templates/nuxt/pages/templates/env.d.ts +1 -1
- package/templates/nuxt/workers/c3.ts +2 -26
- package/templates/nuxt/workers/templates/env.d.ts +1 -1
- package/templates/openapi/ts/__dot__gitignore +1 -0
- package/templates/openapi/ts/package.json +7 -6
- package/templates/openapi/ts/src/endpoints/taskCreate.ts +2 -2
- package/templates/openapi/ts/src/endpoints/taskDelete.ts +2 -2
- package/templates/openapi/ts/src/endpoints/taskFetch.ts +2 -2
- package/templates/openapi/ts/src/endpoints/taskList.ts +2 -2
- package/templates/openapi/ts/src/index.ts +4 -1
- package/templates/openapi/ts/src/types.ts +3 -0
- package/templates/openapi/ts/tsconfig.json +18 -21
- package/templates/pre-existing/c3.ts +1 -1
- package/templates/queues/ts/tsconfig.json +0 -2
- package/templates/qwik/pages/c3.ts +2 -0
- package/templates/qwik/workers/c3.ts +3 -4
- package/templates/qwik/workers/templates/wrangler.jsonc +2 -1
- package/templates/react/pages/c3.ts +5 -2
- package/templates/react/pages/templates/wrangler.jsonc +5 -0
- package/templates/react/workers/c3.ts +1 -1
- 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 +2 -2
- package/templates/react/workers/ts/{api → worker}/index.ts +2 -3
- package/templates/react/workers/ts/wrangler.jsonc +2 -2
- package/templates/react-router/c3.ts +0 -12
- package/templates/remix/pages/c3.ts +2 -0
- package/templates/remix/pages/templates/worker-configuration.d.ts +1 -1
- package/templates/remix/workers/c3.ts +1 -0
- package/templates/remix/workers/templates/wrangler.toml +1 -1
- package/templates/scheduled/ts/src/index.ts +7 -0
- package/templates/scheduled/ts/tsconfig.json +0 -2
- package/templates/solid/c3.ts +1 -0
- package/templates/svelte/pages/c3.ts +4 -3
- package/templates/svelte/workers/c3.ts +3 -3
- package/templates/vue/pages/c3.ts +6 -3
- package/templates/vue/pages/templates/wrangler.jsonc +5 -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/tsconfig.worker.json +1 -1
- package/templates/vue/workers/ts/wrangler.jsonc +0 -1
- package/templates-experimental/solid/c3.ts +1 -1
- package/templates/analog/templates/worker-configuration.d.ts +0 -4
- package/templates/astro/workers/templates/ts/worker-configuration.d.ts +0 -4
- package/templates/common/ts/worker-configuration.d.ts +0 -4
- package/templates/hello-world/ts/worker-configuration.d.ts +0 -8
- package/templates/hello-world-durable-object/ts/worker-configuration.d.ts +0 -7
- package/templates/hello-world-durable-object-with-assets/ts/worker-configuration.d.ts +0 -8
- package/templates/hello-world-with-assets/ts/worker-configuration.d.ts +0 -7
- package/templates/hono/pages/templates/worker-configuration.d.ts +0 -4
- package/templates/hono/workers/templates/worker-configuration.d.ts +0 -4
- package/templates/next/pages/env.d.ts +0 -5
- package/templates/next/workers/templates/cloudflare-env.d.ts +0 -5
- package/templates/nuxt/pages/templates/worker-configuration.d.ts +0 -4
- package/templates/nuxt/workers/templates/worker-configuration.d.ts +0 -4
- package/templates/openapi/ts/worker-configuration.d.ts +0 -4
- package/templates/queues/ts/worker-configuration.d.ts +0 -5
- package/templates/react/workers/ts/worker-configuration.d.ts +0 -5
- package/templates/react-router/templates/worker-configuration.d.ts +0 -8
- package/templates/scheduled/ts/worker-configuration.d.ts +0 -4
- package/templates/vue/workers/ts/worker-configuration.d.ts +0 -6
package/dist/cli.js
CHANGED
|
@@ -3111,8 +3111,8 @@ var require_path_key = __commonJS({
|
|
|
3111
3111
|
"use strict";
|
|
3112
3112
|
var pathKey = (options = {}) => {
|
|
3113
3113
|
const environment = options.env || process.env;
|
|
3114
|
-
const
|
|
3115
|
-
if (
|
|
3114
|
+
const platform = options.platform || process.platform;
|
|
3115
|
+
if (platform !== "win32") {
|
|
3116
3116
|
return "PATH";
|
|
3117
3117
|
}
|
|
3118
3118
|
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
@@ -26411,7 +26411,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
26411
26411
|
}
|
|
26412
26412
|
var origCwd = process.cwd;
|
|
26413
26413
|
var cwd = null;
|
|
26414
|
-
var
|
|
26414
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
26415
26415
|
process.cwd = function() {
|
|
26416
26416
|
if (!cwd)
|
|
26417
26417
|
cwd = origCwd.call(process);
|
|
@@ -26466,7 +26466,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
26466
26466
|
fs4.lchownSync = function() {
|
|
26467
26467
|
};
|
|
26468
26468
|
}
|
|
26469
|
-
if (
|
|
26469
|
+
if (platform === "win32") {
|
|
26470
26470
|
fs4.rename = /* @__PURE__ */ function(fs$rename) {
|
|
26471
26471
|
return function(from, to, cb) {
|
|
26472
26472
|
var start = Date.now();
|
|
@@ -31639,7 +31639,7 @@ var require_open = __commonJS({
|
|
|
31639
31639
|
var isDocker = require_is_docker();
|
|
31640
31640
|
var defineLazyProperty = require_define_lazy_prop();
|
|
31641
31641
|
var localXdgOpenPath = path6.join(__dirname, "xdg-open");
|
|
31642
|
-
var { platform
|
|
31642
|
+
var { platform, arch } = process;
|
|
31643
31643
|
var getWslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
31644
31644
|
const defaultMountPoint = "/mnt/";
|
|
31645
31645
|
let mountPoint;
|
|
@@ -31706,7 +31706,7 @@ var require_open = __commonJS({
|
|
|
31706
31706
|
let command2;
|
|
31707
31707
|
const cliArguments = [];
|
|
31708
31708
|
const childProcessOptions = {};
|
|
31709
|
-
if (
|
|
31709
|
+
if (platform === "darwin") {
|
|
31710
31710
|
command2 = "open";
|
|
31711
31711
|
if (options.wait) {
|
|
31712
31712
|
cliArguments.push("--wait-apps");
|
|
@@ -31720,7 +31720,7 @@ var require_open = __commonJS({
|
|
|
31720
31720
|
if (app) {
|
|
31721
31721
|
cliArguments.push("-a", app);
|
|
31722
31722
|
}
|
|
31723
|
-
} else if (
|
|
31723
|
+
} else if (platform === "win32" || isWsl && !isDocker()) {
|
|
31724
31724
|
const mountPoint = await getWslDrivesMountPoint();
|
|
31725
31725
|
command2 = isWsl ? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe` : `${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
|
|
31726
31726
|
cliArguments.push(
|
|
@@ -31761,7 +31761,7 @@ var require_open = __commonJS({
|
|
|
31761
31761
|
exeLocalXdgOpen = true;
|
|
31762
31762
|
} catch {
|
|
31763
31763
|
}
|
|
31764
|
-
const useSystemXdgOpen = process.versions.electron ||
|
|
31764
|
+
const useSystemXdgOpen = process.versions.electron || platform === "android" || isBundled || !exeLocalXdgOpen;
|
|
31765
31765
|
command2 = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
31766
31766
|
}
|
|
31767
31767
|
if (appArguments.length > 0) {
|
|
@@ -31775,7 +31775,7 @@ var require_open = __commonJS({
|
|
|
31775
31775
|
if (options.target) {
|
|
31776
31776
|
cliArguments.push(options.target);
|
|
31777
31777
|
}
|
|
31778
|
-
if (
|
|
31778
|
+
if (platform === "darwin" && appArguments.length > 0) {
|
|
31779
31779
|
cliArguments.push("--args", ...appArguments);
|
|
31780
31780
|
}
|
|
31781
31781
|
const subprocess = childProcess.spawn(command2, cliArguments, childProcessOptions);
|
|
@@ -31829,12 +31829,12 @@ var require_open = __commonJS({
|
|
|
31829
31829
|
}
|
|
31830
31830
|
return archBinary;
|
|
31831
31831
|
}
|
|
31832
|
-
function detectPlatformBinary({ [
|
|
31832
|
+
function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
|
|
31833
31833
|
if (wsl && isWsl) {
|
|
31834
31834
|
return detectArchBinary(wsl);
|
|
31835
31835
|
}
|
|
31836
31836
|
if (!platformBinary) {
|
|
31837
|
-
throw new Error(`${
|
|
31837
|
+
throw new Error(`${platform} is not supported`);
|
|
31838
31838
|
}
|
|
31839
31839
|
return detectArchBinary(platformBinary);
|
|
31840
31840
|
}
|
|
@@ -74560,7 +74560,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
74560
74560
|
var yargs_default = Yargs;
|
|
74561
74561
|
|
|
74562
74562
|
// package.json
|
|
74563
|
-
var version = "0.0.0-
|
|
74563
|
+
var version = "0.0.0-5695a6746";
|
|
74564
74564
|
|
|
74565
74565
|
// src/metrics.ts
|
|
74566
74566
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -74892,8 +74892,8 @@ function promiseWithResolvers() {
|
|
|
74892
74892
|
return { resolve: resolve12, reject, promise };
|
|
74893
74893
|
}
|
|
74894
74894
|
function getPlatform() {
|
|
74895
|
-
const
|
|
74896
|
-
switch (
|
|
74895
|
+
const platform = process.platform;
|
|
74896
|
+
switch (platform) {
|
|
74897
74897
|
case "win32":
|
|
74898
74898
|
return "Windows";
|
|
74899
74899
|
case "darwin":
|
|
@@ -74901,7 +74901,7 @@ function getPlatform() {
|
|
|
74901
74901
|
case "linux":
|
|
74902
74902
|
return "Linux";
|
|
74903
74903
|
default:
|
|
74904
|
-
return `Others: ${
|
|
74904
|
+
return `Others: ${platform}`;
|
|
74905
74905
|
}
|
|
74906
74906
|
}
|
|
74907
74907
|
function createReporter() {
|
|
@@ -74912,7 +74912,7 @@ function createReporter() {
|
|
|
74912
74912
|
const isEnabled = isTelemetryEnabled();
|
|
74913
74913
|
const deviceId = getDeviceId(config48);
|
|
74914
74914
|
const packageManager = detectPackageManager();
|
|
74915
|
-
const
|
|
74915
|
+
const platform = getPlatform();
|
|
74916
74916
|
const amplitude_session_id = Date.now();
|
|
74917
74917
|
const enableLog = process.env.CREATE_CLOUDFLARE_TELEMETRY_DEBUG === "1";
|
|
74918
74918
|
let amplitude_event_id = 0;
|
|
@@ -74928,7 +74928,7 @@ function createReporter() {
|
|
|
74928
74928
|
properties: {
|
|
74929
74929
|
amplitude_session_id,
|
|
74930
74930
|
amplitude_event_id: amplitude_event_id++,
|
|
74931
|
-
platform
|
|
74931
|
+
platform,
|
|
74932
74932
|
c3Version: version,
|
|
74933
74933
|
isFirstUsage,
|
|
74934
74934
|
packageManager: packageManager.name,
|
|
@@ -75335,21 +75335,21 @@ var package_default = {
|
|
|
75335
75335
|
"so that we can use dependabot to update these dependencies automatically."
|
|
75336
75336
|
],
|
|
75337
75337
|
dependencies: {
|
|
75338
|
-
"create-astro": "4.11.
|
|
75338
|
+
"create-astro": "4.11.4",
|
|
75339
75339
|
"create-analog": "1.8.1",
|
|
75340
|
-
"@angular/create": "19.2.
|
|
75340
|
+
"@angular/create": "19.2.11",
|
|
75341
75341
|
"create-docusaurus": "3.7.0",
|
|
75342
|
-
"create-hono": "0.
|
|
75343
|
-
"create-next-app": "15.2
|
|
75344
|
-
"create-qwik": "1.
|
|
75345
|
-
"create-vite": "6.
|
|
75346
|
-
"create-remix": "2.
|
|
75347
|
-
"create-react-router": "7.
|
|
75342
|
+
"create-hono": "0.18.0",
|
|
75343
|
+
"create-next-app": "15.3.2",
|
|
75344
|
+
"create-qwik": "1.13.0",
|
|
75345
|
+
"create-vite": "6.5.0",
|
|
75346
|
+
"create-remix": "2.16.6",
|
|
75347
|
+
"create-react-router": "7.6.0",
|
|
75348
75348
|
"create-solid": "0.6.2",
|
|
75349
|
-
"create-vue": "3.
|
|
75350
|
-
gatsby: "5.14.
|
|
75351
|
-
sv: "0.
|
|
75352
|
-
nuxi: "3.
|
|
75349
|
+
"create-vue": "3.16.4",
|
|
75350
|
+
gatsby: "5.14.3",
|
|
75351
|
+
sv: "0.8.3",
|
|
75352
|
+
nuxi: "3.25.0"
|
|
75353
75353
|
}
|
|
75354
75354
|
};
|
|
75355
75355
|
|
|
@@ -75483,10 +75483,6 @@ async function getWorkerdCompatibilityDate() {
|
|
|
75483
75483
|
);
|
|
75484
75484
|
return fallbackDate;
|
|
75485
75485
|
}
|
|
75486
|
-
var compatDateFlag = async () => {
|
|
75487
|
-
const workerdCompatDate = await getWorkerdCompatibilityDate();
|
|
75488
|
-
return `--compatibility-date=${workerdCompatDate}`;
|
|
75489
|
-
};
|
|
75490
75486
|
function getLatestTypesEntrypoint(ctx) {
|
|
75491
75487
|
const workersTypesPath = (0, import_path9.resolve)(
|
|
75492
75488
|
ctx.project.path,
|
|
@@ -75569,10 +75565,10 @@ var config = {
|
|
|
75569
75565
|
transformPackageJson: async () => ({
|
|
75570
75566
|
scripts: {
|
|
75571
75567
|
preview: `${npm} run build && npx wrangler dev`,
|
|
75572
|
-
deploy: `${npm} run build && wrangler deploy
|
|
75568
|
+
deploy: `${npm} run build && wrangler deploy`,
|
|
75569
|
+
"cf-typegen": `wrangler types`
|
|
75573
75570
|
}
|
|
75574
75571
|
}),
|
|
75575
|
-
compatibilityFlags: ["nodejs_compat"],
|
|
75576
75572
|
devScript: "dev",
|
|
75577
75573
|
deployScript: "deploy",
|
|
75578
75574
|
previewScript: "preview"
|
|
@@ -75604,21 +75600,6 @@ var configure2 = async (ctx) => {
|
|
|
75604
75600
|
});
|
|
75605
75601
|
}
|
|
75606
75602
|
updateViteConfig(ctx);
|
|
75607
|
-
updateEnvTypes(ctx);
|
|
75608
|
-
};
|
|
75609
|
-
var updateEnvTypes = (ctx) => {
|
|
75610
|
-
const filepath = "env.d.ts";
|
|
75611
|
-
const s = spinner();
|
|
75612
|
-
s.start(`Updating ${filepath}`);
|
|
75613
|
-
let file = readFile(filepath);
|
|
75614
|
-
let typesEntrypoint = `@cloudflare/workers-types`;
|
|
75615
|
-
const latestEntrypoint = getLatestTypesEntrypoint(ctx);
|
|
75616
|
-
if (latestEntrypoint) {
|
|
75617
|
-
typesEntrypoint += `/${latestEntrypoint}`;
|
|
75618
|
-
}
|
|
75619
|
-
file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
|
|
75620
|
-
writeFile2("env.d.ts", file);
|
|
75621
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
75622
75603
|
};
|
|
75623
75604
|
var updateViteConfig = (ctx) => {
|
|
75624
75605
|
const b3 = recast3.types.builders;
|
|
@@ -75750,6 +75731,7 @@ var config3 = {
|
|
|
75750
75731
|
frameworkCli: "@angular/create",
|
|
75751
75732
|
displayName: "Angular",
|
|
75752
75733
|
platform: "pages",
|
|
75734
|
+
hidden: true,
|
|
75753
75735
|
copyFiles: {
|
|
75754
75736
|
path: "./templates"
|
|
75755
75737
|
},
|
|
@@ -75761,10 +75743,11 @@ var config3 = {
|
|
|
75761
75743
|
configure: configure3,
|
|
75762
75744
|
transformPackageJson: async () => ({
|
|
75763
75745
|
scripts: {
|
|
75764
|
-
start: `${npm3} run build && wrangler pages dev
|
|
75746
|
+
start: `${npm3} run build && wrangler pages dev`,
|
|
75765
75747
|
build: `ng build && ${npm3} run process`,
|
|
75766
75748
|
process: "node ./tools/copy-files.mjs",
|
|
75767
|
-
deploy: `${npm3} run build && wrangler pages deploy
|
|
75749
|
+
deploy: `${npm3} run build && wrangler pages deploy`,
|
|
75750
|
+
"cf-typegen": `wrangler types`
|
|
75768
75751
|
}
|
|
75769
75752
|
})
|
|
75770
75753
|
};
|
|
@@ -75850,7 +75833,8 @@ var config4 = {
|
|
|
75850
75833
|
scripts: {
|
|
75851
75834
|
start: `${npm4} run build && wrangler dev`,
|
|
75852
75835
|
build: `ng build`,
|
|
75853
|
-
deploy: `${npm4} run build && wrangler deploy
|
|
75836
|
+
deploy: `${npm4} run build && wrangler deploy`,
|
|
75837
|
+
"cf-typegen": `wrangler types`
|
|
75854
75838
|
}
|
|
75855
75839
|
})
|
|
75856
75840
|
};
|
|
@@ -75909,6 +75893,7 @@ var config6 = {
|
|
|
75909
75893
|
id: "astro",
|
|
75910
75894
|
frameworkCli: "create-astro",
|
|
75911
75895
|
platform: "pages",
|
|
75896
|
+
hidden: true,
|
|
75912
75897
|
displayName: "Astro",
|
|
75913
75898
|
path: "templates/astro/pages",
|
|
75914
75899
|
copyFiles: {
|
|
@@ -76053,6 +76038,7 @@ var config10 = {
|
|
|
76053
76038
|
id: "docusaurus",
|
|
76054
76039
|
frameworkCli: "create-docusaurus",
|
|
76055
76040
|
platform: "pages",
|
|
76041
|
+
hidden: true,
|
|
76056
76042
|
displayName: "Docusaurus",
|
|
76057
76043
|
path: "templates/docusaurus/pages",
|
|
76058
76044
|
generate: generate7,
|
|
@@ -76064,7 +76050,8 @@ var config10 = {
|
|
|
76064
76050
|
}),
|
|
76065
76051
|
devScript: "preview",
|
|
76066
76052
|
deployScript: "deploy",
|
|
76067
|
-
previewScript: "preview"
|
|
76053
|
+
previewScript: "preview",
|
|
76054
|
+
workersTypes: "none"
|
|
76068
76055
|
};
|
|
76069
76056
|
var c3_default10 = config10;
|
|
76070
76057
|
|
|
@@ -76092,7 +76079,8 @@ var config11 = {
|
|
|
76092
76079
|
}),
|
|
76093
76080
|
devScript: "start",
|
|
76094
76081
|
deployScript: "deploy",
|
|
76095
|
-
previewScript: "preview"
|
|
76082
|
+
previewScript: "preview",
|
|
76083
|
+
workersTypes: "none"
|
|
76096
76084
|
};
|
|
76097
76085
|
var c3_default11 = config11;
|
|
76098
76086
|
|
|
@@ -76129,6 +76117,7 @@ var config13 = {
|
|
|
76129
76117
|
id: "gatsby",
|
|
76130
76118
|
frameworkCli: "gatsby",
|
|
76131
76119
|
platform: "pages",
|
|
76120
|
+
hidden: true,
|
|
76132
76121
|
displayName: "Gatsby",
|
|
76133
76122
|
path: "templates/gatsby/pages",
|
|
76134
76123
|
generate: generate9,
|
|
@@ -76140,7 +76129,8 @@ var config13 = {
|
|
|
76140
76129
|
}),
|
|
76141
76130
|
devScript: "develop",
|
|
76142
76131
|
deployScript: "deploy",
|
|
76143
|
-
previewScript: "preview"
|
|
76132
|
+
previewScript: "preview",
|
|
76133
|
+
workersTypes: "none"
|
|
76144
76134
|
};
|
|
76145
76135
|
var c3_default13 = config13;
|
|
76146
76136
|
|
|
@@ -76184,7 +76174,8 @@ var config14 = {
|
|
|
76184
76174
|
}),
|
|
76185
76175
|
devScript: "develop",
|
|
76186
76176
|
deployScript: "deploy",
|
|
76187
|
-
previewScript: "preview"
|
|
76177
|
+
previewScript: "preview",
|
|
76178
|
+
workersTypes: "none"
|
|
76188
76179
|
};
|
|
76189
76180
|
var c3_default14 = config14;
|
|
76190
76181
|
|
|
@@ -76200,8 +76191,8 @@ var config16 = {
|
|
|
76200
76191
|
configVersion: 1,
|
|
76201
76192
|
id: "hello-world-assets-only",
|
|
76202
76193
|
path: "templates/hello-world-assets-only",
|
|
76203
|
-
displayName: "
|
|
76204
|
-
description: "For static sites
|
|
76194
|
+
displayName: "Static site",
|
|
76195
|
+
description: "For static sites or when using your own backend. Uses Workers Static Assets.",
|
|
76205
76196
|
platform: "workers",
|
|
76206
76197
|
copyFiles: {
|
|
76207
76198
|
path: "./templates"
|
|
@@ -76224,6 +76215,9 @@ var config17 = {
|
|
|
76224
76215
|
},
|
|
76225
76216
|
ts: {
|
|
76226
76217
|
path: "./ts"
|
|
76218
|
+
},
|
|
76219
|
+
python: {
|
|
76220
|
+
path: "./py"
|
|
76227
76221
|
}
|
|
76228
76222
|
}
|
|
76229
76223
|
}
|
|
@@ -76244,6 +76238,9 @@ var config18 = {
|
|
|
76244
76238
|
},
|
|
76245
76239
|
ts: {
|
|
76246
76240
|
path: "./ts"
|
|
76241
|
+
},
|
|
76242
|
+
python: {
|
|
76243
|
+
path: "./py"
|
|
76247
76244
|
}
|
|
76248
76245
|
}
|
|
76249
76246
|
}
|
|
@@ -76255,8 +76252,8 @@ var config19 = {
|
|
|
76255
76252
|
configVersion: 1,
|
|
76256
76253
|
id: "hello-world-with-assets",
|
|
76257
76254
|
path: "templates/hello-world-with-assets",
|
|
76258
|
-
displayName: "
|
|
76259
|
-
description: "For
|
|
76255
|
+
displayName: "SSR / full-stack app",
|
|
76256
|
+
description: "For sites with a backend API, or server-side rendering (SSR). Uses Static Assets with a Worker.",
|
|
76260
76257
|
platform: "workers",
|
|
76261
76258
|
copyFiles: {
|
|
76262
76259
|
variants: {
|
|
@@ -76323,6 +76320,7 @@ var generate11 = async (ctx) => {
|
|
|
76323
76320
|
]);
|
|
76324
76321
|
logRaw("");
|
|
76325
76322
|
};
|
|
76323
|
+
var envInterfaceName = "CloudflareBindings";
|
|
76326
76324
|
var config20 = {
|
|
76327
76325
|
configVersion: 1,
|
|
76328
76326
|
id: "hono",
|
|
@@ -76333,16 +76331,18 @@ var config20 = {
|
|
|
76333
76331
|
},
|
|
76334
76332
|
path: "templates/hono/pages",
|
|
76335
76333
|
platform: "pages",
|
|
76334
|
+
hidden: true,
|
|
76336
76335
|
generate: generate11,
|
|
76337
76336
|
transformPackageJson: async () => ({
|
|
76338
76337
|
scripts: {
|
|
76339
|
-
"cf-typegen":
|
|
76338
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName}`,
|
|
76340
76339
|
preview: "vite build && wrangler pages dev"
|
|
76341
76340
|
}
|
|
76342
76341
|
}),
|
|
76343
76342
|
devScript: "dev",
|
|
76344
76343
|
deployScript: "deploy",
|
|
76345
|
-
previewScript: "preview"
|
|
76344
|
+
previewScript: "preview",
|
|
76345
|
+
envInterfaceName
|
|
76346
76346
|
};
|
|
76347
76347
|
var c3_default21 = config20;
|
|
76348
76348
|
|
|
@@ -76359,6 +76359,7 @@ var generate12 = async (ctx) => {
|
|
|
76359
76359
|
]);
|
|
76360
76360
|
logRaw("");
|
|
76361
76361
|
};
|
|
76362
|
+
var envInterfaceName2 = "CloudflareBindings";
|
|
76362
76363
|
var config21 = {
|
|
76363
76364
|
configVersion: 1,
|
|
76364
76365
|
id: "hono",
|
|
@@ -76372,12 +76373,13 @@ var config21 = {
|
|
|
76372
76373
|
generate: generate12,
|
|
76373
76374
|
transformPackageJson: async () => ({
|
|
76374
76375
|
scripts: {
|
|
76375
|
-
"cf-typegen":
|
|
76376
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName2}`
|
|
76376
76377
|
}
|
|
76377
76378
|
}),
|
|
76378
76379
|
devScript: "dev",
|
|
76379
76380
|
deployScript: "deploy",
|
|
76380
|
-
previewScript: "dev"
|
|
76381
|
+
previewScript: "dev",
|
|
76382
|
+
envInterfaceName: envInterfaceName2
|
|
76381
76383
|
};
|
|
76382
76384
|
var c3_default22 = config21;
|
|
76383
76385
|
|
|
@@ -76430,13 +76432,6 @@ var configure7 = async (ctx) => {
|
|
|
76430
76432
|
throw new Error("Could not find the `/api` or `/app` directory");
|
|
76431
76433
|
}
|
|
76432
76434
|
const usesTs = usesTypescript(ctx);
|
|
76433
|
-
if (usesTs) {
|
|
76434
|
-
copyFile(
|
|
76435
|
-
(0, import_path10.join)(getTemplatePath(ctx), "env.d.ts"),
|
|
76436
|
-
(0, import_path10.join)(projectPath, "env.d.ts")
|
|
76437
|
-
);
|
|
76438
|
-
updateStatus("Created an env.d.ts file");
|
|
76439
|
-
}
|
|
76440
76435
|
const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
|
|
76441
76436
|
if (installEslintPlugin) {
|
|
76442
76437
|
await writeEslintrc(ctx);
|
|
@@ -76481,7 +76476,6 @@ var writeEslintrc = async (ctx) => {
|
|
|
76481
76476
|
var addDevDependencies = async (installEslintPlugin) => {
|
|
76482
76477
|
const packages = [
|
|
76483
76478
|
"@cloudflare/next-on-pages@1",
|
|
76484
|
-
"@cloudflare/workers-types",
|
|
76485
76479
|
"vercel",
|
|
76486
76480
|
...installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []
|
|
76487
76481
|
];
|
|
@@ -76491,11 +76485,14 @@ var addDevDependencies = async (installEslintPlugin) => {
|
|
|
76491
76485
|
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
76492
76486
|
});
|
|
76493
76487
|
};
|
|
76488
|
+
var envInterfaceName3 = "CloudflareEnv";
|
|
76489
|
+
var typesPath = "./env.d.ts";
|
|
76494
76490
|
var c3_default24 = {
|
|
76495
76491
|
configVersion: 1,
|
|
76496
76492
|
id: "next",
|
|
76497
76493
|
frameworkCli: "create-next-app",
|
|
76498
76494
|
platform: "pages",
|
|
76495
|
+
hidden: true,
|
|
76499
76496
|
displayName: "Next.js",
|
|
76500
76497
|
path: "templates/next/pages",
|
|
76501
76498
|
generate: generate13,
|
|
@@ -76543,7 +76540,7 @@ var c3_default24 = {
|
|
|
76543
76540
|
preview: `${pagesBuildRunCommand} && wrangler pages dev`,
|
|
76544
76541
|
deploy: `${pagesBuildRunCommand} && wrangler pages deploy`,
|
|
76545
76542
|
...usesTypescript(ctx) && {
|
|
76546
|
-
"cf-typegen": `wrangler types --env-interface
|
|
76543
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${typesPath}`
|
|
76547
76544
|
}
|
|
76548
76545
|
}
|
|
76549
76546
|
};
|
|
@@ -76551,7 +76548,9 @@ var c3_default24 = {
|
|
|
76551
76548
|
devScript: "dev",
|
|
76552
76549
|
previewScript: "preview",
|
|
76553
76550
|
deployScript: "deploy",
|
|
76554
|
-
compatibilityFlags: ["nodejs_compat"]
|
|
76551
|
+
compatibilityFlags: ["nodejs_compat"],
|
|
76552
|
+
typesPath,
|
|
76553
|
+
envInterfaceName: envInterfaceName3
|
|
76555
76554
|
};
|
|
76556
76555
|
|
|
76557
76556
|
// templates/next/workers/c3.ts
|
|
@@ -76559,14 +76558,9 @@ var generate14 = async (ctx) => {
|
|
|
76559
76558
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
76560
76559
|
};
|
|
76561
76560
|
var configure8 = async (ctx) => {
|
|
76562
|
-
|
|
76563
|
-
"@opennextjs/cloudflare@0.5.x",
|
|
76564
|
-
"@cloudflare/workers-types"
|
|
76565
|
-
];
|
|
76566
|
-
await installPackages(packages, {
|
|
76567
|
-
dev: true,
|
|
76561
|
+
await installPackages(["@opennextjs/cloudflare@^1.0.2"], {
|
|
76568
76562
|
startText: "Adding the Cloudflare adapter",
|
|
76569
|
-
doneText: `${brandColor(`installed`)}
|
|
76563
|
+
doneText: `${brandColor(`installed`)} @opennextjs/cloudflare)}`
|
|
76570
76564
|
});
|
|
76571
76565
|
const usesTs = usesTypescript(ctx);
|
|
76572
76566
|
updateNextConfig2(usesTs);
|
|
@@ -76584,13 +76578,14 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
76584
76578
|
writeFile2(configFile, updatedConfigFile);
|
|
76585
76579
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76586
76580
|
};
|
|
76581
|
+
var envInterfaceName4 = "CloudflareBindings";
|
|
76582
|
+
var typesPath2 = "./cloudflare-env.d.ts";
|
|
76587
76583
|
var c3_default25 = {
|
|
76588
76584
|
configVersion: 1,
|
|
76589
76585
|
id: "next",
|
|
76590
76586
|
frameworkCli: "create-next-app",
|
|
76591
|
-
frameworkCliPinnedVersion: "~15.2.2",
|
|
76592
76587
|
platform: "workers",
|
|
76593
|
-
displayName: "Next.js
|
|
76588
|
+
displayName: "Next.js",
|
|
76594
76589
|
path: "templates/next/workers",
|
|
76595
76590
|
copyFiles: {
|
|
76596
76591
|
path: "./templates"
|
|
@@ -76599,15 +76594,16 @@ var c3_default25 = {
|
|
|
76599
76594
|
configure: configure8,
|
|
76600
76595
|
transformPackageJson: async () => ({
|
|
76601
76596
|
scripts: {
|
|
76602
|
-
deploy: `opennextjs-cloudflare &&
|
|
76603
|
-
preview: `opennextjs-cloudflare &&
|
|
76604
|
-
"cf-typegen": `wrangler types --env-interface
|
|
76597
|
+
deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
|
|
76598
|
+
preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
|
|
76599
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName4} ${typesPath2}`
|
|
76605
76600
|
}
|
|
76606
76601
|
}),
|
|
76607
76602
|
devScript: "dev",
|
|
76608
76603
|
previewScript: "preview",
|
|
76609
76604
|
deployScript: "deploy",
|
|
76610
|
-
|
|
76605
|
+
typesPath: typesPath2,
|
|
76606
|
+
envInterfaceName: envInterfaceName4
|
|
76611
76607
|
};
|
|
76612
76608
|
|
|
76613
76609
|
// templates/next/c3.ts
|
|
@@ -76633,7 +76629,7 @@ var generate15 = async (ctx) => {
|
|
|
76633
76629
|
writeFile2("./.node-version", "18");
|
|
76634
76630
|
logRaw("");
|
|
76635
76631
|
};
|
|
76636
|
-
var configure9 = async (
|
|
76632
|
+
var configure9 = async () => {
|
|
76637
76633
|
const packages = ["nitro-cloudflare-dev"];
|
|
76638
76634
|
if (pm2 === "pnpm") {
|
|
76639
76635
|
packages.push("h3");
|
|
@@ -76644,21 +76640,6 @@ var configure9 = async (ctx) => {
|
|
|
76644
76640
|
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
76645
76641
|
});
|
|
76646
76642
|
updateNuxtConfig();
|
|
76647
|
-
updateEnvTypes2(ctx);
|
|
76648
|
-
};
|
|
76649
|
-
var updateEnvTypes2 = (ctx) => {
|
|
76650
|
-
const filepath = "env.d.ts";
|
|
76651
|
-
const s = spinner();
|
|
76652
|
-
s.start(`Updating ${filepath}`);
|
|
76653
|
-
let file = readFile(filepath);
|
|
76654
|
-
let typesEntrypoint = `@cloudflare/workers-types`;
|
|
76655
|
-
const latestEntrypoint = getLatestTypesEntrypoint(ctx);
|
|
76656
|
-
if (latestEntrypoint) {
|
|
76657
|
-
typesEntrypoint += `/${latestEntrypoint}`;
|
|
76658
|
-
}
|
|
76659
|
-
file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
|
|
76660
|
-
writeFile2("env.d.ts", file);
|
|
76661
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
76662
76643
|
};
|
|
76663
76644
|
var updateNuxtConfig = () => {
|
|
76664
76645
|
const s = spinner();
|
|
@@ -76707,6 +76688,7 @@ var config24 = {
|
|
|
76707
76688
|
id: "nuxt",
|
|
76708
76689
|
frameworkCli: "nuxi",
|
|
76709
76690
|
platform: "pages",
|
|
76691
|
+
hidden: true,
|
|
76710
76692
|
displayName: "Nuxt",
|
|
76711
76693
|
copyFiles: {
|
|
76712
76694
|
path: "./templates"
|
|
@@ -76743,7 +76725,7 @@ var generate16 = async (ctx) => {
|
|
|
76743
76725
|
writeFile2("./.node-version", "18");
|
|
76744
76726
|
logRaw("");
|
|
76745
76727
|
};
|
|
76746
|
-
var configure10 = async (
|
|
76728
|
+
var configure10 = async () => {
|
|
76747
76729
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
76748
76730
|
if (pm3 === "pnpm") {
|
|
76749
76731
|
packages.push("h3");
|
|
@@ -76754,21 +76736,6 @@ var configure10 = async (ctx) => {
|
|
|
76754
76736
|
doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
|
|
76755
76737
|
});
|
|
76756
76738
|
updateNuxtConfig2();
|
|
76757
|
-
updateEnvTypes3(ctx);
|
|
76758
|
-
};
|
|
76759
|
-
var updateEnvTypes3 = (ctx) => {
|
|
76760
|
-
const filepath = "env.d.ts";
|
|
76761
|
-
const s = spinner();
|
|
76762
|
-
s.start(`Updating ${filepath}`);
|
|
76763
|
-
let file = readFile(filepath);
|
|
76764
|
-
let typesEntrypoint = `@cloudflare/workers-types`;
|
|
76765
|
-
const latestEntrypoint = getLatestTypesEntrypoint(ctx);
|
|
76766
|
-
if (latestEntrypoint) {
|
|
76767
|
-
typesEntrypoint += `/${latestEntrypoint}`;
|
|
76768
|
-
}
|
|
76769
|
-
file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
|
|
76770
|
-
writeFile2("env.d.ts", file);
|
|
76771
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
76772
76739
|
};
|
|
76773
76740
|
var updateNuxtConfig2 = () => {
|
|
76774
76741
|
const s = spinner();
|
|
@@ -76977,7 +76944,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
76977
76944
|
await runCommand(
|
|
76978
76945
|
[
|
|
76979
76946
|
...dlx,
|
|
76980
|
-
"wrangler@
|
|
76947
|
+
"wrangler@latest",
|
|
76981
76948
|
"init",
|
|
76982
76949
|
"--from-dash",
|
|
76983
76950
|
ctx.args.existingScript,
|
|
@@ -77153,6 +77120,7 @@ var config30 = {
|
|
|
77153
77120
|
frameworkCli: "create-qwik",
|
|
77154
77121
|
displayName: "Qwik",
|
|
77155
77122
|
platform: "pages",
|
|
77123
|
+
hidden: true,
|
|
77156
77124
|
copyFiles: {
|
|
77157
77125
|
path: "./templates"
|
|
77158
77126
|
},
|
|
@@ -77168,7 +77136,8 @@ var config30 = {
|
|
|
77168
77136
|
}),
|
|
77169
77137
|
devScript: "dev",
|
|
77170
77138
|
deployScript: "deploy",
|
|
77171
|
-
previewScript: "preview"
|
|
77139
|
+
previewScript: "preview",
|
|
77140
|
+
workersTypes: "installed"
|
|
77172
77141
|
};
|
|
77173
77142
|
var c3_default33 = config30;
|
|
77174
77143
|
|
|
@@ -77182,8 +77151,6 @@ var configure12 = async (ctx) => {
|
|
|
77182
77151
|
const cmd = [name2 === "pnpm" ? npm13 : npx5, "qwik", "add", "cloudflare-pages"];
|
|
77183
77152
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77184
77153
|
await runCommand(cmd);
|
|
77185
|
-
removeFile("./public/_headers");
|
|
77186
|
-
removeFile("./public/_redirects");
|
|
77187
77154
|
removeFile("./public/_routes.json");
|
|
77188
77155
|
addBindingsProxy2(ctx);
|
|
77189
77156
|
populateCloudflareEnv2();
|
|
@@ -77223,7 +77190,7 @@ var addBindingsProxy2 = (ctx) => {
|
|
|
77223
77190
|
return false;
|
|
77224
77191
|
}
|
|
77225
77192
|
if (configArgument.type !== "ObjectExpression") {
|
|
77226
|
-
|
|
77193
|
+
throw new Error("Failed to update `vite.config.ts`");
|
|
77227
77194
|
}
|
|
77228
77195
|
configArgument.properties.push(platformPropery);
|
|
77229
77196
|
return false;
|
|
@@ -77279,7 +77246,8 @@ var config31 = {
|
|
|
77279
77246
|
}),
|
|
77280
77247
|
devScript: "dev",
|
|
77281
77248
|
deployScript: "deploy",
|
|
77282
|
-
previewScript: "preview"
|
|
77249
|
+
previewScript: "preview",
|
|
77250
|
+
workersTypes: "installed"
|
|
77283
77251
|
};
|
|
77284
77252
|
var c3_default34 = config31;
|
|
77285
77253
|
|
|
@@ -77309,9 +77277,6 @@ var config33 = {
|
|
|
77309
77277
|
platform: "workers",
|
|
77310
77278
|
frameworkCli: "create-react-router",
|
|
77311
77279
|
displayName: "React Router (formerly Remix)",
|
|
77312
|
-
copyFiles: {
|
|
77313
|
-
path: "./templates"
|
|
77314
|
-
},
|
|
77315
77280
|
generate: generate19,
|
|
77316
77281
|
// configure,
|
|
77317
77282
|
transformPackageJson: async () => ({
|
|
@@ -77365,12 +77330,15 @@ var config34 = {
|
|
|
77365
77330
|
frameworkCli: "create-vite",
|
|
77366
77331
|
displayName: "React",
|
|
77367
77332
|
platform: "pages",
|
|
77333
|
+
hidden: true,
|
|
77368
77334
|
path: "templates/react/pages",
|
|
77335
|
+
copyFiles: { path: "./templates" },
|
|
77369
77336
|
generate: generate20,
|
|
77370
77337
|
transformPackageJson: async () => ({
|
|
77371
77338
|
scripts: {
|
|
77372
|
-
deploy: `${npm15} run build && wrangler pages deploy
|
|
77373
|
-
preview: `${npm15} run build && wrangler pages dev
|
|
77339
|
+
deploy: `${npm15} run build && wrangler pages deploy`,
|
|
77340
|
+
preview: `${npm15} run build && wrangler pages dev`,
|
|
77341
|
+
"cf-typegen": `wrangler types`
|
|
77374
77342
|
}
|
|
77375
77343
|
}),
|
|
77376
77344
|
devScript: "dev",
|
|
@@ -77401,7 +77369,7 @@ var configure13 = async (ctx) => {
|
|
|
77401
77369
|
startText: "Installing the Cloudflare Vite plugin",
|
|
77402
77370
|
doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
|
|
77403
77371
|
});
|
|
77404
|
-
|
|
77372
|
+
transformViteConfig(ctx);
|
|
77405
77373
|
if (usesTypescript(ctx)) {
|
|
77406
77374
|
updateTsconfigJson();
|
|
77407
77375
|
}
|
|
@@ -77554,6 +77522,7 @@ var config37 = {
|
|
|
77554
77522
|
id: "remix",
|
|
77555
77523
|
frameworkCli: "create-remix",
|
|
77556
77524
|
platform: "pages",
|
|
77525
|
+
hidden: true,
|
|
77557
77526
|
displayName: "Remix",
|
|
77558
77527
|
copyFiles: {
|
|
77559
77528
|
path: "./templates"
|
|
@@ -77570,7 +77539,8 @@ var config37 = {
|
|
|
77570
77539
|
}),
|
|
77571
77540
|
devScript: "dev",
|
|
77572
77541
|
deployScript: "deploy",
|
|
77573
|
-
previewScript: "preview"
|
|
77542
|
+
previewScript: "preview",
|
|
77543
|
+
workersTypes: "installed"
|
|
77574
77544
|
};
|
|
77575
77545
|
var c3_default40 = config37;
|
|
77576
77546
|
|
|
@@ -77612,7 +77582,8 @@ var config38 = {
|
|
|
77612
77582
|
}),
|
|
77613
77583
|
devScript: "dev",
|
|
77614
77584
|
deployScript: "deploy",
|
|
77615
|
-
previewScript: "preview"
|
|
77585
|
+
previewScript: "preview",
|
|
77586
|
+
workersTypes: "installed"
|
|
77616
77587
|
};
|
|
77617
77588
|
var c3_default41 = config38;
|
|
77618
77589
|
|
|
@@ -77703,7 +77674,8 @@ var config41 = {
|
|
|
77703
77674
|
transformPackageJson: async () => ({
|
|
77704
77675
|
scripts: {
|
|
77705
77676
|
preview: `${npm19} run build && npx wrangler pages dev`,
|
|
77706
|
-
deploy: `${npm19} run build && wrangler pages deploy
|
|
77677
|
+
deploy: `${npm19} run build && wrangler pages deploy`,
|
|
77678
|
+
"cf-typegen": `wrangler types`
|
|
77707
77679
|
}
|
|
77708
77680
|
}),
|
|
77709
77681
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -77715,7 +77687,6 @@ var c3_default44 = config41;
|
|
|
77715
77687
|
|
|
77716
77688
|
// templates/svelte/pages/c3.ts
|
|
77717
77689
|
var import_node_fs3 = require("node:fs");
|
|
77718
|
-
var import_node_os3 = require("node:os");
|
|
77719
77690
|
var recast12 = __toESM(require_main3());
|
|
77720
77691
|
var { npm: npm20 } = detectPackageManager();
|
|
77721
77692
|
var generate25 = async (ctx) => {
|
|
@@ -77804,12 +77775,14 @@ var updateTypeDefinitions = (ctx) => {
|
|
|
77804
77775
|
}
|
|
77805
77776
|
});
|
|
77806
77777
|
};
|
|
77778
|
+
var typesPath3 = "src/worker-configuration.d.ts";
|
|
77807
77779
|
var config42 = {
|
|
77808
77780
|
configVersion: 1,
|
|
77809
77781
|
id: "svelte",
|
|
77810
77782
|
frameworkCli: "sv",
|
|
77811
77783
|
displayName: "SvelteKit",
|
|
77812
77784
|
platform: "pages",
|
|
77785
|
+
hidden: true,
|
|
77813
77786
|
copyFiles: {
|
|
77814
77787
|
path: "./templates"
|
|
77815
77788
|
},
|
|
@@ -77822,22 +77795,21 @@ var config42 = {
|
|
|
77822
77795
|
deploy: `${npm20} run build && wrangler pages deploy`
|
|
77823
77796
|
};
|
|
77824
77797
|
if (usesTypescript(ctx)) {
|
|
77825
|
-
const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
|
|
77826
77798
|
scripts = {
|
|
77827
77799
|
...scripts,
|
|
77828
|
-
"cf-typegen": `wrangler types
|
|
77800
|
+
"cf-typegen": `wrangler types ${typesPath3}`
|
|
77829
77801
|
};
|
|
77830
77802
|
}
|
|
77831
77803
|
return { scripts };
|
|
77832
77804
|
},
|
|
77833
77805
|
devScript: "dev",
|
|
77834
77806
|
deployScript: "deploy",
|
|
77835
|
-
previewScript: "preview"
|
|
77807
|
+
previewScript: "preview",
|
|
77808
|
+
typesPath: typesPath3
|
|
77836
77809
|
};
|
|
77837
77810
|
var c3_default45 = config42;
|
|
77838
77811
|
|
|
77839
77812
|
// templates/svelte/workers/c3.ts
|
|
77840
|
-
var import_node_os4 = require("node:os");
|
|
77841
77813
|
var recast13 = __toESM(require_main3());
|
|
77842
77814
|
var { npm: npm21 } = detectPackageManager();
|
|
77843
77815
|
var generate26 = async (ctx) => {
|
|
@@ -77903,6 +77875,7 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
77903
77875
|
}
|
|
77904
77876
|
});
|
|
77905
77877
|
};
|
|
77878
|
+
var typesPath4 = "./src/worker-configuration.d.ts";
|
|
77906
77879
|
var config43 = {
|
|
77907
77880
|
configVersion: 1,
|
|
77908
77881
|
id: "svelte",
|
|
@@ -77921,17 +77894,17 @@ var config43 = {
|
|
|
77921
77894
|
deploy: `${npm21} run build && wrangler deploy`
|
|
77922
77895
|
};
|
|
77923
77896
|
if (usesTypescript(ctx)) {
|
|
77924
|
-
const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
|
|
77925
77897
|
scripts = {
|
|
77926
77898
|
...scripts,
|
|
77927
|
-
"cf-typegen": `wrangler types
|
|
77899
|
+
"cf-typegen": `wrangler types ${typesPath4}`
|
|
77928
77900
|
};
|
|
77929
77901
|
}
|
|
77930
77902
|
return { scripts };
|
|
77931
77903
|
},
|
|
77932
77904
|
devScript: "dev",
|
|
77933
77905
|
deployScript: "deploy",
|
|
77934
|
-
previewScript: "preview"
|
|
77906
|
+
previewScript: "preview",
|
|
77907
|
+
typesPath: typesPath4
|
|
77935
77908
|
};
|
|
77936
77909
|
var c3_default46 = config43;
|
|
77937
77910
|
|
|
@@ -77953,12 +77926,15 @@ var config45 = {
|
|
|
77953
77926
|
frameworkCli: "create-vue",
|
|
77954
77927
|
displayName: "Vue",
|
|
77955
77928
|
platform: "pages",
|
|
77956
|
-
|
|
77929
|
+
hidden: true,
|
|
77930
|
+
path: "templates/vue/pages",
|
|
77931
|
+
copyFiles: { path: "./templates" },
|
|
77957
77932
|
generate: generate27,
|
|
77958
77933
|
transformPackageJson: async () => ({
|
|
77959
77934
|
scripts: {
|
|
77960
|
-
deploy: `${npm22} run build && wrangler pages deploy
|
|
77961
|
-
preview: `${npm22} run build && wrangler pages dev
|
|
77935
|
+
deploy: `${npm22} run build && wrangler pages deploy`,
|
|
77936
|
+
preview: `${npm22} run build && wrangler pages dev`,
|
|
77937
|
+
"cf-typegen": `wrangler types`
|
|
77962
77938
|
}
|
|
77963
77939
|
}),
|
|
77964
77940
|
devScript: "dev",
|
|
@@ -78053,7 +78029,7 @@ var c3_default50 = config47;
|
|
|
78053
78029
|
var import_node_assert = __toESM(require("node:assert"));
|
|
78054
78030
|
|
|
78055
78031
|
// ../wrangler/package.json
|
|
78056
|
-
var version2 = "0.0.0-
|
|
78032
|
+
var version2 = "0.0.0-5695a6746";
|
|
78057
78033
|
|
|
78058
78034
|
// src/git.ts
|
|
78059
78035
|
var offerGit = async (ctx) => {
|
|
@@ -78429,10 +78405,10 @@ var createContext = async (args, prevArgs) => {
|
|
|
78429
78405
|
deriveCorrelatedArgs(args);
|
|
78430
78406
|
const experimental = args.experimental;
|
|
78431
78407
|
const frameworkMap = getFrameworkMap({ experimental });
|
|
78432
|
-
const helloWorldTemplateMap =
|
|
78408
|
+
const helloWorldTemplateMap = getHelloWorldTemplateMap({
|
|
78433
78409
|
experimental
|
|
78434
78410
|
});
|
|
78435
|
-
const otherTemplateMap =
|
|
78411
|
+
const otherTemplateMap = getOtherTemplateMap({ experimental });
|
|
78436
78412
|
let linesPrinted = 0;
|
|
78437
78413
|
const goBack = async (from) => {
|
|
78438
78414
|
const currentArgs = { ...args };
|
|
@@ -78552,30 +78528,40 @@ var createContext = async (args, prevArgs) => {
|
|
|
78552
78528
|
throw new Error(`Unsupported framework: ${framework}`);
|
|
78553
78529
|
}
|
|
78554
78530
|
if ("platformVariants" in frameworkConfig) {
|
|
78555
|
-
const
|
|
78531
|
+
const availableVariants = Object.entries(
|
|
78532
|
+
frameworkConfig.platformVariants
|
|
78533
|
+
).filter(([, config48]) => !config48.hidden);
|
|
78534
|
+
if (availableVariants.length === 1) {
|
|
78535
|
+
args.platform ??= availableVariants[0][0];
|
|
78536
|
+
}
|
|
78537
|
+
const platform = await processArgument(args, "platform", {
|
|
78556
78538
|
type: "select",
|
|
78557
78539
|
label: "platform",
|
|
78558
78540
|
question: "Select your deployment platform",
|
|
78559
78541
|
options: [
|
|
78560
|
-
|
|
78561
|
-
|
|
78562
|
-
|
|
78563
|
-
|
|
78564
|
-
|
|
78565
|
-
|
|
78566
|
-
|
|
78567
|
-
|
|
78568
|
-
|
|
78569
|
-
|
|
78542
|
+
...args.platform === "workers" || !frameworkConfig.platformVariants.workers.hidden ? [
|
|
78543
|
+
{
|
|
78544
|
+
label: "Workers with Assets",
|
|
78545
|
+
value: "workers",
|
|
78546
|
+
description: "Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more."
|
|
78547
|
+
}
|
|
78548
|
+
] : [],
|
|
78549
|
+
...args.platform === "pages" || !frameworkConfig.platformVariants.pages.hidden ? [
|
|
78550
|
+
{
|
|
78551
|
+
label: "Pages",
|
|
78552
|
+
value: "pages",
|
|
78553
|
+
description: "Great for simple websites and applications."
|
|
78554
|
+
}
|
|
78555
|
+
] : [],
|
|
78570
78556
|
backOption
|
|
78571
78557
|
],
|
|
78572
78558
|
defaultValue: "workers"
|
|
78573
78559
|
});
|
|
78574
78560
|
linesPrinted += 3;
|
|
78575
|
-
if (
|
|
78561
|
+
if (platform === BACK_VALUE) {
|
|
78576
78562
|
return goBack("platform");
|
|
78577
78563
|
}
|
|
78578
|
-
frameworkConfig = frameworkConfig.platformVariants[
|
|
78564
|
+
frameworkConfig = frameworkConfig.platformVariants[platform];
|
|
78579
78565
|
}
|
|
78580
78566
|
template = {
|
|
78581
78567
|
deployScript: "pages:deploy",
|
|
@@ -78612,6 +78598,12 @@ var createContext = async (args, prevArgs) => {
|
|
|
78612
78598
|
throw new Error(`Unknown application type provided: ${type}.`);
|
|
78613
78599
|
}
|
|
78614
78600
|
}
|
|
78601
|
+
template = {
|
|
78602
|
+
workersTypes: "generated",
|
|
78603
|
+
typesPath: "worker-configuration.d.ts",
|
|
78604
|
+
envInterfaceName: "Env",
|
|
78605
|
+
...template
|
|
78606
|
+
};
|
|
78615
78607
|
const path6 = (0, import_path13.resolve)(projectName);
|
|
78616
78608
|
const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
|
|
78617
78609
|
if (languageVariants.length > 0) {
|
|
@@ -78671,7 +78663,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
78671
78663
|
}
|
|
78672
78664
|
srcdir = (0, import_path13.join)(getTemplatePath(ctx), variantInfo.path);
|
|
78673
78665
|
}
|
|
78674
|
-
const copyDestDir =
|
|
78666
|
+
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
78675
78667
|
const destdir = (0, import_path13.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
78676
78668
|
const s = spinner();
|
|
78677
78669
|
s.start(`Copying template files`);
|
|
@@ -78694,7 +78686,7 @@ var processRemoteTemplate = async (args) => {
|
|
|
78694
78686
|
if (src.startsWith("https://github.com/") && src.includes("/tree/main/")) {
|
|
78695
78687
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
78696
78688
|
}
|
|
78697
|
-
const path6 = await downloadRemoteTemplate(src);
|
|
78689
|
+
const path6 = await downloadRemoteTemplate(src, args.templateMode);
|
|
78698
78690
|
const config48 = inferTemplateConfig(path6);
|
|
78699
78691
|
validateTemplate(path6, config48);
|
|
78700
78692
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
@@ -78753,13 +78745,14 @@ var inferCopyFilesDefinition = (path6) => {
|
|
|
78753
78745
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
78754
78746
|
return copyFiles;
|
|
78755
78747
|
};
|
|
78756
|
-
var downloadRemoteTemplate = async (src) => {
|
|
78748
|
+
var downloadRemoteTemplate = async (src, mode) => {
|
|
78757
78749
|
try {
|
|
78758
78750
|
updateStatus(`Cloning template from: ${blue(src)}`);
|
|
78759
78751
|
const emitter = (0, import_degit.default)(src, {
|
|
78760
78752
|
cache: false,
|
|
78761
78753
|
verbose: false,
|
|
78762
|
-
force: true
|
|
78754
|
+
force: true,
|
|
78755
|
+
mode
|
|
78763
78756
|
});
|
|
78764
78757
|
const tmpDir = await (0, import_promises4.mkdtemp)((0, import_path13.join)((0, import_os2.tmpdir)(), "c3-template"));
|
|
78765
78758
|
await emitter.clone(tmpDir);
|
|
@@ -78947,12 +78940,12 @@ var cliDefinition = {
|
|
|
78947
78940
|
description: `Whether the application should be deployed to Pages or Workers. This is only applicable for Frameworks templates that support both Pages and Workers.`,
|
|
78948
78941
|
values: [
|
|
78949
78942
|
{
|
|
78950
|
-
name: "
|
|
78951
|
-
description: "Create a web application that can be deployed to
|
|
78943
|
+
name: "workers",
|
|
78944
|
+
description: "Create a web application that can be deployed to Workers."
|
|
78952
78945
|
},
|
|
78953
78946
|
{
|
|
78954
|
-
name: "
|
|
78955
|
-
description: "Create a web application that can be deployed to
|
|
78947
|
+
name: "pages",
|
|
78948
|
+
description: "Create a web application that can be deployed to Pages."
|
|
78956
78949
|
}
|
|
78957
78950
|
],
|
|
78958
78951
|
requiresArg: true
|
|
@@ -79014,6 +79007,27 @@ var cliDefinition = {
|
|
|
79014
79007
|
npm create cloudflare -- --template https://github.com/cloudflare/workers-sdk/templates/worker-r2
|
|
79015
79008
|
`
|
|
79016
79009
|
},
|
|
79010
|
+
{
|
|
79011
|
+
name: "template-mode",
|
|
79012
|
+
type: "string",
|
|
79013
|
+
requiresArg: true,
|
|
79014
|
+
description: `The mechanism to use when fetching the template.
|
|
79015
|
+
|
|
79016
|
+
Can be either "git" or "tar". "tar" does not support fetching from private
|
|
79017
|
+
repositories. By default, degit will use "tar" if the template is hosted on GitHub, BitBucket, GitLab, or git.sr.ht.
|
|
79018
|
+
Otherwise, it will use "git".
|
|
79019
|
+
`,
|
|
79020
|
+
values: [
|
|
79021
|
+
{
|
|
79022
|
+
name: "git",
|
|
79023
|
+
description: "Use git to fetch the template. Supports private repositories."
|
|
79024
|
+
},
|
|
79025
|
+
{
|
|
79026
|
+
name: "tar",
|
|
79027
|
+
description: "Use tar to fetch the template. Only supported on public repositories hosted on GitHub, BitBucket, GitLab, or git.sr.ht."
|
|
79028
|
+
}
|
|
79029
|
+
]
|
|
79030
|
+
},
|
|
79017
79031
|
{
|
|
79018
79032
|
name: "accept-defaults",
|
|
79019
79033
|
alias: "y",
|
|
@@ -79178,7 +79192,7 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
79178
79192
|
|
|
79179
79193
|
// src/deploy.ts
|
|
79180
79194
|
var import_promises5 = require("node:fs/promises");
|
|
79181
|
-
var
|
|
79195
|
+
var import_node_os3 = require("node:os");
|
|
79182
79196
|
var import_node_path6 = require("node:path");
|
|
79183
79197
|
var import_toml3 = __toESM(require_toml());
|
|
79184
79198
|
|
|
@@ -80845,7 +80859,7 @@ var runDeploy = async (ctx) => {
|
|
|
80845
80859
|
] : []
|
|
80846
80860
|
];
|
|
80847
80861
|
const outputFile = (0, import_node_path6.join)(
|
|
80848
|
-
await (0, import_promises5.mkdtemp)((0, import_node_path6.join)((0,
|
|
80862
|
+
await (0, import_promises5.mkdtemp)((0, import_node_path6.join)((0, import_node_os3.tmpdir)(), "c3-wrangler-deploy-")),
|
|
80849
80863
|
"output.json"
|
|
80850
80864
|
);
|
|
80851
80865
|
await runCommand(deployCmd, {
|
|
@@ -81425,48 +81439,107 @@ var createProject = async (ctx) => {
|
|
|
81425
81439
|
// src/workers.ts
|
|
81426
81440
|
var import_fs13 = require("fs");
|
|
81427
81441
|
var import_path16 = require("path");
|
|
81428
|
-
|
|
81442
|
+
var import_toml4 = __toESM(require_toml());
|
|
81443
|
+
async function addTypes(ctx) {
|
|
81444
|
+
if (!usesTypescript(ctx) || ctx.template.workersTypes === "none") {
|
|
81445
|
+
return;
|
|
81446
|
+
}
|
|
81429
81447
|
const { npm: npm25 } = detectPackageManager();
|
|
81430
|
-
if (
|
|
81448
|
+
if (ctx.template.workersTypes === "installed") {
|
|
81449
|
+
await installWorkersTypes(npm25);
|
|
81450
|
+
} else if (ctx.template.workersTypes === "generated") {
|
|
81451
|
+
await generateWorkersTypes(ctx, npm25);
|
|
81452
|
+
}
|
|
81453
|
+
const usesNodeCompat = await maybeInstallNodeTypes(ctx, npm25);
|
|
81454
|
+
await updateTsConfig(ctx, { usesNodeCompat });
|
|
81455
|
+
}
|
|
81456
|
+
async function generateWorkersTypes(ctx, npm25) {
|
|
81457
|
+
const packageJsonPath = (0, import_path16.join)(ctx.project.path, "package.json");
|
|
81458
|
+
if (!(0, import_fs13.existsSync)(packageJsonPath)) {
|
|
81431
81459
|
return;
|
|
81432
81460
|
}
|
|
81433
|
-
|
|
81434
|
-
|
|
81435
|
-
|
|
81436
|
-
|
|
81461
|
+
const packageManifest = readJSON(packageJsonPath);
|
|
81462
|
+
if (!packageManifest.scripts?.["cf-typegen"]) {
|
|
81463
|
+
return;
|
|
81464
|
+
}
|
|
81465
|
+
const typesCmd = [npm25, "run", "cf-typegen"];
|
|
81466
|
+
await runCommand(typesCmd, {
|
|
81467
|
+
cwd: ctx.project.path,
|
|
81468
|
+
silent: true,
|
|
81469
|
+
startText: "Generating types for your application",
|
|
81470
|
+
doneText: `${brandColor("generated")} ${dim(`to \`${ctx.template.typesPath}\` via \`${typesCmd.join(" ")}\``)}`
|
|
81437
81471
|
});
|
|
81438
|
-
|
|
81472
|
+
if (packageManifest["devDependencies"]?.["@cloudflare/workers-types"]) {
|
|
81473
|
+
delete packageManifest["devDependencies"]?.["@cloudflare/workers-types"];
|
|
81474
|
+
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
81475
|
+
}
|
|
81439
81476
|
}
|
|
81440
|
-
async
|
|
81477
|
+
var maybeInstallNodeTypes = async (ctx, npm25) => {
|
|
81478
|
+
let parsedConfig = {};
|
|
81479
|
+
if (wranglerJsonExists(ctx)) {
|
|
81480
|
+
const wranglerJsonStr = readWranglerJson(ctx);
|
|
81481
|
+
parsedConfig = parse4(wranglerJsonStr, void 0, {
|
|
81482
|
+
allowTrailingComma: true
|
|
81483
|
+
});
|
|
81484
|
+
} else if (wranglerTomlExists(ctx)) {
|
|
81485
|
+
const wranglerTomlStr = readWranglerToml(ctx);
|
|
81486
|
+
parsedConfig = import_toml4.default.parse(wranglerTomlStr);
|
|
81487
|
+
}
|
|
81488
|
+
const compatibilityFlags = Array.isArray(parsedConfig["compatibility_flags"]) ? parsedConfig["compatibility_flags"] : [];
|
|
81489
|
+
if (compatibilityFlags.includes("nodejs_compat") || compatibilityFlags.includes("nodejs_compat_v2")) {
|
|
81490
|
+
await installPackages(["@types/node"], {
|
|
81491
|
+
dev: true,
|
|
81492
|
+
startText: "Installing @types/node",
|
|
81493
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
81494
|
+
});
|
|
81495
|
+
return true;
|
|
81496
|
+
}
|
|
81497
|
+
return false;
|
|
81498
|
+
};
|
|
81499
|
+
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
81441
81500
|
const tsconfigPath = (0, import_path16.join)(ctx.project.path, "tsconfig.json");
|
|
81442
81501
|
if (!(0, import_fs13.existsSync)(tsconfigPath)) {
|
|
81443
81502
|
return;
|
|
81444
81503
|
}
|
|
81445
|
-
const s = spinner();
|
|
81446
|
-
s.start("Adding latest types to `tsconfig.json`");
|
|
81447
81504
|
const tsconfig = readFile(tsconfigPath);
|
|
81448
|
-
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
81449
|
-
if (entrypointVersion === null) {
|
|
81450
|
-
s.stop(
|
|
81451
|
-
`${brandColor(
|
|
81452
|
-
"skipped"
|
|
81453
|
-
)} couldn't find latest compatible version of @cloudflare/workers-types`
|
|
81454
|
-
);
|
|
81455
|
-
return;
|
|
81456
|
-
}
|
|
81457
|
-
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81458
81505
|
try {
|
|
81459
81506
|
const config48 = parse4(tsconfig);
|
|
81460
81507
|
const currentTypes = config48.compilerOptions?.types ?? [];
|
|
81461
|
-
|
|
81462
|
-
|
|
81463
|
-
|
|
81464
|
-
|
|
81465
|
-
|
|
81466
|
-
|
|
81467
|
-
|
|
81468
|
-
|
|
81469
|
-
|
|
81508
|
+
let newTypes = [...currentTypes];
|
|
81509
|
+
if (ctx.template.workersTypes === "installed") {
|
|
81510
|
+
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
81511
|
+
if (entrypointVersion === null) {
|
|
81512
|
+
return;
|
|
81513
|
+
}
|
|
81514
|
+
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81515
|
+
const explicitEntrypoint = currentTypes.some(
|
|
81516
|
+
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81517
|
+
);
|
|
81518
|
+
if (!explicitEntrypoint) {
|
|
81519
|
+
newTypes = newTypes.filter(
|
|
81520
|
+
(t2) => t2 !== "@cloudflare/workers-types"
|
|
81521
|
+
);
|
|
81522
|
+
newTypes.push(typesEntrypoint);
|
|
81523
|
+
}
|
|
81524
|
+
} else if (ctx.template.workersTypes === "generated") {
|
|
81525
|
+
newTypes.push(ctx.template.typesPath ?? "./worker-configuration.d.ts");
|
|
81526
|
+
const typegen = readFile(
|
|
81527
|
+
ctx.template.typesPath ?? "./worker-configuration.d.ts"
|
|
81528
|
+
).split("\n");
|
|
81529
|
+
if (typegen.some(
|
|
81530
|
+
(line) => line.includes("// Runtime types generated with workerd")
|
|
81531
|
+
)) {
|
|
81532
|
+
newTypes = newTypes.filter(
|
|
81533
|
+
(t2) => !t2.startsWith("@cloudflare/workers-types")
|
|
81534
|
+
);
|
|
81535
|
+
}
|
|
81536
|
+
}
|
|
81537
|
+
if (usesNodeCompat) {
|
|
81538
|
+
newTypes.push("node");
|
|
81539
|
+
}
|
|
81540
|
+
if (newTypes.sort() === currentTypes.sort()) {
|
|
81541
|
+
return;
|
|
81542
|
+
}
|
|
81470
81543
|
const useSpaces = !tsconfig.match(/\t/g);
|
|
81471
81544
|
const edits = modify(
|
|
81472
81545
|
tsconfig,
|
|
@@ -81479,11 +81552,15 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81479
81552
|
const updated = applyEdits(tsconfig, edits);
|
|
81480
81553
|
writeFile2(tsconfigPath, updated);
|
|
81481
81554
|
} catch (error2) {
|
|
81482
|
-
warn(
|
|
81483
|
-
"Failed to update `tsconfig.json` with latest `@cloudflare/workers-types` entrypoint."
|
|
81484
|
-
);
|
|
81555
|
+
warn("Failed to update `tsconfig.json`.");
|
|
81485
81556
|
}
|
|
81486
|
-
|
|
81557
|
+
}
|
|
81558
|
+
async function installWorkersTypes(npm25) {
|
|
81559
|
+
await installPackages(["@cloudflare/workers-types"], {
|
|
81560
|
+
dev: true,
|
|
81561
|
+
startText: "Installing @cloudflare/workers-types",
|
|
81562
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
81563
|
+
});
|
|
81487
81564
|
}
|
|
81488
81565
|
|
|
81489
81566
|
// src/cli.ts
|
|
@@ -81563,7 +81640,6 @@ var create = async (ctx) => {
|
|
|
81563
81640
|
var configure20 = async (ctx) => {
|
|
81564
81641
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
81565
81642
|
await installWrangler();
|
|
81566
|
-
await installWorkersTypes(ctx);
|
|
81567
81643
|
await updateWranglerConfig(ctx);
|
|
81568
81644
|
const { template } = ctx;
|
|
81569
81645
|
if (template.configure) {
|
|
@@ -81571,6 +81647,7 @@ var configure20 = async (ctx) => {
|
|
|
81571
81647
|
}
|
|
81572
81648
|
addWranglerToGitIgnore(ctx);
|
|
81573
81649
|
await updatePackageScripts(ctx);
|
|
81650
|
+
await addTypes(ctx);
|
|
81574
81651
|
await offerGit(ctx);
|
|
81575
81652
|
await gitCommit(ctx);
|
|
81576
81653
|
endSection(`Application configured`);
|
|
@@ -81621,26 +81698,8 @@ repeat-string/index.js:
|
|
|
81621
81698
|
*)
|
|
81622
81699
|
|
|
81623
81700
|
yargs-parser/build/lib/string-utils.js:
|
|
81624
|
-
(**
|
|
81625
|
-
* @license
|
|
81626
|
-
* Copyright (c) 2016, Contributors
|
|
81627
|
-
* SPDX-License-Identifier: ISC
|
|
81628
|
-
*)
|
|
81629
|
-
|
|
81630
81701
|
yargs-parser/build/lib/tokenize-arg-string.js:
|
|
81631
|
-
(**
|
|
81632
|
-
* @license
|
|
81633
|
-
* Copyright (c) 2016, Contributors
|
|
81634
|
-
* SPDX-License-Identifier: ISC
|
|
81635
|
-
*)
|
|
81636
|
-
|
|
81637
81702
|
yargs-parser/build/lib/yargs-parser-types.js:
|
|
81638
|
-
(**
|
|
81639
|
-
* @license
|
|
81640
|
-
* Copyright (c) 2016, Contributors
|
|
81641
|
-
* SPDX-License-Identifier: ISC
|
|
81642
|
-
*)
|
|
81643
|
-
|
|
81644
81703
|
yargs-parser/build/lib/yargs-parser.js:
|
|
81645
81704
|
(**
|
|
81646
81705
|
* @license
|