create-cloudflare 0.0.0-763ecce4 → 0.0.0-773e2a8c
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 +155 -90
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -8473,7 +8473,7 @@ var require_util = __commonJS({
|
|
|
8473
8473
|
exports.isAbsolute = function(aPath) {
|
|
8474
8474
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
8475
8475
|
};
|
|
8476
|
-
function
|
|
8476
|
+
function relative3(aRoot, aPath) {
|
|
8477
8477
|
if (aRoot === "") {
|
|
8478
8478
|
aRoot = ".";
|
|
8479
8479
|
}
|
|
@@ -8492,7 +8492,7 @@ var require_util = __commonJS({
|
|
|
8492
8492
|
}
|
|
8493
8493
|
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
8494
8494
|
}
|
|
8495
|
-
exports.relative =
|
|
8495
|
+
exports.relative = relative3;
|
|
8496
8496
|
var supportsNullProto = function() {
|
|
8497
8497
|
var obj = /* @__PURE__ */ Object.create(null);
|
|
8498
8498
|
return !("__proto__" in obj);
|
|
@@ -58091,7 +58091,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
58091
58091
|
var yargs_default = Yargs;
|
|
58092
58092
|
|
|
58093
58093
|
// package.json
|
|
58094
|
-
var version = "0.0.0-
|
|
58094
|
+
var version = "0.0.0-773e2a8c";
|
|
58095
58095
|
var devDependencies = {
|
|
58096
58096
|
"@babel/parser": "^7.21.3",
|
|
58097
58097
|
"@babel/types": "^7.21.4",
|
|
@@ -60149,29 +60149,39 @@ var spinner = (frames = spinnerFrames.clockwise, color = brandColor) => {
|
|
|
60149
60149
|
helpText ||= ``;
|
|
60150
60150
|
currentMsg = msg;
|
|
60151
60151
|
startMsg = `${currentMsg} ${dim(helpText)}`;
|
|
60152
|
-
|
|
60153
|
-
|
|
60154
|
-
|
|
60155
|
-
|
|
60156
|
-
|
|
60157
|
-
|
|
60158
|
-
|
|
60159
|
-
|
|
60160
|
-
|
|
60161
|
-
|
|
60152
|
+
if (isInteractive()) {
|
|
60153
|
+
let index = 0;
|
|
60154
|
+
clearLoop();
|
|
60155
|
+
loop = setInterval(() => {
|
|
60156
|
+
index++;
|
|
60157
|
+
const spinnerFrame = frames[index % frames.length];
|
|
60158
|
+
const ellipsisFrame = ellipsisFrames[index % ellipsisFrames.length];
|
|
60159
|
+
if (msg) {
|
|
60160
|
+
log_update_default(`${color(spinnerFrame)} ${currentMsg} ${ellipsisFrame}`);
|
|
60161
|
+
}
|
|
60162
|
+
}, frameRate);
|
|
60163
|
+
} else {
|
|
60164
|
+
log_update_default(`${leftT} ${startMsg}`);
|
|
60165
|
+
}
|
|
60162
60166
|
},
|
|
60163
60167
|
update(msg) {
|
|
60164
60168
|
currentMsg = msg;
|
|
60165
60169
|
},
|
|
60166
60170
|
stop(msg) {
|
|
60167
|
-
|
|
60168
|
-
|
|
60169
|
-
|
|
60171
|
+
if (isInteractive()) {
|
|
60172
|
+
log_update_default.clear();
|
|
60173
|
+
if (msg) {
|
|
60174
|
+
log_update_default(`${leftT} ${startMsg}
|
|
60175
|
+
${grayBar} ${msg}`);
|
|
60176
|
+
log_update_default.done();
|
|
60177
|
+
newline();
|
|
60178
|
+
}
|
|
60179
|
+
clearLoop();
|
|
60180
|
+
} else {
|
|
60181
|
+
log_update_default(`
|
|
60170
60182
|
${grayBar} ${msg}`);
|
|
60171
|
-
log_update_default.done();
|
|
60172
60183
|
newline();
|
|
60173
60184
|
}
|
|
60174
|
-
clearLoop();
|
|
60175
60185
|
}
|
|
60176
60186
|
};
|
|
60177
60187
|
};
|
|
@@ -60265,7 +60275,10 @@ var detectPackageManager = () => {
|
|
|
60265
60275
|
|
|
60266
60276
|
// src/helpers/shell-quote.ts
|
|
60267
60277
|
var import_shell_quote = __toESM(require_shell_quote());
|
|
60268
|
-
var quote =
|
|
60278
|
+
var quote = function(args) {
|
|
60279
|
+
const stringArgs = args.map((arg) => String(arg));
|
|
60280
|
+
return import_shell_quote.default.quote(stringArgs);
|
|
60281
|
+
};
|
|
60269
60282
|
function parse(cmd, env3) {
|
|
60270
60283
|
if (process.platform === "win32") {
|
|
60271
60284
|
cmd = cmd.replaceAll("\\", "\\\\");
|
|
@@ -60364,7 +60377,7 @@ var printAsyncStatus = async ({
|
|
|
60364
60377
|
...opts
|
|
60365
60378
|
}) => {
|
|
60366
60379
|
let s;
|
|
60367
|
-
if (opts.useSpinner) {
|
|
60380
|
+
if (opts.useSpinner && isInteractive()) {
|
|
60368
60381
|
s = spinner();
|
|
60369
60382
|
}
|
|
60370
60383
|
s?.start(opts?.startText);
|
|
@@ -60382,7 +60395,10 @@ var printAsyncStatus = async ({
|
|
|
60382
60395
|
}
|
|
60383
60396
|
return promise;
|
|
60384
60397
|
};
|
|
60385
|
-
var retry = async (
|
|
60398
|
+
var retry = async ({
|
|
60399
|
+
times,
|
|
60400
|
+
exitCondition
|
|
60401
|
+
}, fn) => {
|
|
60386
60402
|
let error = null;
|
|
60387
60403
|
while (times > 0) {
|
|
60388
60404
|
try {
|
|
@@ -60390,6 +60406,9 @@ var retry = async (times, fn) => {
|
|
|
60390
60406
|
} catch (e) {
|
|
60391
60407
|
error = e;
|
|
60392
60408
|
times--;
|
|
60409
|
+
if (exitCondition?.(e)) {
|
|
60410
|
+
break;
|
|
60411
|
+
}
|
|
60393
60412
|
}
|
|
60394
60413
|
}
|
|
60395
60414
|
throw error;
|
|
@@ -60596,9 +60615,9 @@ var usesEslint = (ctx) => {
|
|
|
60596
60615
|
}
|
|
60597
60616
|
return { used: false };
|
|
60598
60617
|
};
|
|
60599
|
-
var compatDateFlag = () => {
|
|
60600
|
-
const
|
|
60601
|
-
return `--compatibility-date=${
|
|
60618
|
+
var compatDateFlag = async () => {
|
|
60619
|
+
const workerdCompatDate = await getWorkerdCompatibilityDate();
|
|
60620
|
+
return `--compatibility-date=${workerdCompatDate}`;
|
|
60602
60621
|
};
|
|
60603
60622
|
|
|
60604
60623
|
// src/frameworks/angular/index.ts
|
|
@@ -60612,9 +60631,8 @@ var generate = async (ctx) => {
|
|
|
60612
60631
|
logRaw("");
|
|
60613
60632
|
};
|
|
60614
60633
|
var configure = async (ctx) => {
|
|
60615
|
-
const cli = getFrameworkCli(ctx, false);
|
|
60616
60634
|
process.chdir(ctx.project.path);
|
|
60617
|
-
await runCommand(`${npx}
|
|
60635
|
+
await runCommand(`${npx} ng analytics disable`, {
|
|
60618
60636
|
silent: true
|
|
60619
60637
|
});
|
|
60620
60638
|
await addSSRAdapter();
|
|
@@ -60626,15 +60644,15 @@ var config = {
|
|
|
60626
60644
|
generate,
|
|
60627
60645
|
configure,
|
|
60628
60646
|
displayName: "Angular",
|
|
60629
|
-
|
|
60647
|
+
getPackageScripts: async () => ({
|
|
60630
60648
|
process: "node ./tools/copy-worker-files.mjs && node ./tools/copy-client-files.mjs && node ./tools/bundle.mjs",
|
|
60631
|
-
|
|
60632
|
-
start:
|
|
60633
|
-
|
|
60634
|
-
|
|
60635
|
-
},
|
|
60649
|
+
"pages:build": `${npm} run build:ssr && ${npm} run process`,
|
|
60650
|
+
start: `${npm} run pages:build && wrangler pages dev dist/cloudflare ${await compatDateFlag()} --experimental-local`,
|
|
60651
|
+
deploy: `${npm} run pages:build && wrangler pages deploy dist/cloudflare`
|
|
60652
|
+
}),
|
|
60636
60653
|
deployCommand: "deploy",
|
|
60637
|
-
devCommand: "start"
|
|
60654
|
+
devCommand: "start",
|
|
60655
|
+
testFlags: ["--routing", "--style", "sass"]
|
|
60638
60656
|
};
|
|
60639
60657
|
var angular_default = config;
|
|
60640
60658
|
async function installCFWorker(ctx) {
|
|
@@ -60724,10 +60742,10 @@ var config2 = {
|
|
|
60724
60742
|
generate: generate2,
|
|
60725
60743
|
configure: configure2,
|
|
60726
60744
|
displayName: "Astro",
|
|
60727
|
-
|
|
60728
|
-
"pages:dev": `wrangler pages dev ${compatDateFlag()} -- astro dev`,
|
|
60745
|
+
getPackageScripts: async () => ({
|
|
60746
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} -- astro dev`,
|
|
60729
60747
|
"pages:deploy": `astro build && wrangler pages deploy ./dist`
|
|
60730
|
-
},
|
|
60748
|
+
}),
|
|
60731
60749
|
testFlags: [
|
|
60732
60750
|
"--skip-houston",
|
|
60733
60751
|
"--no-install",
|
|
@@ -60749,10 +60767,10 @@ var generate3 = async (ctx) => {
|
|
|
60749
60767
|
var config3 = {
|
|
60750
60768
|
generate: generate3,
|
|
60751
60769
|
displayName: "Docusaurus",
|
|
60752
|
-
|
|
60753
|
-
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm2} run start`,
|
|
60770
|
+
getPackageScripts: async () => ({
|
|
60771
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm2} run start`,
|
|
60754
60772
|
"pages:deploy": `NODE_VERSION=16 ${npm2} run build && wrangler pages deploy ./build`
|
|
60755
|
-
},
|
|
60773
|
+
}),
|
|
60756
60774
|
testFlags: [`--package-manager`, npm2]
|
|
60757
60775
|
};
|
|
60758
60776
|
var docusaurus_default = config3;
|
|
@@ -60785,10 +60803,10 @@ var generate4 = async (ctx) => {
|
|
|
60785
60803
|
var config4 = {
|
|
60786
60804
|
generate: generate4,
|
|
60787
60805
|
displayName: "Gatsby",
|
|
60788
|
-
|
|
60789
|
-
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 8000 -- ${npm3} run develop`,
|
|
60806
|
+
getPackageScripts: async () => ({
|
|
60807
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 8000 -- ${npm3} run develop`,
|
|
60790
60808
|
"pages:deploy": `${npm3} run build && wrangler pages deploy ./public`
|
|
60791
|
-
}
|
|
60809
|
+
})
|
|
60792
60810
|
};
|
|
60793
60811
|
var gatsby_default = config4;
|
|
60794
60812
|
|
|
@@ -60805,7 +60823,7 @@ var generate5 = async (ctx) => {
|
|
|
60805
60823
|
var config5 = {
|
|
60806
60824
|
generate: generate5,
|
|
60807
60825
|
displayName: "Hono",
|
|
60808
|
-
|
|
60826
|
+
getPackageScripts: async () => ({}),
|
|
60809
60827
|
deployCommand: "deploy",
|
|
60810
60828
|
devCommand: "dev",
|
|
60811
60829
|
type: "workers"
|
|
@@ -60945,11 +60963,17 @@ var config6 = {
|
|
|
60945
60963
|
generate: generate6,
|
|
60946
60964
|
configure: configure3,
|
|
60947
60965
|
displayName: "Next",
|
|
60948
|
-
|
|
60949
|
-
"
|
|
60950
|
-
|
|
60951
|
-
|
|
60952
|
-
|
|
60966
|
+
getPackageScripts: async () => {
|
|
60967
|
+
const isNpmOrBun = ["npm", "bun"].includes(npm4);
|
|
60968
|
+
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
60969
|
+
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
60970
|
+
const pmCommand = isNpmOrBun ? npx3 : npm4;
|
|
60971
|
+
return {
|
|
60972
|
+
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
60973
|
+
"pages:deploy": `${npm4 === "npm" ? "npm run" : pmCommand} pages:build && wrangler pages deploy .vercel/output/static`,
|
|
60974
|
+
"pages:watch": `${pmCommand} ${nextOnPagesCommand} --watch`,
|
|
60975
|
+
"pages:dev": `${pmCommand} wrangler pages dev .vercel/output/static ${await compatDateFlag()} --compatibility-flag=nodejs_compat`
|
|
60976
|
+
};
|
|
60953
60977
|
},
|
|
60954
60978
|
testFlags: [
|
|
60955
60979
|
"--typescript",
|
|
@@ -60985,11 +61009,11 @@ var config7 = {
|
|
|
60985
61009
|
generate: generate7,
|
|
60986
61010
|
configure: configure4,
|
|
60987
61011
|
displayName: "Nuxt",
|
|
60988
|
-
|
|
61012
|
+
getPackageScripts: async () => ({
|
|
60989
61013
|
build: (cmd) => `NITRO_PRESET=cloudflare-pages ${cmd}`,
|
|
60990
|
-
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm5} run dev`,
|
|
61014
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm5} run dev`,
|
|
60991
61015
|
"pages:deploy": `${npm5} run build && wrangler pages deploy ./dist`
|
|
60992
|
-
}
|
|
61016
|
+
})
|
|
60993
61017
|
};
|
|
60994
61018
|
var nuxt_default = config7;
|
|
60995
61019
|
|
|
@@ -61003,17 +61027,17 @@ var package_default = {
|
|
|
61003
61027
|
],
|
|
61004
61028
|
dependencies: {
|
|
61005
61029
|
"@angular/cli": "16.2.2",
|
|
61006
|
-
"create-astro": "4.
|
|
61030
|
+
"create-astro": "4.3.0",
|
|
61007
61031
|
"create-docusaurus": "2.4.3",
|
|
61008
|
-
"create-hono": "0.2
|
|
61032
|
+
"create-hono": "0.3.2",
|
|
61009
61033
|
"create-next-app": "13.4.19",
|
|
61010
|
-
"create-qwik": "1.2.
|
|
61034
|
+
"create-qwik": "1.2.14",
|
|
61011
61035
|
"create-react-app": "5.0.1",
|
|
61012
|
-
"create-remix": "2.0
|
|
61013
|
-
"create-solid": "0.3.
|
|
61014
|
-
"create-svelte": "5.1.
|
|
61015
|
-
"create-vue": "3.
|
|
61016
|
-
gatsby: "5.12.
|
|
61036
|
+
"create-remix": "2.1.0",
|
|
61037
|
+
"create-solid": "0.3.7",
|
|
61038
|
+
"create-svelte": "5.1.1",
|
|
61039
|
+
"create-vue": "3.8.0",
|
|
61040
|
+
gatsby: "5.12.8",
|
|
61017
61041
|
nuxi: "3.9.0"
|
|
61018
61042
|
},
|
|
61019
61043
|
frameworkCliMap: {
|
|
@@ -61050,10 +61074,10 @@ var config8 = {
|
|
|
61050
61074
|
generate: generate8,
|
|
61051
61075
|
configure: configure5,
|
|
61052
61076
|
displayName: "Qwik",
|
|
61053
|
-
|
|
61054
|
-
"pages:dev": `wrangler pages dev ${compatDateFlag()} -- ${npm6} run dev`,
|
|
61077
|
+
getPackageScripts: async () => ({
|
|
61078
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} -- ${npm6} run dev`,
|
|
61055
61079
|
"pages:deploy": `${npm6} run build && wrangler pages deploy ./dist`
|
|
61056
|
-
}
|
|
61080
|
+
})
|
|
61057
61081
|
};
|
|
61058
61082
|
var qwik_default = config8;
|
|
61059
61083
|
|
|
@@ -61071,10 +61095,10 @@ var config9 = {
|
|
|
61071
61095
|
generate: generate9,
|
|
61072
61096
|
configure: configure6,
|
|
61073
61097
|
displayName: "React",
|
|
61074
|
-
|
|
61075
|
-
"pages:dev": `wrangler pages dev ${compatDateFlag()} --port 3000 -- ${npm7} start`,
|
|
61098
|
+
getPackageScripts: async () => ({
|
|
61099
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --port 3000 -- ${npm7} start`,
|
|
61076
61100
|
"pages:deploy": `${npm7} run build && wrangler pages deploy ./build`
|
|
61077
|
-
}
|
|
61101
|
+
})
|
|
61078
61102
|
};
|
|
61079
61103
|
var react_default = config9;
|
|
61080
61104
|
|
|
@@ -61091,9 +61115,9 @@ var generate10 = async (ctx) => {
|
|
|
61091
61115
|
var config10 = {
|
|
61092
61116
|
generate: generate10,
|
|
61093
61117
|
displayName: "Remix",
|
|
61094
|
-
|
|
61118
|
+
getPackageScripts: async () => ({
|
|
61095
61119
|
"pages:deploy": `${npm8} run build && wrangler pages deploy ./public`
|
|
61096
|
-
},
|
|
61120
|
+
}),
|
|
61097
61121
|
devCommand: "dev",
|
|
61098
61122
|
testFlags: ["--typescript", "--no-install", "--no-git-init"]
|
|
61099
61123
|
};
|
|
@@ -61135,10 +61159,10 @@ var config11 = {
|
|
|
61135
61159
|
generate: generate11,
|
|
61136
61160
|
configure: configure7,
|
|
61137
61161
|
displayName: "Solid",
|
|
61138
|
-
|
|
61139
|
-
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
|
|
61162
|
+
getPackageScripts: async () => ({
|
|
61163
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
|
|
61140
61164
|
"pages:deploy": `${npm9} run build && wrangler pages deploy ./dist/public`
|
|
61141
|
-
}
|
|
61165
|
+
})
|
|
61142
61166
|
};
|
|
61143
61167
|
var solid_default = config11;
|
|
61144
61168
|
|
|
@@ -61232,10 +61256,10 @@ var config12 = {
|
|
|
61232
61256
|
generate: generate12,
|
|
61233
61257
|
configure: configure8,
|
|
61234
61258
|
displayName: "Svelte",
|
|
61235
|
-
|
|
61236
|
-
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 5173 -- ${npm10} run dev`,
|
|
61259
|
+
getPackageScripts: async () => ({
|
|
61260
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 5173 -- ${npm10} run dev`,
|
|
61237
61261
|
"pages:deploy": `${npm10} run build && wrangler pages deploy .svelte-kit/cloudflare`
|
|
61238
|
-
}
|
|
61262
|
+
})
|
|
61239
61263
|
};
|
|
61240
61264
|
var svelte_default = config12;
|
|
61241
61265
|
|
|
@@ -61248,10 +61272,10 @@ var generate13 = async (ctx) => {
|
|
|
61248
61272
|
var config13 = {
|
|
61249
61273
|
generate: generate13,
|
|
61250
61274
|
displayName: "Vue",
|
|
61251
|
-
|
|
61252
|
-
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 5173 -- ${npm11} run dev`,
|
|
61275
|
+
getPackageScripts: async () => ({
|
|
61276
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 5173 -- ${npm11} run dev`,
|
|
61253
61277
|
"pages:deploy": `${npm11} run build && wrangler pages deploy ./dist`
|
|
61254
|
-
},
|
|
61278
|
+
}),
|
|
61255
61279
|
testFlags: ["--ts"]
|
|
61256
61280
|
};
|
|
61257
61281
|
var vue_default = config13;
|
|
@@ -61389,21 +61413,35 @@ function secondsSince(start) {
|
|
|
61389
61413
|
}
|
|
61390
61414
|
|
|
61391
61415
|
// ../wrangler/package.json
|
|
61392
|
-
var version2 = "3.
|
|
61416
|
+
var version2 = "3.14.0";
|
|
61393
61417
|
|
|
61394
61418
|
// src/common.ts
|
|
61395
61419
|
var { name, npm: npm12 } = detectPackageManager();
|
|
61396
|
-
var validateProjectDirectory = (relativePath) => {
|
|
61420
|
+
var validateProjectDirectory = (relativePath, args) => {
|
|
61397
61421
|
const path3 = (0, import_path7.resolve)(relativePath);
|
|
61398
61422
|
const existsAlready = (0, import_fs8.existsSync)(path3);
|
|
61399
61423
|
const isEmpty = existsAlready && (0, import_fs8.readdirSync)(path3).length === 0;
|
|
61400
61424
|
if (existsAlready && !isEmpty) {
|
|
61401
61425
|
return `Directory \`${relativePath}\` already exists and is not empty. Please choose a new name.`;
|
|
61402
61426
|
}
|
|
61427
|
+
if (!args.existingScript) {
|
|
61428
|
+
const projectName = (0, import_path7.basename)(path3);
|
|
61429
|
+
const invalidChars = /[^a-z0-9-]/;
|
|
61430
|
+
const invalidStartEnd = /^-|-$/;
|
|
61431
|
+
if (projectName.match(invalidStartEnd)) {
|
|
61432
|
+
return `Project names cannot start or end with a dash.`;
|
|
61433
|
+
}
|
|
61434
|
+
if (projectName.match(invalidChars)) {
|
|
61435
|
+
return `Project names must only contain lowercase characters, numbers, and dashes.`;
|
|
61436
|
+
}
|
|
61437
|
+
if (projectName.length > 58) {
|
|
61438
|
+
return `Project names must be less than 58 characters.`;
|
|
61439
|
+
}
|
|
61440
|
+
}
|
|
61403
61441
|
};
|
|
61404
61442
|
var setupProjectDirectory = (args) => {
|
|
61405
61443
|
const path3 = (0, import_path7.resolve)(args.projectName);
|
|
61406
|
-
const err = validateProjectDirectory(path3);
|
|
61444
|
+
const err = validateProjectDirectory(path3, args);
|
|
61407
61445
|
if (err) {
|
|
61408
61446
|
crash(err);
|
|
61409
61447
|
}
|
|
@@ -61509,7 +61547,10 @@ var chooseAccount = async (ctx) => {
|
|
|
61509
61547
|
};
|
|
61510
61548
|
var printSummary = async (ctx) => {
|
|
61511
61549
|
const nextSteps = [
|
|
61512
|
-
[
|
|
61550
|
+
[
|
|
61551
|
+
`Navigate to the new directory`,
|
|
61552
|
+
`cd ${quote([(0, import_path7.relative)(ctx.originalCWD, ctx.project.path)])}`
|
|
61553
|
+
],
|
|
61513
61554
|
[
|
|
61514
61555
|
`Run the development server`,
|
|
61515
61556
|
`${npm12} run ${ctx.framework?.config.devCommand ?? "start"}`
|
|
@@ -61736,6 +61777,7 @@ var defaultFrameworkConfig = {
|
|
|
61736
61777
|
devCommand: "pages:dev"
|
|
61737
61778
|
};
|
|
61738
61779
|
var runPagesGenerator = async (args) => {
|
|
61780
|
+
const originalCWD = process.cwd();
|
|
61739
61781
|
const { name: name2, path: path3 } = setupProjectDirectory(args);
|
|
61740
61782
|
const framework = await getFrameworkSelection(args);
|
|
61741
61783
|
const frameworkConfig = FrameworkMap[framework];
|
|
@@ -61753,7 +61795,8 @@ var runPagesGenerator = async (args) => {
|
|
|
61753
61795
|
args: args.additionalArgs ?? []
|
|
61754
61796
|
},
|
|
61755
61797
|
args,
|
|
61756
|
-
type: frameworkConfig.type
|
|
61798
|
+
type: frameworkConfig.type,
|
|
61799
|
+
originalCWD
|
|
61757
61800
|
};
|
|
61758
61801
|
const { generate: generate14, configure: configure9 } = FrameworkMap[framework];
|
|
61759
61802
|
await generate14({ ...ctx });
|
|
@@ -61793,7 +61836,8 @@ var getFrameworkSelection = async (args) => {
|
|
|
61793
61836
|
var updatePackageScripts = async (ctx) => {
|
|
61794
61837
|
(0, import_process3.chdir)(ctx.project.path);
|
|
61795
61838
|
await installWrangler();
|
|
61796
|
-
const {
|
|
61839
|
+
const { getPackageScripts } = ctx.framework?.config ?? {};
|
|
61840
|
+
const packageScripts = getPackageScripts ? await getPackageScripts() : {};
|
|
61797
61841
|
if (packageScripts) {
|
|
61798
61842
|
const s = spinner();
|
|
61799
61843
|
const updatingScripts = Object.entries(packageScripts).filter(
|
|
@@ -61835,12 +61879,22 @@ var createProject = async (ctx) => {
|
|
|
61835
61879
|
}
|
|
61836
61880
|
const CLOUDFLARE_ACCOUNT_ID = ctx.account.id;
|
|
61837
61881
|
try {
|
|
61838
|
-
const compatFlags =
|
|
61882
|
+
const compatFlags = quote(
|
|
61883
|
+
ctx.framework?.config.compatibilityFlags ?? []
|
|
61884
|
+
);
|
|
61839
61885
|
const compatFlagsArg = compatFlags ? `--compatibility-flags ${compatFlags}` : "";
|
|
61840
61886
|
const productionBranch = await getProductionBranch(ctx.project.path);
|
|
61841
61887
|
const cmd = `${npx5} wrangler pages project create ${ctx.project.name} --production-branch ${productionBranch} ${compatFlagsArg}`;
|
|
61842
61888
|
await retry(
|
|
61843
|
-
|
|
61889
|
+
{
|
|
61890
|
+
times: CREATE_PROJECT_RETRIES,
|
|
61891
|
+
exitCondition: (e) => {
|
|
61892
|
+
return e instanceof Error && // if the error is regarding name duplication we can exist as retrying is not going to help
|
|
61893
|
+
e.message.includes(
|
|
61894
|
+
"A project with this name already exists. Choose a different project name."
|
|
61895
|
+
);
|
|
61896
|
+
}
|
|
61897
|
+
},
|
|
61844
61898
|
async () => runCommand(cmd, {
|
|
61845
61899
|
// Make this command more verbose in test mode to aid
|
|
61846
61900
|
// troubleshooting API errors
|
|
@@ -61857,7 +61911,7 @@ var createProject = async (ctx) => {
|
|
|
61857
61911
|
try {
|
|
61858
61912
|
const verifyProject = `${npx5} wrangler pages deployment list --project-name ${ctx.project.name}`;
|
|
61859
61913
|
await retry(
|
|
61860
|
-
VERIFY_PROJECT_RETRIES,
|
|
61914
|
+
{ times: VERIFY_PROJECT_RETRIES },
|
|
61861
61915
|
async () => runCommand(verifyProject, {
|
|
61862
61916
|
silent: process.env.VITEST == void 0,
|
|
61863
61917
|
cwd: ctx.project.path,
|
|
@@ -61879,11 +61933,14 @@ var import_promises2 = require("fs/promises");
|
|
|
61879
61933
|
var import_os = require("os");
|
|
61880
61934
|
var import_path9 = require("path");
|
|
61881
61935
|
var import_process4 = require("process");
|
|
61936
|
+
var { dlx: dlx14 } = detectPackageManager();
|
|
61882
61937
|
var runWorkersGenerator = async (args) => {
|
|
61938
|
+
const originalCWD = process.cwd();
|
|
61883
61939
|
const { name: name2, path: path3 } = setupProjectDirectory(args);
|
|
61884
61940
|
const ctx = {
|
|
61885
61941
|
project: { name: name2, path: path3 },
|
|
61886
|
-
args
|
|
61942
|
+
args,
|
|
61943
|
+
originalCWD
|
|
61887
61944
|
};
|
|
61888
61945
|
ctx.args.ts = await processArgument(ctx.args, "ts", {
|
|
61889
61946
|
type: "confirm",
|
|
@@ -61945,7 +62002,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
61945
62002
|
(0, import_path9.join)((0, import_os.tmpdir)(), "c3-wrangler-init--from-dash-")
|
|
61946
62003
|
);
|
|
61947
62004
|
await runCommand(
|
|
61948
|
-
|
|
62005
|
+
`${dlx14} wrangler@3 init --from-dash ${ctx.args.existingScript} -y --no-delegate-c3`,
|
|
61949
62006
|
{
|
|
61950
62007
|
silent: true,
|
|
61951
62008
|
cwd: tempdir,
|
|
@@ -62055,6 +62112,10 @@ var parseArgs = async (argv) => {
|
|
|
62055
62112
|
}).option("accept-defaults", {
|
|
62056
62113
|
alias: "y",
|
|
62057
62114
|
type: "boolean"
|
|
62115
|
+
}).option("auto-update", {
|
|
62116
|
+
type: "boolean",
|
|
62117
|
+
default: C3_DEFAULTS.autoUpdate,
|
|
62118
|
+
description: "Automatically uses the latest version of `create-cloudflare`. Set --no-auto-update to disable"
|
|
62058
62119
|
}).option("wrangler-defaults", { type: "boolean", hidden: true }).version(version).strictOptions().alias("h", "help").help();
|
|
62059
62120
|
const args = await yargsObj.argv;
|
|
62060
62121
|
const positionalArgs = args._;
|
|
@@ -62075,7 +62136,10 @@ var processArgument = async (args, name2, promptConfig) => {
|
|
|
62075
62136
|
let value = args[name2];
|
|
62076
62137
|
const renderSubmitted = getRenderers(promptConfig).submit;
|
|
62077
62138
|
if (value !== void 0) {
|
|
62078
|
-
promptConfig.validate?.(value);
|
|
62139
|
+
const error = promptConfig.validate?.(value);
|
|
62140
|
+
if (error) {
|
|
62141
|
+
crash(error);
|
|
62142
|
+
}
|
|
62079
62143
|
const lines = renderSubmitted({ value });
|
|
62080
62144
|
logRaw(lines.join("\n"));
|
|
62081
62145
|
return value;
|
|
@@ -62113,7 +62177,8 @@ var isUpdateAvailable = async () => {
|
|
|
62113
62177
|
};
|
|
62114
62178
|
var runLatest = async () => {
|
|
62115
62179
|
const args = process.argv.slice(2);
|
|
62116
|
-
|
|
62180
|
+
const argString = npm13 === "npm" ? `-- ${quote(args)}` : `${quote(args)}`;
|
|
62181
|
+
await runCommand(`${npm13} create cloudflare@latest ${argString}`);
|
|
62117
62182
|
};
|
|
62118
62183
|
var runCli = async (args) => {
|
|
62119
62184
|
printBanner();
|
|
@@ -62123,7 +62188,7 @@ var runCli = async (args) => {
|
|
|
62123
62188
|
helpText: "also used as application name",
|
|
62124
62189
|
defaultValue: C3_DEFAULTS.projectName,
|
|
62125
62190
|
label: "dir",
|
|
62126
|
-
validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName),
|
|
62191
|
+
validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName, args),
|
|
62127
62192
|
format: (val) => `./${val}`
|
|
62128
62193
|
});
|
|
62129
62194
|
if (!args.type) {
|
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-773e2a8c",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"yargs": "^17.7.1",
|
|
67
67
|
"yarn": "^1.22.19",
|
|
68
68
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
69
|
-
"wrangler": "3.
|
|
69
|
+
"wrangler": "3.14.0"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=18.14.1"
|