create-cloudflare 0.0.0-97750430 → 0.0.0-980df048

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 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 relative2(aRoot, aPath) {
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 = relative2;
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-97750430";
58094
+ var version = "0.0.0-980df048";
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
- let index = 0;
60153
- clearLoop();
60154
- loop = setInterval(() => {
60155
- index++;
60156
- const spinnerFrame = frames[index % frames.length];
60157
- const ellipsisFrame = ellipsisFrames[index % ellipsisFrames.length];
60158
- if (msg) {
60159
- log_update_default(`${color(spinnerFrame)} ${currentMsg} ${ellipsisFrame}`);
60160
- }
60161
- }, frameRate);
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
- log_update_default.clear();
60168
- if (msg) {
60169
- log_update_default(`${leftT} ${startMsg}
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
  };
@@ -60199,6 +60209,7 @@ var detectPackageManager = () => {
60199
60209
  case "bun":
60200
60210
  name2 = "bun";
60201
60211
  version3 = "1.0.0";
60212
+ process.env.npm_config_user_agent = "bun";
60202
60213
  break;
60203
60214
  case "npm":
60204
60215
  name2 = "npm";
@@ -60363,7 +60374,7 @@ var printAsyncStatus = async ({
60363
60374
  ...opts
60364
60375
  }) => {
60365
60376
  let s;
60366
- if (opts.useSpinner) {
60377
+ if (opts.useSpinner && isInteractive()) {
60367
60378
  s = spinner();
60368
60379
  }
60369
60380
  s?.start(opts?.startText);
@@ -60381,7 +60392,10 @@ var printAsyncStatus = async ({
60381
60392
  }
60382
60393
  return promise;
60383
60394
  };
60384
- var retry = async (times, fn) => {
60395
+ var retry = async ({
60396
+ times,
60397
+ exitCondition
60398
+ }, fn) => {
60385
60399
  let error = null;
60386
60400
  while (times > 0) {
60387
60401
  try {
@@ -60389,6 +60403,9 @@ var retry = async (times, fn) => {
60389
60403
  } catch (e) {
60390
60404
  error = e;
60391
60405
  times--;
60406
+ if (exitCondition?.(e)) {
60407
+ break;
60408
+ }
60392
60409
  }
60393
60410
  }
60394
60411
  throw error;
@@ -60595,9 +60612,9 @@ var usesEslint = (ctx) => {
60595
60612
  }
60596
60613
  return { used: false };
60597
60614
  };
60598
- var compatDateFlag = () => {
60599
- const date = /* @__PURE__ */ new Date();
60600
- return `--compatibility-date=${date.toISOString().slice(0, 10)}`;
60615
+ var compatDateFlag = async () => {
60616
+ const workerdCompatDate = await getWorkerdCompatibilityDate();
60617
+ return `--compatibility-date=${workerdCompatDate}`;
60601
60618
  };
60602
60619
 
60603
60620
  // src/frameworks/angular/index.ts
@@ -60611,9 +60628,8 @@ var generate = async (ctx) => {
60611
60628
  logRaw("");
60612
60629
  };
60613
60630
  var configure = async (ctx) => {
60614
- const cli = getFrameworkCli(ctx, false);
60615
60631
  process.chdir(ctx.project.path);
60616
- await runCommand(`${npx} ${cli}@next analytics disable`, {
60632
+ await runCommand(`${npx} ng analytics disable`, {
60617
60633
  silent: true
60618
60634
  });
60619
60635
  await addSSRAdapter();
@@ -60625,15 +60641,15 @@ var config = {
60625
60641
  generate,
60626
60642
  configure,
60627
60643
  displayName: "Angular",
60628
- packageScripts: {
60644
+ getPackageScripts: async () => ({
60629
60645
  process: "node ./tools/copy-worker-files.mjs && node ./tools/copy-client-files.mjs && node ./tools/bundle.mjs",
60630
- prestart: `${npm} run build:ssr && ${npm} run process`,
60631
- start: "wrangler pages dev dist/cloudflare --compatibility-date=2021-09-20 --experimental-local",
60632
- predeploy: `${npm} run build:ssr && ${npm} run process`,
60633
- deploy: "wrangler pages deploy dist/cloudflare"
60634
- },
60646
+ "pages:build": `${npm} run build:ssr && ${npm} run process`,
60647
+ start: `${npm} run pages:build && wrangler pages dev dist/cloudflare ${await compatDateFlag()} --experimental-local`,
60648
+ deploy: `${npm} run pages:build && wrangler pages deploy dist/cloudflare`
60649
+ }),
60635
60650
  deployCommand: "deploy",
60636
- devCommand: "start"
60651
+ devCommand: "start",
60652
+ testFlags: ["--routing", "--style", "sass"]
60637
60653
  };
60638
60654
  var angular_default = config;
60639
60655
  async function installCFWorker(ctx) {
@@ -60723,10 +60739,10 @@ var config2 = {
60723
60739
  generate: generate2,
60724
60740
  configure: configure2,
60725
60741
  displayName: "Astro",
60726
- packageScripts: {
60727
- "pages:dev": `wrangler pages dev ${compatDateFlag()} -- astro dev`,
60742
+ getPackageScripts: async () => ({
60743
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} -- astro dev`,
60728
60744
  "pages:deploy": `astro build && wrangler pages deploy ./dist`
60729
- },
60745
+ }),
60730
60746
  testFlags: [
60731
60747
  "--skip-houston",
60732
60748
  "--no-install",
@@ -60748,10 +60764,11 @@ var generate3 = async (ctx) => {
60748
60764
  var config3 = {
60749
60765
  generate: generate3,
60750
60766
  displayName: "Docusaurus",
60751
- packageScripts: {
60752
- "pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm2} run start`,
60767
+ getPackageScripts: async () => ({
60768
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm2} run start`,
60753
60769
  "pages:deploy": `NODE_VERSION=16 ${npm2} run build && wrangler pages deploy ./build`
60754
- }
60770
+ }),
60771
+ testFlags: [`--package-manager`, npm2]
60755
60772
  };
60756
60773
  var docusaurus_default = config3;
60757
60774
 
@@ -60783,10 +60800,10 @@ var generate4 = async (ctx) => {
60783
60800
  var config4 = {
60784
60801
  generate: generate4,
60785
60802
  displayName: "Gatsby",
60786
- packageScripts: {
60787
- "pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 8000 -- ${npm3} run develop`,
60803
+ getPackageScripts: async () => ({
60804
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 8000 -- ${npm3} run develop`,
60788
60805
  "pages:deploy": `${npm3} run build && wrangler pages deploy ./public`
60789
- }
60806
+ })
60790
60807
  };
60791
60808
  var gatsby_default = config4;
60792
60809
 
@@ -60803,7 +60820,7 @@ var generate5 = async (ctx) => {
60803
60820
  var config5 = {
60804
60821
  generate: generate5,
60805
60822
  displayName: "Hono",
60806
- packageScripts: {},
60823
+ getPackageScripts: async () => ({}),
60807
60824
  deployCommand: "deploy",
60808
60825
  devCommand: "dev",
60809
60826
  type: "workers"
@@ -60943,12 +60960,12 @@ var config6 = {
60943
60960
  generate: generate6,
60944
60961
  configure: configure3,
60945
60962
  displayName: "Next",
60946
- packageScripts: {
60963
+ getPackageScripts: async () => ({
60947
60964
  "pages:build": `${dlx6} @cloudflare/next-on-pages@1`,
60948
60965
  "pages:deploy": `${npm4} run pages:build && wrangler pages deploy .vercel/output/static`,
60949
60966
  "pages:watch": `${npx3} @cloudflare/next-on-pages@1 --watch`,
60950
- "pages:dev": `${npx3} wrangler pages dev .vercel/output/static --compatibility-flag=nodejs_compat`
60951
- },
60967
+ "pages:dev": `${npx3} wrangler pages dev .vercel/output/static ${await compatDateFlag()} --compatibility-flag=nodejs_compat`
60968
+ }),
60952
60969
  testFlags: [
60953
60970
  "--typescript",
60954
60971
  "--no-install",
@@ -60983,11 +61000,11 @@ var config7 = {
60983
61000
  generate: generate7,
60984
61001
  configure: configure4,
60985
61002
  displayName: "Nuxt",
60986
- packageScripts: {
61003
+ getPackageScripts: async () => ({
60987
61004
  build: (cmd) => `NITRO_PRESET=cloudflare-pages ${cmd}`,
60988
- "pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm5} run dev`,
61005
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm5} run dev`,
60989
61006
  "pages:deploy": `${npm5} run build && wrangler pages deploy ./dist`
60990
- }
61007
+ })
60991
61008
  };
60992
61009
  var nuxt_default = config7;
60993
61010
 
@@ -61001,17 +61018,17 @@ var package_default = {
61001
61018
  ],
61002
61019
  dependencies: {
61003
61020
  "@angular/cli": "16.2.2",
61004
- "create-astro": "4.2.1",
61021
+ "create-astro": "4.3.0",
61005
61022
  "create-docusaurus": "2.4.3",
61006
- "create-hono": "0.2.6",
61023
+ "create-hono": "0.3.1",
61007
61024
  "create-next-app": "13.4.19",
61008
- "create-qwik": "1.2.12",
61025
+ "create-qwik": "1.2.13",
61009
61026
  "create-react-app": "5.0.1",
61010
- "create-remix": "2.0.1",
61011
- "create-solid": "0.3.6",
61012
- "create-svelte": "5.1.0",
61027
+ "create-remix": "2.1.0",
61028
+ "create-solid": "0.3.7",
61029
+ "create-svelte": "5.1.1",
61013
61030
  "create-vue": "3.7.5",
61014
- gatsby: "5.12.4",
61031
+ gatsby: "5.12.7",
61015
61032
  nuxi: "3.9.0"
61016
61033
  },
61017
61034
  frameworkCliMap: {
@@ -61048,10 +61065,10 @@ var config8 = {
61048
61065
  generate: generate8,
61049
61066
  configure: configure5,
61050
61067
  displayName: "Qwik",
61051
- packageScripts: {
61052
- "pages:dev": `wrangler pages dev ${compatDateFlag()} -- ${npm6} run dev`,
61068
+ getPackageScripts: async () => ({
61069
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} -- ${npm6} run dev`,
61053
61070
  "pages:deploy": `${npm6} run build && wrangler pages deploy ./dist`
61054
- }
61071
+ })
61055
61072
  };
61056
61073
  var qwik_default = config8;
61057
61074
 
@@ -61069,10 +61086,10 @@ var config9 = {
61069
61086
  generate: generate9,
61070
61087
  configure: configure6,
61071
61088
  displayName: "React",
61072
- packageScripts: {
61073
- "pages:dev": `wrangler pages dev ${compatDateFlag()} --port 3000 -- ${npm7} start`,
61089
+ getPackageScripts: async () => ({
61090
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} --port 3000 -- ${npm7} start`,
61074
61091
  "pages:deploy": `${npm7} run build && wrangler pages deploy ./build`
61075
- }
61092
+ })
61076
61093
  };
61077
61094
  var react_default = config9;
61078
61095
 
@@ -61089,9 +61106,9 @@ var generate10 = async (ctx) => {
61089
61106
  var config10 = {
61090
61107
  generate: generate10,
61091
61108
  displayName: "Remix",
61092
- packageScripts: {
61109
+ getPackageScripts: async () => ({
61093
61110
  "pages:deploy": `${npm8} run build && wrangler pages deploy ./public`
61094
- },
61111
+ }),
61095
61112
  devCommand: "dev",
61096
61113
  testFlags: ["--typescript", "--no-install", "--no-git-init"]
61097
61114
  };
@@ -61133,10 +61150,10 @@ var config11 = {
61133
61150
  generate: generate11,
61134
61151
  configure: configure7,
61135
61152
  displayName: "Solid",
61136
- packageScripts: {
61137
- "pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
61153
+ getPackageScripts: async () => ({
61154
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
61138
61155
  "pages:deploy": `${npm9} run build && wrangler pages deploy ./dist/public`
61139
- }
61156
+ })
61140
61157
  };
61141
61158
  var solid_default = config11;
61142
61159
 
@@ -61230,10 +61247,10 @@ var config12 = {
61230
61247
  generate: generate12,
61231
61248
  configure: configure8,
61232
61249
  displayName: "Svelte",
61233
- packageScripts: {
61234
- "pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 5173 -- ${npm10} run dev`,
61250
+ getPackageScripts: async () => ({
61251
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 5173 -- ${npm10} run dev`,
61235
61252
  "pages:deploy": `${npm10} run build && wrangler pages deploy .svelte-kit/cloudflare`
61236
- }
61253
+ })
61237
61254
  };
61238
61255
  var svelte_default = config12;
61239
61256
 
@@ -61246,10 +61263,10 @@ var generate13 = async (ctx) => {
61246
61263
  var config13 = {
61247
61264
  generate: generate13,
61248
61265
  displayName: "Vue",
61249
- packageScripts: {
61250
- "pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 5173 -- ${npm11} run dev`,
61266
+ getPackageScripts: async () => ({
61267
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 5173 -- ${npm11} run dev`,
61251
61268
  "pages:deploy": `${npm11} run build && wrangler pages deploy ./dist`
61252
- },
61269
+ }),
61253
61270
  testFlags: ["--ts"]
61254
61271
  };
61255
61272
  var vue_default = config13;
@@ -61387,21 +61404,35 @@ function secondsSince(start) {
61387
61404
  }
61388
61405
 
61389
61406
  // ../wrangler/package.json
61390
- var version2 = "3.11.0";
61407
+ var version2 = "3.13.2";
61391
61408
 
61392
61409
  // src/common.ts
61393
61410
  var { name, npm: npm12 } = detectPackageManager();
61394
- var validateProjectDirectory = (relativePath) => {
61411
+ var validateProjectDirectory = (relativePath, args) => {
61395
61412
  const path3 = (0, import_path7.resolve)(relativePath);
61396
61413
  const existsAlready = (0, import_fs8.existsSync)(path3);
61397
61414
  const isEmpty = existsAlready && (0, import_fs8.readdirSync)(path3).length === 0;
61398
61415
  if (existsAlready && !isEmpty) {
61399
61416
  return `Directory \`${relativePath}\` already exists and is not empty. Please choose a new name.`;
61400
61417
  }
61418
+ if (!args.existingScript) {
61419
+ const projectName = (0, import_path7.basename)(path3);
61420
+ const invalidChars = /[^a-z0-9-]/;
61421
+ const invalidStartEnd = /^-|-$/;
61422
+ if (projectName.match(invalidStartEnd)) {
61423
+ return `Project names cannot start or end with a dash.`;
61424
+ }
61425
+ if (projectName.match(invalidChars)) {
61426
+ return `Project names must only contain lowercase characters, numbers, and dashes.`;
61427
+ }
61428
+ if (projectName.length > 58) {
61429
+ return `Project names must be less than 58 characters.`;
61430
+ }
61431
+ }
61401
61432
  };
61402
61433
  var setupProjectDirectory = (args) => {
61403
61434
  const path3 = (0, import_path7.resolve)(args.projectName);
61404
- const err = validateProjectDirectory(path3);
61435
+ const err = validateProjectDirectory(path3, args);
61405
61436
  if (err) {
61406
61437
  crash(err);
61407
61438
  }
@@ -61507,7 +61538,10 @@ var chooseAccount = async (ctx) => {
61507
61538
  };
61508
61539
  var printSummary = async (ctx) => {
61509
61540
  const nextSteps = [
61510
- [`Navigate to the new directory`, `cd ${ctx.project.name}`],
61541
+ [
61542
+ `Navigate to the new directory`,
61543
+ `cd ${quote([(0, import_path7.relative)(ctx.originalCWD, ctx.project.path)])}`
61544
+ ],
61511
61545
  [
61512
61546
  `Run the development server`,
61513
61547
  `${npm12} run ${ctx.framework?.config.devCommand ?? "start"}`
@@ -61568,6 +61602,16 @@ var offerGit = async (ctx) => {
61568
61602
  ctx.args.git = false;
61569
61603
  return;
61570
61604
  }
61605
+ const gitConfigured = await isGitConfigured();
61606
+ if (!gitConfigured) {
61607
+ if (ctx.args.git) {
61608
+ updateStatus(
61609
+ "Must configure `user.name` and user.email` to use git. Continuing without git."
61610
+ );
61611
+ }
61612
+ ctx.args.git = false;
61613
+ return;
61614
+ }
61571
61615
  const insideGitRepo = await isInsideGitRepo(ctx.project.path);
61572
61616
  if (insideGitRepo)
61573
61617
  return;
@@ -61649,6 +61693,25 @@ async function getGitVersion() {
61649
61693
  async function isGitInstalled() {
61650
61694
  return await getGitVersion() !== null;
61651
61695
  }
61696
+ async function isGitConfigured() {
61697
+ try {
61698
+ const userName = await runCommand("git config user.name", {
61699
+ useSpinner: false,
61700
+ silent: true
61701
+ });
61702
+ if (!userName)
61703
+ return false;
61704
+ const email = await runCommand("git config user.email", {
61705
+ useSpinner: false,
61706
+ silent: true
61707
+ });
61708
+ if (!email)
61709
+ return false;
61710
+ return true;
61711
+ } catch {
61712
+ return false;
61713
+ }
61714
+ }
61652
61715
  async function isInsideGitRepo(cwd) {
61653
61716
  try {
61654
61717
  const output = await runCommand("git status", {
@@ -61705,6 +61768,7 @@ var defaultFrameworkConfig = {
61705
61768
  devCommand: "pages:dev"
61706
61769
  };
61707
61770
  var runPagesGenerator = async (args) => {
61771
+ const originalCWD = process.cwd();
61708
61772
  const { name: name2, path: path3 } = setupProjectDirectory(args);
61709
61773
  const framework = await getFrameworkSelection(args);
61710
61774
  const frameworkConfig = FrameworkMap[framework];
@@ -61722,7 +61786,8 @@ var runPagesGenerator = async (args) => {
61722
61786
  args: args.additionalArgs ?? []
61723
61787
  },
61724
61788
  args,
61725
- type: frameworkConfig.type
61789
+ type: frameworkConfig.type,
61790
+ originalCWD
61726
61791
  };
61727
61792
  const { generate: generate14, configure: configure9 } = FrameworkMap[framework];
61728
61793
  await generate14({ ...ctx });
@@ -61762,7 +61827,8 @@ var getFrameworkSelection = async (args) => {
61762
61827
  var updatePackageScripts = async (ctx) => {
61763
61828
  (0, import_process3.chdir)(ctx.project.path);
61764
61829
  await installWrangler();
61765
- const { packageScripts } = ctx.framework?.config ?? {};
61830
+ const { getPackageScripts } = ctx.framework?.config ?? {};
61831
+ const packageScripts = getPackageScripts ? await getPackageScripts() : {};
61766
61832
  if (packageScripts) {
61767
61833
  const s = spinner();
61768
61834
  const updatingScripts = Object.entries(packageScripts).filter(
@@ -61809,7 +61875,15 @@ var createProject = async (ctx) => {
61809
61875
  const productionBranch = await getProductionBranch(ctx.project.path);
61810
61876
  const cmd = `${npx5} wrangler pages project create ${ctx.project.name} --production-branch ${productionBranch} ${compatFlagsArg}`;
61811
61877
  await retry(
61812
- CREATE_PROJECT_RETRIES,
61878
+ {
61879
+ times: CREATE_PROJECT_RETRIES,
61880
+ exitCondition: (e) => {
61881
+ return e instanceof Error && // if the error is regarding name duplication we can exist as retrying is not going to help
61882
+ e.message.includes(
61883
+ "A project with this name already exists. Choose a different project name."
61884
+ );
61885
+ }
61886
+ },
61813
61887
  async () => runCommand(cmd, {
61814
61888
  // Make this command more verbose in test mode to aid
61815
61889
  // troubleshooting API errors
@@ -61826,7 +61900,7 @@ var createProject = async (ctx) => {
61826
61900
  try {
61827
61901
  const verifyProject = `${npx5} wrangler pages deployment list --project-name ${ctx.project.name}`;
61828
61902
  await retry(
61829
- VERIFY_PROJECT_RETRIES,
61903
+ { times: VERIFY_PROJECT_RETRIES },
61830
61904
  async () => runCommand(verifyProject, {
61831
61905
  silent: process.env.VITEST == void 0,
61832
61906
  cwd: ctx.project.path,
@@ -61848,11 +61922,14 @@ var import_promises2 = require("fs/promises");
61848
61922
  var import_os = require("os");
61849
61923
  var import_path9 = require("path");
61850
61924
  var import_process4 = require("process");
61925
+ var { dlx: dlx14 } = detectPackageManager();
61851
61926
  var runWorkersGenerator = async (args) => {
61927
+ const originalCWD = process.cwd();
61852
61928
  const { name: name2, path: path3 } = setupProjectDirectory(args);
61853
61929
  const ctx = {
61854
61930
  project: { name: name2, path: path3 },
61855
- args
61931
+ args,
61932
+ originalCWD
61856
61933
  };
61857
61934
  ctx.args.ts = await processArgument(ctx.args, "ts", {
61858
61935
  type: "confirm",
@@ -61914,7 +61991,7 @@ async function copyExistingWorkerFiles(ctx) {
61914
61991
  (0, import_path9.join)((0, import_os.tmpdir)(), "c3-wrangler-init--from-dash-")
61915
61992
  );
61916
61993
  await runCommand(
61917
- `npx wrangler@3 init --from-dash ${ctx.args.existingScript} -y --no-delegate-c3`,
61994
+ `${dlx14} wrangler@3 init --from-dash ${ctx.args.existingScript} -y --no-delegate-c3`,
61918
61995
  {
61919
61996
  silent: true,
61920
61997
  cwd: tempdir,
@@ -62024,6 +62101,10 @@ var parseArgs = async (argv) => {
62024
62101
  }).option("accept-defaults", {
62025
62102
  alias: "y",
62026
62103
  type: "boolean"
62104
+ }).option("auto-update", {
62105
+ type: "boolean",
62106
+ default: C3_DEFAULTS.autoUpdate,
62107
+ description: "Automatically uses the latest version of `create-cloudflare`. Set --no-auto-update to disable"
62027
62108
  }).option("wrangler-defaults", { type: "boolean", hidden: true }).version(version).strictOptions().alias("h", "help").help();
62028
62109
  const args = await yargsObj.argv;
62029
62110
  const positionalArgs = args._;
@@ -62044,7 +62125,10 @@ var processArgument = async (args, name2, promptConfig) => {
62044
62125
  let value = args[name2];
62045
62126
  const renderSubmitted = getRenderers(promptConfig).submit;
62046
62127
  if (value !== void 0) {
62047
- promptConfig.validate?.(value);
62128
+ const error = promptConfig.validate?.(value);
62129
+ if (error) {
62130
+ crash(error);
62131
+ }
62048
62132
  const lines = renderSubmitted({ value });
62049
62133
  logRaw(lines.join("\n"));
62050
62134
  return value;
@@ -62082,7 +62166,8 @@ var isUpdateAvailable = async () => {
62082
62166
  };
62083
62167
  var runLatest = async () => {
62084
62168
  const args = process.argv.slice(2);
62085
- await runCommand(`${npm13} create cloudflare@latest ${args.join(" ")}`);
62169
+ const argString = npm13 === "npm" ? `-- ${args.join(" ")}` : `${args.join(" ")}`;
62170
+ await runCommand(`${npm13} create cloudflare@latest ${argString}`);
62086
62171
  };
62087
62172
  var runCli = async (args) => {
62088
62173
  printBanner();
@@ -62092,7 +62177,7 @@ var runCli = async (args) => {
62092
62177
  helpText: "also used as application name",
62093
62178
  defaultValue: C3_DEFAULTS.projectName,
62094
62179
  label: "dir",
62095
- validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName),
62180
+ validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName, args),
62096
62181
  format: (val) => `./${val}`
62097
62182
  });
62098
62183
  if (!args.type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "0.0.0-97750430",
3
+ "version": "0.0.0-980df048",
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.11.0"
69
+ "wrangler": "3.13.2"
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=18.14.1"
@@ -35,7 +35,7 @@ compatibility_date = "<TBD>"
35
35
  # Docs: https://developers.cloudflare.com/workers/platform/services
36
36
  # [[services]]
37
37
  # binding = "MY_SERVICE"
38
- # service = "/api/*"
38
+ # service = "my-service"
39
39
 
40
40
  # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
41
41
  # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
@@ -35,7 +35,7 @@ compatibility_date = "<TBD>"
35
35
  # Docs: https://developers.cloudflare.com/workers/platform/services
36
36
  # [[services]]
37
37
  # binding = "MY_SERVICE"
38
- # service = "/api/*"
38
+ # service = "my-service"
39
39
 
40
40
  # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
41
41
  # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
@@ -35,7 +35,7 @@ compatibility_date = "<TBD>"
35
35
  # Docs: https://developers.cloudflare.com/workers/platform/services
36
36
  # [[services]]
37
37
  # binding = "MY_SERVICE"
38
- # service = "/api/*"
38
+ # service = "my-service"
39
39
 
40
40
  # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
41
41
  # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
@@ -35,7 +35,7 @@ compatibility_date = "<TBD>"
35
35
  # Docs: https://developers.cloudflare.com/workers/platform/services
36
36
  # [[services]]
37
37
  # binding = "MY_SERVICE"
38
- # service = "/api/*"
38
+ # service = "my-service"
39
39
 
40
40
  # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
41
41
  # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.