create-cloudflare 0.0.0-c370026d → 0.0.0-c37d94b5

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.
Files changed (2) hide show
  1. package/dist/cli.js +153 -24
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -62163,7 +62163,7 @@ var Yargs = YargsFactory(esm_default);
62163
62163
  var yargs_default = Yargs;
62164
62164
 
62165
62165
  // package.json
62166
- var version = "0.0.0-c370026d";
62166
+ var version = "0.0.0-c37d94b5";
62167
62167
  var devDependencies = {
62168
62168
  "@babel/parser": "^7.21.3",
62169
62169
  "@babel/types": "^7.21.4",
@@ -62430,7 +62430,7 @@ function secondsSince(start) {
62430
62430
  var import_shell_quote = __toESM(require_shell_quote());
62431
62431
 
62432
62432
  // ../wrangler/package.json
62433
- var version2 = "3.22.1";
62433
+ var version2 = "3.22.4";
62434
62434
 
62435
62435
  // src/common.ts
62436
62436
  var { name, npm } = detectPackageManager();
@@ -63151,14 +63151,13 @@ var readJSON = (path3) => {
63151
63151
  var writeJSON = (path3, object, stringifySpace = 2) => {
63152
63152
  writeFile2(path3, JSON.stringify(object, null, stringifySpace));
63153
63153
  };
63154
- var probePaths = (paths, errorMsg = "Failed to find required file.") => {
63154
+ var probePaths = (paths) => {
63155
63155
  for (const path3 of paths) {
63156
63156
  if ((0, import_fs7.existsSync)(path3)) {
63157
63157
  return path3;
63158
63158
  }
63159
63159
  }
63160
- crash(errorMsg);
63161
- process.exit(1);
63160
+ return null;
63162
63161
  };
63163
63162
  var usesTypescript = (projectRoot = ".") => {
63164
63163
  return (0, import_fs7.existsSync)(`${projectRoot}/tsconfig.json`);
@@ -63424,6 +63423,126 @@ export async function GET(request) {
63424
63423
  return new Response(JSON.stringify({ name: 'John Doe' }))
63425
63424
  }
63426
63425
  `;
63426
+ var appDirNotFoundJs = `
63427
+ export const runtime = "edge";
63428
+
63429
+ export default function NotFound() {
63430
+ return (
63431
+ <>
63432
+ <title>404: This page could not be found.</title>
63433
+ <div style={styles.error}>
63434
+ <div>
63435
+ <style
63436
+ dangerouslySetInnerHTML={{
63437
+ __html: \`body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\`,
63438
+ }}
63439
+ />
63440
+ <h1 className="next-error-h1" style={styles.h1}>
63441
+ 404
63442
+ </h1>
63443
+ <div style={styles.desc}>
63444
+ <h2 style={styles.h2}>This page could not be found.</h2>
63445
+ </div>
63446
+ </div>
63447
+ </div>
63448
+ </>
63449
+ );
63450
+ }
63451
+
63452
+ const styles = {
63453
+ error: {
63454
+ fontFamily:
63455
+ 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
63456
+ height: "100vh",
63457
+ textAlign: "center",
63458
+ display: "flex",
63459
+ flexDirection: "column",
63460
+ alignItems: "center",
63461
+ justifyContent: "center",
63462
+ },
63463
+
63464
+ desc: {
63465
+ display: "inline-block",
63466
+ },
63467
+
63468
+ h1: {
63469
+ display: "inline-block",
63470
+ margin: "0 20px 0 0",
63471
+ padding: "0 23px 0 0",
63472
+ fontSize: 24,
63473
+ fontWeight: 500,
63474
+ verticalAlign: "top",
63475
+ lineHeight: "49px",
63476
+ },
63477
+
63478
+ h2: {
63479
+ fontSize: 14,
63480
+ fontWeight: 400,
63481
+ lineHeight: "49px",
63482
+ margin: 0,
63483
+ },
63484
+ };
63485
+ `;
63486
+ var appDirNotFoundTs = `
63487
+ export const runtime = "edge";
63488
+
63489
+ export default function NotFound() {
63490
+ return (
63491
+ <>
63492
+ <title>404: This page could not be found.</title>
63493
+ <div style={styles.error}>
63494
+ <div>
63495
+ <style
63496
+ dangerouslySetInnerHTML={{
63497
+ __html: \`body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\`,
63498
+ }}
63499
+ />
63500
+ <h1 className="next-error-h1" style={styles.h1}>
63501
+ 404
63502
+ </h1>
63503
+ <div style={styles.desc}>
63504
+ <h2 style={styles.h2}>This page could not be found.</h2>
63505
+ </div>
63506
+ </div>
63507
+ </div>
63508
+ </>
63509
+ );
63510
+ }
63511
+
63512
+ const styles = {
63513
+ error: {
63514
+ fontFamily:
63515
+ 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
63516
+ height: "100vh",
63517
+ textAlign: "center",
63518
+ display: "flex",
63519
+ flexDirection: "column",
63520
+ alignItems: "center",
63521
+ justifyContent: "center",
63522
+ },
63523
+
63524
+ desc: {
63525
+ display: "inline-block",
63526
+ },
63527
+
63528
+ h1: {
63529
+ display: "inline-block",
63530
+ margin: "0 20px 0 0",
63531
+ padding: "0 23px 0 0",
63532
+ fontSize: 24,
63533
+ fontWeight: 500,
63534
+ verticalAlign: "top",
63535
+ lineHeight: "49px",
63536
+ },
63537
+
63538
+ h2: {
63539
+ fontSize: 14,
63540
+ fontWeight: 400,
63541
+ lineHeight: "49px",
63542
+ margin: 0,
63543
+ },
63544
+ } as const;
63545
+ `;
63427
63546
 
63428
63547
  // src/frameworks/next/index.ts
63429
63548
  var { npm: npm5, npx: npx2 } = detectPackageManager();
@@ -63442,22 +63561,32 @@ var getApiTemplate = (apiPath, isTypescript) => {
63442
63561
  };
63443
63562
  var configure3 = async (ctx) => {
63444
63563
  const projectName = ctx.project.name;
63445
- const path3 = probePaths(
63446
- [
63447
- `${projectName}/pages/api`,
63448
- `${projectName}/src/pages/api`,
63449
- `${projectName}/src/app/api`,
63450
- `${projectName}/app/api`,
63451
- `${projectName}/src/app`,
63452
- `${projectName}/app`
63453
- ],
63454
- "Could not find the `/api` or `/app` directory"
63455
- );
63564
+ const path3 = probePaths([
63565
+ `${projectName}/pages/api`,
63566
+ `${projectName}/src/pages/api`,
63567
+ `${projectName}/src/app/api`,
63568
+ `${projectName}/app/api`,
63569
+ `${projectName}/src/app`,
63570
+ `${projectName}/app`
63571
+ ]);
63572
+ if (!path3) {
63573
+ crash("Could not find the `/api` or `/app` directory");
63574
+ }
63456
63575
  const apiPath = path3.replace(/\/app$/, "/app/api");
63457
- const [handlerPath, handlerFile] = getApiTemplate(
63458
- apiPath,
63459
- usesTypescript(projectName)
63460
- );
63576
+ const usesTs = usesTypescript(projectName);
63577
+ const appDirPath = probePaths([
63578
+ `${projectName}/src/app`,
63579
+ `${projectName}/app`
63580
+ ]);
63581
+ if (appDirPath) {
63582
+ const notFoundPath = `${appDirPath}/not-found.${usesTs ? "tsx" : "js"}`;
63583
+ if (!(0, import_fs8.existsSync)(notFoundPath)) {
63584
+ const notFoundContent = usesTs ? appDirNotFoundTs : appDirNotFoundJs;
63585
+ writeFile2(notFoundPath, notFoundContent);
63586
+ updateStatus("Created a custom edge not-found route");
63587
+ }
63588
+ }
63589
+ const [handlerPath, handlerFile] = getApiTemplate(apiPath, usesTs);
63461
63590
  writeFile2(handlerPath, handlerFile);
63462
63591
  updateStatus("Created an example API route handler");
63463
63592
  const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
@@ -63602,7 +63731,7 @@ var package_default = {
63602
63731
  "create-solid": "0.3.10",
63603
63732
  "create-svelte": "6.0.5",
63604
63733
  "create-vue": "3.9.1",
63605
- gatsby: "5.12.12",
63734
+ gatsby: "5.13.1",
63606
63735
  nuxi: "3.10.0"
63607
63736
  },
63608
63737
  frameworkCliMap: {
@@ -63857,7 +63986,7 @@ var supportedFramework = (framework) => {
63857
63986
  };
63858
63987
  var getFrameworkCli = (ctx, withVersion = true) => {
63859
63988
  if (!ctx.framework) {
63860
- return crash("Framework not specified.");
63989
+ crash("Framework not specified.");
63861
63990
  }
63862
63991
  const framework = ctx.framework.name;
63863
63992
  const frameworkCli = package_default.frameworkCliMap[framework];
@@ -64441,10 +64570,10 @@ var runCli = async (args) => {
64441
64570
  defaultValue: C3_DEFAULTS.type
64442
64571
  });
64443
64572
  if (!type) {
64444
- return crash("An application type must be specified to continue.");
64573
+ crash("An application type must be specified to continue.");
64445
64574
  }
64446
64575
  if (!Object.keys(templateMap).includes(type)) {
64447
- return crash(`Unknown application type provided: ${type}.`);
64576
+ crash(`Unknown application type provided: ${type}.`);
64448
64577
  }
64449
64578
  const validatedArgs = {
64450
64579
  ...args,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "0.0.0-c370026d",
3
+ "version": "0.0.0-c37d94b5",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -64,7 +64,7 @@
64
64
  "yarn": "^1.22.19",
65
65
  "@cloudflare/cli": "1.0.0",
66
66
  "@cloudflare/workers-tsconfig": "0.0.0",
67
- "wrangler": "3.22.1"
67
+ "wrangler": "3.22.4"
68
68
  },
69
69
  "engines": {
70
70
  "node": ">=18.14.1"