create-cloudflare 0.0.0-64631d8b → 0.0.0-70a54e97

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
@@ -53155,8 +53155,6 @@ var space = (n = 1) => {
53155
53155
  return hidden("\u200A".repeat(n));
53156
53156
  };
53157
53157
  var logRaw = (msg) => {
53158
- if (process.env.VITEST)
53159
- return;
53160
53158
  process.stdout.write(`${msg}
53161
53159
  `);
53162
53160
  };
@@ -59412,7 +59410,7 @@ var Yargs = YargsFactory(esm_default);
59412
59410
  var yargs_default = Yargs;
59413
59411
 
59414
59412
  // package.json
59415
- var version = "0.0.0-64631d8b";
59413
+ var version = "0.0.0-70a54e97";
59416
59414
 
59417
59415
  // src/common.ts
59418
59416
  var import_fs6 = require("fs");
@@ -59473,15 +59471,14 @@ var runCommand = async (command2, opts = {}) => {
59473
59471
  }
59474
59472
  return printAsyncStatus({
59475
59473
  useSpinner: opts.useSpinner ?? opts.silent,
59476
- startText: opts.startText || command2.join(" "),
59474
+ startText: opts.startText || command2.join(" ").trim(),
59477
59475
  doneText: opts.doneText,
59478
59476
  promise() {
59479
59477
  const [executable, ...args] = command2;
59480
- const squelch = opts.silent || process.env.VITEST;
59481
59478
  const cmd = (0, import_cross_spawn.spawn)(executable, [...args], {
59482
59479
  // TODO: ideally inherit stderr, but npm install uses this for warnings
59483
59480
  // stdio: [ioMode, ioMode, "inherit"],
59484
- stdio: squelch ? "pipe" : "inherit",
59481
+ stdio: opts.silent ? "pipe" : "inherit",
59485
59482
  env: {
59486
59483
  ...process.env,
59487
59484
  ...opts.env
@@ -59489,7 +59486,7 @@ var runCommand = async (command2, opts = {}) => {
59489
59486
  cwd: opts.cwd
59490
59487
  });
59491
59488
  let output = ``;
59492
- if (opts?.captureOutput ?? squelch) {
59489
+ if (opts.captureOutput ?? opts.silent) {
59493
59490
  cmd.stdout?.on("data", (data) => {
59494
59491
  output += data;
59495
59492
  });
@@ -59514,6 +59511,9 @@ var runCommand = async (command2, opts = {}) => {
59514
59511
  }
59515
59512
  }
59516
59513
  });
59514
+ cmd.on("error", (code) => {
59515
+ reject(code);
59516
+ });
59517
59517
  });
59518
59518
  }
59519
59519
  });
@@ -59624,10 +59624,14 @@ var installWrangler = async () => {
59624
59624
  };
59625
59625
  var isLoggedIn = async () => {
59626
59626
  const { npx: npx6 } = detectPackageManager();
59627
- const output = await runCommand(`${npx6} wrangler whoami`, {
59628
- silent: true
59629
- });
59630
- return !/not authenticated/.test(output);
59627
+ try {
59628
+ const output = await runCommand(`${npx6} wrangler whoami`, {
59629
+ silent: true
59630
+ });
59631
+ return /You are logged in/.test(output);
59632
+ } catch (error) {
59633
+ return false;
59634
+ }
59631
59635
  };
59632
59636
  var wranglerLogin = async () => {
59633
59637
  const { npx: npx6 } = detectPackageManager();
@@ -59846,7 +59850,7 @@ var chooseAccount = async (ctx) => {
59846
59850
  };
59847
59851
  var printSummary = async (ctx) => {
59848
59852
  const nextSteps = [
59849
- [`Navigate to the new directory:`, `cd ${ctx.project.name}`],
59853
+ [`Navigate to the new directory`, `cd ${ctx.project.name}`],
59850
59854
  [
59851
59855
  `Run the development server`,
59852
59856
  `${npm} run ${ctx.framework?.config.devCommand ?? "start"}`
@@ -59973,6 +59977,24 @@ async function initializeGit(cwd) {
59973
59977
  await runCommand(`git init`, { useSpinner: false, silent: true, cwd });
59974
59978
  }
59975
59979
  }
59980
+ async function getProductionBranch(cwd) {
59981
+ try {
59982
+ const productionBranch = await runCommand(
59983
+ // "git branch --show-current", // git@^2.22
59984
+ "git rev-parse --abbrev-ref HEAD",
59985
+ // git@^1.6.3
59986
+ {
59987
+ silent: true,
59988
+ cwd,
59989
+ useSpinner: false,
59990
+ captureOutput: true
59991
+ }
59992
+ );
59993
+ return productionBranch.trim();
59994
+ } catch (err) {
59995
+ }
59996
+ return "main";
59997
+ }
59976
59998
 
59977
59999
  // src/pages.ts
59978
60000
  var import_path8 = require("path");
@@ -60486,7 +60508,7 @@ var config11 = {
60486
60508
  displayName: "Solid",
60487
60509
  packageScripts: {
60488
60510
  "pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
60489
- "pages:deploy": `${npm9} run build build && wrangler pages deploy ./dist/public`
60511
+ "pages:deploy": `${npm9} run build && wrangler pages deploy ./dist/public`
60490
60512
  }
60491
60513
  };
60492
60514
  var solid_default = config11;
@@ -60741,7 +60763,8 @@ var createProject = async (ctx) => {
60741
60763
  const CLOUDFLARE_ACCOUNT_ID = ctx.account.id;
60742
60764
  const compatFlags = ctx.framework?.config.compatibilityFlags?.join(" ");
60743
60765
  const compatFlagsArg = compatFlags ? `--compatibility-flags ${compatFlags}` : "";
60744
- const cmd = `${npx5} wrangler pages project create ${ctx.project.name} --production-branch main ${compatFlagsArg}`;
60766
+ const productionBranch = await getProductionBranch(ctx.project.path);
60767
+ const cmd = `${npx5} wrangler pages project create ${ctx.project.name} --production-branch ${productionBranch} ${compatFlagsArg}`;
60745
60768
  try {
60746
60769
  await retry(
60747
60770
  CREATE_PROJECT_RETRIES,
@@ -60750,7 +60773,7 @@ var createProject = async (ctx) => {
60750
60773
  cwd: ctx.project.path,
60751
60774
  env: { CLOUDFLARE_ACCOUNT_ID },
60752
60775
  startText: "Creating Pages project",
60753
- doneText: `${brandColor("created")} ${dim(`via \`${cmd}\``)}`
60776
+ doneText: `${brandColor("created")} ${dim(`via \`${cmd.trim()}\``)}`
60754
60777
  })
60755
60778
  );
60756
60779
  } catch (error) {
@@ -60784,14 +60807,12 @@ var runWorkersGenerator = async (args) => {
60784
60807
  await printSummary(ctx);
60785
60808
  };
60786
60809
  async function getTemplate(ctx) {
60787
- if (ctx.args.ts === void 0) {
60788
- ctx.args.ts = await processArgument(ctx.args, "ts", {
60789
- type: "confirm",
60790
- question: "Do you want to use TypeScript?",
60791
- label: "typescript",
60792
- defaultValue: C3_DEFAULTS.ts
60793
- });
60794
- }
60810
+ ctx.args.ts = await processArgument(ctx.args, "ts", {
60811
+ type: "confirm",
60812
+ question: "Do you want to use TypeScript?",
60813
+ label: "typescript",
60814
+ defaultValue: C3_DEFAULTS.ts
60815
+ });
60795
60816
  const preexisting = ctx.args.type === "pre-existing";
60796
60817
  const template = preexisting ? "hello-world" : ctx.args.type;
60797
60818
  const path3 = (0, import_path9.resolve)(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "0.0.0-64631d8b",
3
+ "version": "0.0.0-70a54e97",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -7,7 +7,6 @@
7
7
  "start": "wrangler dev"
8
8
  },
9
9
  "devDependencies": {
10
- "@cloudflare/workers-types": "^4.20230419.0",
11
10
  "itty-router": "^3.0.12",
12
11
  "wrangler": "^3.0.0"
13
12
  }
@@ -7,8 +7,6 @@
7
7
  "start": "wrangler dev"
8
8
  },
9
9
  "devDependencies": {
10
- "@cloudflare/workers-types": "^4.20230419.0",
11
- "typescript": "^5.0.4",
12
10
  "wrangler": "^3.0.0"
13
11
  }
14
12
  }
@@ -7,8 +7,6 @@
7
7
  "start": "wrangler dev"
8
8
  },
9
9
  "devDependencies": {
10
- "@cloudflare/workers-types": "^4.20230419.0",
11
- "typescript": "^5.0.4",
12
10
  "wrangler": "^3.0.0"
13
11
  }
14
12
  }
@@ -7,8 +7,6 @@
7
7
  "start": "wrangler dev"
8
8
  },
9
9
  "devDependencies": {
10
- "@cloudflare/workers-types": "^4.20230419.0",
11
- "typescript": "^5.0.4",
12
10
  "wrangler": "^3.0.0"
13
11
  }
14
12
  }