create-cloudflare 0.0.0-a2afcf13f → 0.0.0-a2cb6decc
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 +153 -127
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/templates/angular/c3.ts +25 -13
- package/templates/angular/templates/src/server.ts +15 -0
- package/templates/angular/templates/tools/copy-files.mjs +8 -2
- package/templates/astro/templates/wrangler.toml +1 -0
- package/templates/hello-world/js/package.json +1 -1
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/hello-world/ts/test/tsconfig.json +1 -1
- package/templates/svelte/c3.ts +33 -3
- package/templates-experimental/angular/c3.ts +21 -7
- package/templates-experimental/angular/templates/src/server.ts +15 -0
- package/templates-experimental/hello-world-with-assets/js/package.json +1 -1
- package/templates-experimental/hello-world-with-assets/ts/package.json +1 -1
- package/templates-experimental/nuxt/c3.ts +1 -1
- package/templates-experimental/nuxt/templates/wrangler.toml +2 -2
- package/templates-experimental/remix/c3.ts +1 -26
- package/templates-experimental/remix/templates/public/.assetsignore +0 -4
- package/templates-experimental/remix/templates/wrangler.toml +1 -1
- package/templates-experimental/solid/c3.ts +7 -50
- package/templates-experimental/solid/templates/wrangler.toml +2 -2
- package/templates-experimental/svelte/c3.ts +3 -3
- package/templates/angular/templates/server.ts +0 -34
- package/templates/angular/templates/tools/alter-polyfills.mjs +0 -27
- package/templates/angular/templates/tools/paths.mjs +0 -9
- package/templates-experimental/angular/templates/server.ts +0 -34
- package/templates-experimental/angular/templates/tools/alter-polyfills.mjs +0 -32
- package/templates-experimental/nuxt/templates/cloudflare-preset/nitro.config.ts +0 -27
package/dist/cli.js
CHANGED
|
@@ -24815,8 +24815,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
24815
24815
|
var pathReservations = () => {
|
|
24816
24816
|
const queues = /* @__PURE__ */ new Map();
|
|
24817
24817
|
const reservations = /* @__PURE__ */ new Map();
|
|
24818
|
-
const { join:
|
|
24819
|
-
const getDirs = (path7) =>
|
|
24818
|
+
const { join: join8 } = path__default["default"];
|
|
24819
|
+
const getDirs = (path7) => join8(path7).split(/[\\/]/).slice(0, -1).reduce((set, path8) => set.length ? set.concat(join8(set[set.length - 1], path8)) : [path8], []);
|
|
24820
24820
|
const running = /* @__PURE__ */ new Set();
|
|
24821
24821
|
const getQueues = (fn) => {
|
|
24822
24822
|
const res = reservations.get(fn);
|
|
@@ -38609,7 +38609,7 @@ var require_util8 = __commonJS({
|
|
|
38609
38609
|
return path6;
|
|
38610
38610
|
}
|
|
38611
38611
|
exports2.normalize = normalize2;
|
|
38612
|
-
function
|
|
38612
|
+
function join8(aRoot, aPath) {
|
|
38613
38613
|
if (aRoot === "") {
|
|
38614
38614
|
aRoot = ".";
|
|
38615
38615
|
}
|
|
@@ -38641,7 +38641,7 @@ var require_util8 = __commonJS({
|
|
|
38641
38641
|
}
|
|
38642
38642
|
return joined;
|
|
38643
38643
|
}
|
|
38644
|
-
exports2.join =
|
|
38644
|
+
exports2.join = join8;
|
|
38645
38645
|
exports2.isAbsolute = function(aPath) {
|
|
38646
38646
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
38647
38647
|
};
|
|
@@ -38814,7 +38814,7 @@ var require_util8 = __commonJS({
|
|
|
38814
38814
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
38815
38815
|
}
|
|
38816
38816
|
}
|
|
38817
|
-
sourceURL =
|
|
38817
|
+
sourceURL = join8(urlGenerate(parsed), sourceURL);
|
|
38818
38818
|
}
|
|
38819
38819
|
return normalize2(sourceURL);
|
|
38820
38820
|
}
|
|
@@ -67118,7 +67118,7 @@ var logRaw = (msg) => {
|
|
|
67118
67118
|
`);
|
|
67119
67119
|
};
|
|
67120
67120
|
var log = (msg) => {
|
|
67121
|
-
const lines = msg.split("\n").map((ln) => `${gray(shapes.bar)}
|
|
67121
|
+
const lines = msg.split("\n").map((ln) => `${gray(shapes.bar)}${ln.length > 0 ? " " + white(ln) : ""}`);
|
|
67122
67122
|
logRaw(lines.join("\n"));
|
|
67123
67123
|
};
|
|
67124
67124
|
var newline = () => {
|
|
@@ -68447,7 +68447,12 @@ var inputPrompt = async (promptConfig) => {
|
|
|
68447
68447
|
};
|
|
68448
68448
|
let prompt;
|
|
68449
68449
|
const dispatchRender = (props, p2) => {
|
|
68450
|
-
|
|
68450
|
+
let state = props.state;
|
|
68451
|
+
if (state === "initial" && promptConfig.initialErrorMessage) {
|
|
68452
|
+
state = "error";
|
|
68453
|
+
props.error = promptConfig.initialErrorMessage;
|
|
68454
|
+
}
|
|
68455
|
+
const renderedLines = renderers[state](props, p2);
|
|
68451
68456
|
return renderedLines.join("\n");
|
|
68452
68457
|
};
|
|
68453
68458
|
if (promptConfig.type === "select") {
|
|
@@ -68813,7 +68818,10 @@ var spinner = (frames = spinnerFrames.clockwise, color = brandColor) => {
|
|
|
68813
68818
|
start(msg, helpText) {
|
|
68814
68819
|
helpText ||= ``;
|
|
68815
68820
|
currentMsg = msg;
|
|
68816
|
-
startMsg =
|
|
68821
|
+
startMsg = currentMsg;
|
|
68822
|
+
if (helpText !== void 0 && helpText.length > 0) {
|
|
68823
|
+
startMsg += ` ${dim(helpText)}`;
|
|
68824
|
+
}
|
|
68817
68825
|
if (isInteractive()) {
|
|
68818
68826
|
let index = 0;
|
|
68819
68827
|
clearLoop();
|
|
@@ -68826,7 +68834,7 @@ var spinner = (frames = spinnerFrames.clockwise, color = brandColor) => {
|
|
|
68826
68834
|
}
|
|
68827
68835
|
}, frameRate);
|
|
68828
68836
|
} else {
|
|
68829
|
-
|
|
68837
|
+
logRaw(`${leftT} ${startMsg}`);
|
|
68830
68838
|
}
|
|
68831
68839
|
},
|
|
68832
68840
|
update(msg) {
|
|
@@ -68844,17 +68852,20 @@ ${grayBar} ${msg}`);
|
|
|
68844
68852
|
clearLoop();
|
|
68845
68853
|
} else {
|
|
68846
68854
|
if (msg !== void 0) {
|
|
68847
|
-
|
|
68848
|
-
${grayBar} ${msg}`);
|
|
68855
|
+
logRaw(`${grayBar} ${msg}`);
|
|
68849
68856
|
}
|
|
68850
68857
|
newline();
|
|
68851
68858
|
}
|
|
68852
68859
|
}
|
|
68853
68860
|
};
|
|
68854
68861
|
};
|
|
68855
|
-
|
|
68856
|
-
|
|
68857
|
-
|
|
68862
|
+
function isInteractive() {
|
|
68863
|
+
try {
|
|
68864
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
68865
|
+
} catch {
|
|
68866
|
+
return false;
|
|
68867
|
+
}
|
|
68868
|
+
}
|
|
68858
68869
|
|
|
68859
68870
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs
|
|
68860
68871
|
var import_assert = require("assert");
|
|
@@ -73714,7 +73725,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
73714
73725
|
var yargs_default = Yargs;
|
|
73715
73726
|
|
|
73716
73727
|
// package.json
|
|
73717
|
-
var version = "0.0.0-
|
|
73728
|
+
var version = "0.0.0-a2cb6decc";
|
|
73718
73729
|
|
|
73719
73730
|
// src/metrics.ts
|
|
73720
73731
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -73806,6 +73817,13 @@ var runCommand = async (command2, opts = {}) => {
|
|
|
73806
73817
|
doneText: opts.doneText,
|
|
73807
73818
|
promise() {
|
|
73808
73819
|
const [executable, ...args] = command2;
|
|
73820
|
+
if (args[0] === "wrangler") {
|
|
73821
|
+
const metrics = readMetricsConfig();
|
|
73822
|
+
if (metrics.c3permission?.enabled === false) {
|
|
73823
|
+
opts.env ??= {};
|
|
73824
|
+
opts.env["WRANGLER_SEND_METRICS"] = "false";
|
|
73825
|
+
}
|
|
73826
|
+
}
|
|
73809
73827
|
const abortController = new AbortController();
|
|
73810
73828
|
const cmd = (0, import_cross_spawn.spawn)(executable, [...args], {
|
|
73811
73829
|
// TODO: ideally inherit stderr, but npm install uses this for warnings
|
|
@@ -73994,7 +74012,7 @@ var detectPmMismatch = (ctx) => {
|
|
|
73994
74012
|
case "pnpm":
|
|
73995
74013
|
return !(0, import_fs5.existsSync)(import_path5.default.join(projectPath, "pnpm-lock.yaml"));
|
|
73996
74014
|
case "bun":
|
|
73997
|
-
return !(0, import_fs5.existsSync)(import_path5.default.join(projectPath, "bun.lockb"));
|
|
74015
|
+
return !(0, import_fs5.existsSync)(import_path5.default.join(projectPath, "bun.lockb")) && !(0, import_fs5.existsSync)(import_path5.default.join(projectPath, "bun.lock"));
|
|
73998
74016
|
}
|
|
73999
74017
|
};
|
|
74000
74018
|
|
|
@@ -74469,20 +74487,20 @@ var package_default = {
|
|
|
74469
74487
|
"so that we can use dependabot to update these dependencies automatically."
|
|
74470
74488
|
],
|
|
74471
74489
|
dependencies: {
|
|
74472
|
-
"create-astro": "4.
|
|
74490
|
+
"create-astro": "4.10.0",
|
|
74473
74491
|
"create-analog": "1.8.1",
|
|
74474
|
-
"@angular/create": "
|
|
74475
|
-
"create-docusaurus": "3.
|
|
74492
|
+
"@angular/create": "19.0.0",
|
|
74493
|
+
"create-docusaurus": "3.6.1",
|
|
74476
74494
|
"create-hono": "0.14.2",
|
|
74477
74495
|
"create-next-app": "14.2.5",
|
|
74478
|
-
"create-qwik": "1.
|
|
74479
|
-
"create-vite": "5.5.
|
|
74480
|
-
"create-remix": "2.
|
|
74496
|
+
"create-qwik": "1.11.0",
|
|
74497
|
+
"create-vite": "5.5.5",
|
|
74498
|
+
"create-remix": "2.14.0",
|
|
74481
74499
|
"create-solid": "0.5.13",
|
|
74482
|
-
"create-
|
|
74483
|
-
|
|
74484
|
-
|
|
74485
|
-
|
|
74500
|
+
"create-vue": "3.12.1",
|
|
74501
|
+
gatsby: "5.14.0",
|
|
74502
|
+
nuxi: "3.15.0",
|
|
74503
|
+
sv: "0.6.1"
|
|
74486
74504
|
}
|
|
74487
74505
|
};
|
|
74488
74506
|
|
|
@@ -74515,7 +74533,11 @@ var runFrameworkGenerator = async (ctx, args) => {
|
|
|
74515
74533
|
// templates-experimental/angular/c3.ts
|
|
74516
74534
|
var { npm } = detectPackageManager();
|
|
74517
74535
|
var generate = async (ctx) => {
|
|
74518
|
-
await runFrameworkGenerator(ctx, [
|
|
74536
|
+
await runFrameworkGenerator(ctx, [
|
|
74537
|
+
ctx.project.name,
|
|
74538
|
+
"--ssr",
|
|
74539
|
+
"--server-routing"
|
|
74540
|
+
]);
|
|
74519
74541
|
logRaw("");
|
|
74520
74542
|
};
|
|
74521
74543
|
var configure = async (ctx) => {
|
|
@@ -74524,9 +74546,9 @@ var configure = async (ctx) => {
|
|
|
74524
74546
|
await installCFWorker();
|
|
74525
74547
|
};
|
|
74526
74548
|
async function installCFWorker() {
|
|
74527
|
-
await installPackages(["
|
|
74549
|
+
await installPackages(["xhr2"], {
|
|
74528
74550
|
dev: true,
|
|
74529
|
-
startText: "Installing
|
|
74551
|
+
startText: "Installing additional dependencies",
|
|
74530
74552
|
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
|
|
74531
74553
|
});
|
|
74532
74554
|
}
|
|
@@ -74541,10 +74563,17 @@ async function updateAppCode() {
|
|
|
74541
74563
|
);
|
|
74542
74564
|
writeFile2((0, import_node_path3.resolve)(appConfigPath), newAppConfig);
|
|
74543
74565
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
74566
|
+
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
74567
|
+
const appRoutes = readFile((0, import_node_path3.resolve)(appServerRoutesPath));
|
|
74568
|
+
const newAppRoutes = appRoutes.replace(
|
|
74569
|
+
"RenderMode.Prerender",
|
|
74570
|
+
"RenderMode.Server"
|
|
74571
|
+
);
|
|
74572
|
+
writeFile2((0, import_node_path3.resolve)(appServerRoutesPath), newAppRoutes);
|
|
74573
|
+
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
74544
74574
|
s.start(`Updating package.json`);
|
|
74545
74575
|
const packageJsonPath = (0, import_node_path3.resolve)("package.json");
|
|
74546
74576
|
const packageManifest = readJSON(packageJsonPath);
|
|
74547
|
-
delete packageManifest["dependencies"]["@angular/ssr"];
|
|
74548
74577
|
delete packageManifest["dependencies"]["express"];
|
|
74549
74578
|
delete packageManifest["devDependencies"]["@types/express"];
|
|
74550
74579
|
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
@@ -74556,7 +74585,8 @@ function updateAngularJson(ctx) {
|
|
|
74556
74585
|
const angularJson = readJSON((0, import_node_path3.resolve)("angular.json"));
|
|
74557
74586
|
const architectSection = angularJson.projects[ctx.project.name].architect;
|
|
74558
74587
|
architectSection.build.options.outputPath = "dist";
|
|
74559
|
-
architectSection.build.options.
|
|
74588
|
+
architectSection.build.options.outputMode = "server";
|
|
74589
|
+
architectSection.build.options.ssr.experimentalPlatform = "neutral";
|
|
74560
74590
|
writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
74561
74591
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
74562
74592
|
}
|
|
@@ -74572,13 +74602,13 @@ var config = {
|
|
|
74572
74602
|
path: "templates-experimental/angular",
|
|
74573
74603
|
devScript: "start",
|
|
74574
74604
|
deployScript: "deploy",
|
|
74605
|
+
previewScript: "start",
|
|
74575
74606
|
generate,
|
|
74576
74607
|
configure,
|
|
74577
74608
|
transformPackageJson: async () => ({
|
|
74578
74609
|
scripts: {
|
|
74579
74610
|
start: `${npm} run build && wrangler dev`,
|
|
74580
|
-
build: `ng build
|
|
74581
|
-
process: "node ./tools/alter-polyfills.mjs",
|
|
74611
|
+
build: `ng build`,
|
|
74582
74612
|
deploy: `${npm} run build && wrangler deploy`
|
|
74583
74613
|
}
|
|
74584
74614
|
})
|
|
@@ -75058,7 +75088,7 @@ var updateNuxtConfig = () => {
|
|
|
75058
75088
|
b2.objectExpression([
|
|
75059
75089
|
b2.objectProperty(
|
|
75060
75090
|
b2.identifier("preset"),
|
|
75061
|
-
b2.stringLiteral("
|
|
75091
|
+
b2.stringLiteral("cloudflare_module")
|
|
75062
75092
|
)
|
|
75063
75093
|
])
|
|
75064
75094
|
);
|
|
@@ -75222,7 +75252,7 @@ var generate9 = async (ctx) => {
|
|
|
75222
75252
|
await runFrameworkGenerator(ctx, [
|
|
75223
75253
|
ctx.project.name,
|
|
75224
75254
|
"--template",
|
|
75225
|
-
"https://github.com/remix-run/remix/tree/main/templates/cloudflare"
|
|
75255
|
+
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
|
|
75226
75256
|
]);
|
|
75227
75257
|
logRaw("");
|
|
75228
75258
|
};
|
|
@@ -75232,19 +75262,6 @@ var configure6 = async () => {
|
|
|
75232
75262
|
startText: "Updating the Wrangler version",
|
|
75233
75263
|
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
75234
75264
|
});
|
|
75235
|
-
const typeDefsPath = "load-context.ts";
|
|
75236
|
-
const s = spinner();
|
|
75237
|
-
s.start(`Updating \`${typeDefsPath}\``);
|
|
75238
|
-
transformFile(typeDefsPath, {
|
|
75239
|
-
visitTSInterfaceDeclaration(n2) {
|
|
75240
|
-
if (n2.node.id.type === "Identifier" && n2.node.id.name !== "Env") {
|
|
75241
|
-
return this.traverse(n2);
|
|
75242
|
-
}
|
|
75243
|
-
n2.replace();
|
|
75244
|
-
return false;
|
|
75245
|
-
}
|
|
75246
|
-
});
|
|
75247
|
-
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
75248
75265
|
};
|
|
75249
75266
|
var config10 = {
|
|
75250
75267
|
configVersion: 1,
|
|
@@ -75260,7 +75277,6 @@ var config10 = {
|
|
|
75260
75277
|
configure: configure6,
|
|
75261
75278
|
transformPackageJson: async () => ({
|
|
75262
75279
|
scripts: {
|
|
75263
|
-
build: "remix vite:build && wrangler pages functions build --outdir build/worker",
|
|
75264
75280
|
deploy: `${npm6} run build && wrangler deploy`,
|
|
75265
75281
|
preview: `${npm6} run build && wrangler dev`,
|
|
75266
75282
|
"cf-typegen": `wrangler types`
|
|
@@ -75288,6 +75304,7 @@ var configure7 = async (ctx) => {
|
|
|
75288
75304
|
});
|
|
75289
75305
|
usesTypescript(ctx);
|
|
75290
75306
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
75307
|
+
const compatDate = await getWorkerdCompatibilityDate();
|
|
75291
75308
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
75292
75309
|
transformFile(filePath, {
|
|
75293
75310
|
visitCallExpression: function(n2) {
|
|
@@ -75302,60 +75319,14 @@ var configure7 = async (ctx) => {
|
|
|
75302
75319
|
b2.objectProperty(
|
|
75303
75320
|
b2.identifier("server"),
|
|
75304
75321
|
b2.objectExpression([
|
|
75305
|
-
// preset: "
|
|
75322
|
+
// preset: "cloudflare_module"
|
|
75306
75323
|
b2.objectProperty(
|
|
75307
75324
|
b2.identifier("preset"),
|
|
75308
|
-
b2.stringLiteral("
|
|
75309
|
-
),
|
|
75310
|
-
// output: {
|
|
75311
|
-
// dir: "{{ rootDir }}/dist",
|
|
75312
|
-
// publicDir: "{{ output.dir }}/public",
|
|
75313
|
-
// serverDir: "{{ output.dir }}/worker",
|
|
75314
|
-
// },
|
|
75315
|
-
b2.objectProperty(
|
|
75316
|
-
b2.identifier("output"),
|
|
75317
|
-
b2.objectExpression([
|
|
75318
|
-
b2.objectProperty(
|
|
75319
|
-
b2.identifier("dir"),
|
|
75320
|
-
b2.stringLiteral("{{ rootDir }}/dist")
|
|
75321
|
-
),
|
|
75322
|
-
b2.objectProperty(
|
|
75323
|
-
b2.identifier("publicDir"),
|
|
75324
|
-
b2.stringLiteral("{{ output.dir }}/public")
|
|
75325
|
-
),
|
|
75326
|
-
b2.objectProperty(
|
|
75327
|
-
b2.identifier("serverDir"),
|
|
75328
|
-
b2.stringLiteral("{{ output.dir }}/worker")
|
|
75329
|
-
)
|
|
75330
|
-
])
|
|
75331
|
-
),
|
|
75332
|
-
// rollupConfig: {
|
|
75333
|
-
// external: ["node:async_hooks"],
|
|
75334
|
-
// },
|
|
75335
|
-
b2.objectProperty(
|
|
75336
|
-
b2.identifier("rollupConfig"),
|
|
75337
|
-
b2.objectExpression([
|
|
75338
|
-
b2.objectProperty(
|
|
75339
|
-
b2.identifier("external"),
|
|
75340
|
-
b2.arrayExpression([b2.stringLiteral("node:async_hooks")])
|
|
75341
|
-
)
|
|
75342
|
-
])
|
|
75325
|
+
b2.stringLiteral("cloudflare_module")
|
|
75343
75326
|
),
|
|
75344
|
-
// hooks: {
|
|
75345
|
-
// // Prevent the Pages preset from writing the _routes.json etc.
|
|
75346
|
-
// compiled() {},
|
|
75347
|
-
// },
|
|
75348
75327
|
b2.objectProperty(
|
|
75349
|
-
b2.identifier("
|
|
75350
|
-
b2.
|
|
75351
|
-
b2.objectMethod(
|
|
75352
|
-
"method",
|
|
75353
|
-
b2.identifier("compiled"),
|
|
75354
|
-
[],
|
|
75355
|
-
b2.blockStatement([]),
|
|
75356
|
-
false
|
|
75357
|
-
)
|
|
75358
|
-
])
|
|
75328
|
+
b2.identifier("compatibilityDate"),
|
|
75329
|
+
b2.stringLiteral(compatDate)
|
|
75359
75330
|
)
|
|
75360
75331
|
])
|
|
75361
75332
|
)
|
|
@@ -75395,7 +75366,7 @@ var import_node_os3 = require("node:os");
|
|
|
75395
75366
|
var recast6 = __toESM(require_main3());
|
|
75396
75367
|
var { npm: npm8 } = detectPackageManager();
|
|
75397
75368
|
var generate11 = async (ctx) => {
|
|
75398
|
-
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
75369
|
+
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
75399
75370
|
logRaw("");
|
|
75400
75371
|
};
|
|
75401
75372
|
var configure8 = async (ctx) => {
|
|
@@ -75460,8 +75431,8 @@ var updateTypeDefinitions = (ctx) => {
|
|
|
75460
75431
|
var config12 = {
|
|
75461
75432
|
configVersion: 1,
|
|
75462
75433
|
id: "svelte",
|
|
75463
|
-
frameworkCli: "
|
|
75464
|
-
displayName: "
|
|
75434
|
+
frameworkCli: "sv",
|
|
75435
|
+
displayName: "SvelteKit",
|
|
75465
75436
|
platform: "workers",
|
|
75466
75437
|
copyFiles: {
|
|
75467
75438
|
variants: {
|
|
@@ -75599,7 +75570,11 @@ var c3_default15 = config13;
|
|
|
75599
75570
|
var import_node_path4 = require("node:path");
|
|
75600
75571
|
var { npm: npm10 } = detectPackageManager();
|
|
75601
75572
|
var generate13 = async (ctx) => {
|
|
75602
|
-
await runFrameworkGenerator(ctx, [
|
|
75573
|
+
await runFrameworkGenerator(ctx, [
|
|
75574
|
+
ctx.project.name,
|
|
75575
|
+
"--ssr",
|
|
75576
|
+
"--server-routing"
|
|
75577
|
+
]);
|
|
75603
75578
|
logRaw("");
|
|
75604
75579
|
};
|
|
75605
75580
|
var configure10 = async (ctx) => {
|
|
@@ -75608,14 +75583,11 @@ var configure10 = async (ctx) => {
|
|
|
75608
75583
|
await installCFWorker2();
|
|
75609
75584
|
};
|
|
75610
75585
|
async function installCFWorker2() {
|
|
75611
|
-
await installPackages(
|
|
75612
|
-
|
|
75613
|
-
|
|
75614
|
-
|
|
75615
|
-
|
|
75616
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
75617
|
-
}
|
|
75618
|
-
);
|
|
75586
|
+
await installPackages(["xhr2"], {
|
|
75587
|
+
dev: true,
|
|
75588
|
+
startText: "Installing additional dependencies",
|
|
75589
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
75590
|
+
});
|
|
75619
75591
|
}
|
|
75620
75592
|
async function updateAppCode2() {
|
|
75621
75593
|
const s = spinner();
|
|
@@ -75628,10 +75600,17 @@ async function updateAppCode2() {
|
|
|
75628
75600
|
);
|
|
75629
75601
|
writeFile2((0, import_node_path4.resolve)(appConfigPath), newAppConfig);
|
|
75630
75602
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
75603
|
+
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
75604
|
+
const appRoutes = readFile((0, import_node_path4.resolve)(appServerRoutesPath));
|
|
75605
|
+
const newAppRoutes = appRoutes.replace(
|
|
75606
|
+
"RenderMode.Prerender",
|
|
75607
|
+
"RenderMode.Server"
|
|
75608
|
+
);
|
|
75609
|
+
writeFile2((0, import_node_path4.resolve)(appServerRoutesPath), newAppRoutes);
|
|
75610
|
+
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
75631
75611
|
s.start(`Updating package.json`);
|
|
75632
75612
|
const packageJsonPath = (0, import_node_path4.resolve)("package.json");
|
|
75633
75613
|
const packageManifest = readJSON(packageJsonPath);
|
|
75634
|
-
delete packageManifest["dependencies"]["@angular/ssr"];
|
|
75635
75614
|
delete packageManifest["dependencies"]["express"];
|
|
75636
75615
|
delete packageManifest["devDependencies"]["@types/express"];
|
|
75637
75616
|
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
@@ -75643,6 +75622,8 @@ function updateAngularJson2(ctx) {
|
|
|
75643
75622
|
const angularJson = readJSON((0, import_node_path4.resolve)("angular.json"));
|
|
75644
75623
|
const architectSection = angularJson.projects[ctx.project.name].architect;
|
|
75645
75624
|
architectSection.build.options.outputPath = "dist";
|
|
75625
|
+
architectSection.build.options.outputMode = "server";
|
|
75626
|
+
architectSection.build.options.ssr.experimentalPlatform = "neutral";
|
|
75646
75627
|
architectSection.build.options.assets.push("src/_routes.json");
|
|
75647
75628
|
writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
75648
75629
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
@@ -75658,13 +75639,14 @@ var config14 = {
|
|
|
75658
75639
|
},
|
|
75659
75640
|
devScript: "start",
|
|
75660
75641
|
deployScript: "deploy",
|
|
75642
|
+
previewScript: "start",
|
|
75661
75643
|
generate: generate13,
|
|
75662
75644
|
configure: configure10,
|
|
75663
75645
|
transformPackageJson: async () => ({
|
|
75664
75646
|
scripts: {
|
|
75665
|
-
start: `${npm10} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}
|
|
75647
|
+
start: `${npm10} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
|
|
75666
75648
|
build: `ng build && ${npm10} run process`,
|
|
75667
|
-
process: "node ./tools/copy-files.mjs
|
|
75649
|
+
process: "node ./tools/copy-files.mjs",
|
|
75668
75650
|
deploy: `${npm10} run build && wrangler pages deploy dist/cloudflare`
|
|
75669
75651
|
}
|
|
75670
75652
|
})
|
|
@@ -76715,11 +76697,12 @@ var config23 = {
|
|
|
76715
76697
|
var c3_default33 = config23;
|
|
76716
76698
|
|
|
76717
76699
|
// templates/svelte/c3.ts
|
|
76700
|
+
var import_node_fs3 = require("node:fs");
|
|
76718
76701
|
var import_node_os4 = require("node:os");
|
|
76719
76702
|
var recast12 = __toESM(require_main3());
|
|
76720
76703
|
var { npm: npm19 } = detectPackageManager();
|
|
76721
76704
|
var generate24 = async (ctx) => {
|
|
76722
|
-
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
76705
|
+
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
76723
76706
|
logRaw("");
|
|
76724
76707
|
};
|
|
76725
76708
|
var configure18 = async (ctx) => {
|
|
@@ -76730,6 +76713,7 @@ var configure18 = async (ctx) => {
|
|
|
76730
76713
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
76731
76714
|
});
|
|
76732
76715
|
updateSvelteConfig2();
|
|
76716
|
+
updatePlaywrightConfig(usesTypescript(ctx));
|
|
76733
76717
|
updateTypeDefinitions2(ctx);
|
|
76734
76718
|
};
|
|
76735
76719
|
var updateSvelteConfig2 = () => {
|
|
@@ -76744,6 +76728,28 @@ var updateSvelteConfig2 = () => {
|
|
|
76744
76728
|
}
|
|
76745
76729
|
});
|
|
76746
76730
|
};
|
|
76731
|
+
var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
76732
|
+
const filePath = `playwright.config.${shouldUseTypescript ? "ts" : "js"}`;
|
|
76733
|
+
if (!(0, import_node_fs3.existsSync)(filePath)) {
|
|
76734
|
+
return;
|
|
76735
|
+
}
|
|
76736
|
+
updateStatus(`Changing webServer port in ${blue(filePath)}`);
|
|
76737
|
+
transformFile(filePath, {
|
|
76738
|
+
visitObjectExpression: function(n2) {
|
|
76739
|
+
const portProp = n2.node.properties.find((prop) => {
|
|
76740
|
+
if (!("key" in prop) || !("name" in prop.key)) {
|
|
76741
|
+
return false;
|
|
76742
|
+
}
|
|
76743
|
+
return prop.key.name === "port";
|
|
76744
|
+
});
|
|
76745
|
+
if (!portProp || !("value" in portProp) || !("value" in portProp.value)) {
|
|
76746
|
+
return this.traverse(n2);
|
|
76747
|
+
}
|
|
76748
|
+
portProp.value.value = 8788;
|
|
76749
|
+
return false;
|
|
76750
|
+
}
|
|
76751
|
+
});
|
|
76752
|
+
};
|
|
76747
76753
|
var updateTypeDefinitions2 = (ctx) => {
|
|
76748
76754
|
if (!usesTypescript(ctx)) {
|
|
76749
76755
|
return;
|
|
@@ -76784,8 +76790,8 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
76784
76790
|
var config24 = {
|
|
76785
76791
|
configVersion: 1,
|
|
76786
76792
|
id: "svelte",
|
|
76787
|
-
frameworkCli: "
|
|
76788
|
-
displayName: "
|
|
76793
|
+
frameworkCli: "sv",
|
|
76794
|
+
displayName: "SvelteKit",
|
|
76789
76795
|
platform: "pages",
|
|
76790
76796
|
copyFiles: {
|
|
76791
76797
|
variants: {
|
|
@@ -76840,7 +76846,7 @@ var config25 = {
|
|
|
76840
76846
|
var c3_default35 = config25;
|
|
76841
76847
|
|
|
76842
76848
|
// ../wrangler/package.json
|
|
76843
|
-
var version2 = "0.0.0-
|
|
76849
|
+
var version2 = "0.0.0-a2cb6decc";
|
|
76844
76850
|
|
|
76845
76851
|
// src/git.ts
|
|
76846
76852
|
var offerGit = async (ctx) => {
|
|
@@ -77911,11 +77917,13 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
77911
77917
|
disableTelemetry: args[key] !== void 0,
|
|
77912
77918
|
async promise() {
|
|
77913
77919
|
const value = args[key];
|
|
77920
|
+
const error2 = promptConfig.validate?.(value) ?? null;
|
|
77914
77921
|
const result = await inputPrompt({
|
|
77915
77922
|
...promptConfig,
|
|
77916
77923
|
// Accept the default value if the arg is already set
|
|
77917
|
-
acceptDefault: promptConfig.acceptDefault ?? value !== void 0,
|
|
77924
|
+
acceptDefault: promptConfig.acceptDefault ?? (value !== void 0 && !error2),
|
|
77918
77925
|
defaultValue: value ?? promptConfig.defaultValue,
|
|
77926
|
+
initialErrorMessage: error2,
|
|
77919
77927
|
throwOnError: true
|
|
77920
77928
|
});
|
|
77921
77929
|
args[key] = result;
|
|
@@ -77927,6 +77935,9 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
77927
77935
|
};
|
|
77928
77936
|
|
|
77929
77937
|
// src/deploy.ts
|
|
77938
|
+
var import_promises4 = require("node:fs/promises");
|
|
77939
|
+
var import_node_os5 = require("node:os");
|
|
77940
|
+
var import_node_path5 = require("node:path");
|
|
77930
77941
|
var import_toml2 = __toESM(require_toml());
|
|
77931
77942
|
|
|
77932
77943
|
// src/helpers/poll.ts
|
|
@@ -79245,23 +79256,34 @@ var runDeploy = async (ctx) => {
|
|
|
79245
79256
|
JSON.stringify(ctx.commitMessage)
|
|
79246
79257
|
] : []
|
|
79247
79258
|
];
|
|
79248
|
-
const
|
|
79249
|
-
|
|
79259
|
+
const outputFile = (0, import_node_path5.join)(
|
|
79260
|
+
await (0, import_promises4.mkdtemp)((0, import_node_path5.join)((0, import_node_os5.tmpdir)(), "c3-wrangler-deploy-")),
|
|
79261
|
+
"output.json"
|
|
79262
|
+
);
|
|
79263
|
+
await runCommand(deployCmd, {
|
|
79250
79264
|
cwd: ctx.project.path,
|
|
79251
79265
|
env: {
|
|
79252
79266
|
CLOUDFLARE_ACCOUNT_ID: ctx.account.id,
|
|
79253
|
-
NODE_ENV: "production"
|
|
79267
|
+
NODE_ENV: "production",
|
|
79268
|
+
WRANGLER_OUTPUT_FILE_PATH: outputFile
|
|
79254
79269
|
},
|
|
79255
79270
|
startText: "Deploying your application",
|
|
79256
79271
|
doneText: `${brandColor("deployed")} ${dim(
|
|
79257
79272
|
`via \`${quoteShellArgs(baseDeployCmd)}\``
|
|
79258
79273
|
)}`
|
|
79259
79274
|
});
|
|
79260
|
-
|
|
79261
|
-
|
|
79262
|
-
|
|
79263
|
-
|
|
79264
|
-
|
|
79275
|
+
try {
|
|
79276
|
+
const contents = readFile(outputFile);
|
|
79277
|
+
const entries = contents.split("\n").filter(Boolean).map((entry) => JSON.parse(entry));
|
|
79278
|
+
const url = entries.find((entry) => entry.type === "deploy")?.targets?.[0] ?? entries.find((entry) => entry.type === "pages-deploy")?.url;
|
|
79279
|
+
const deployedUrlRegex = /https:\/\/.+\.(pages|workers)\.dev/;
|
|
79280
|
+
const deployedUrlMatch = url?.match(deployedUrlRegex);
|
|
79281
|
+
if (deployedUrlMatch) {
|
|
79282
|
+
ctx.deployment.url = deployedUrlMatch[0];
|
|
79283
|
+
} else {
|
|
79284
|
+
throw new Error("Failed to find deployment url.");
|
|
79285
|
+
}
|
|
79286
|
+
} catch {
|
|
79265
79287
|
throw new Error("Failed to find deployment url.");
|
|
79266
79288
|
}
|
|
79267
79289
|
if (ctx.deployment.url?.endsWith(".pages.dev")) {
|
|
@@ -79346,6 +79368,7 @@ var printSummary = (ctx) => {
|
|
|
79346
79368
|
]);
|
|
79347
79369
|
const documentationUrl = `https://developers.cloudflare.com/${ctx.template.platform}`;
|
|
79348
79370
|
const discordUrl = `https://discord.cloudflare.com`;
|
|
79371
|
+
const reportIssueUrl = "https://github.com/cloudflare/workers-sdk/issues/new/choose";
|
|
79349
79372
|
const lines = [
|
|
79350
79373
|
`\u{1F389} ${bgGreen(" SUCCESS ")} Application ${ctx.deployment.url ? "deployed" : "created"} successfully!`,
|
|
79351
79374
|
``
|
|
@@ -79367,6 +79390,9 @@ var printSummary = (ctx) => {
|
|
|
79367
79390
|
`\u{1F4D6} Explore Documentation`,
|
|
79368
79391
|
`${blue.underline(hyperlink(documentationUrl))}`,
|
|
79369
79392
|
``,
|
|
79393
|
+
`\u{1F41B} Report an Issue`,
|
|
79394
|
+
`${blue.underline(hyperlink(reportIssueUrl))}`,
|
|
79395
|
+
``,
|
|
79370
79396
|
`\u{1F4AC} Join our Community`,
|
|
79371
79397
|
`${blue.underline(hyperlink(discordUrl))}`
|
|
79372
79398
|
);
|