create-cloudflare 0.0.0-e72a5794 → 0.0.0-ec358f4f

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 +33 -19
  2. package/package.json +1 -1
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-e72a5794";
59413
+ var version = "0.0.0-ec358f4f";
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
  });
@@ -59853,7 +59850,7 @@ var chooseAccount = async (ctx) => {
59853
59850
  };
59854
59851
  var printSummary = async (ctx) => {
59855
59852
  const nextSteps = [
59856
- [`Navigate to the new directory:`, `cd ${ctx.project.name}`],
59853
+ [`Navigate to the new directory`, `cd ${ctx.project.name}`],
59857
59854
  [
59858
59855
  `Run the development server`,
59859
59856
  `${npm} run ${ctx.framework?.config.devCommand ?? "start"}`
@@ -59980,6 +59977,24 @@ async function initializeGit(cwd) {
59980
59977
  await runCommand(`git init`, { useSpinner: false, silent: true, cwd });
59981
59978
  }
59982
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
+ }
59983
59998
 
59984
59999
  // src/pages.ts
59985
60000
  var import_path8 = require("path");
@@ -60493,7 +60508,7 @@ var config11 = {
60493
60508
  displayName: "Solid",
60494
60509
  packageScripts: {
60495
60510
  "pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
60496
- "pages:deploy": `${npm9} run build build && wrangler pages deploy ./dist/public`
60511
+ "pages:deploy": `${npm9} run build && wrangler pages deploy ./dist/public`
60497
60512
  }
60498
60513
  };
60499
60514
  var solid_default = config11;
@@ -60748,7 +60763,8 @@ var createProject = async (ctx) => {
60748
60763
  const CLOUDFLARE_ACCOUNT_ID = ctx.account.id;
60749
60764
  const compatFlags = ctx.framework?.config.compatibilityFlags?.join(" ");
60750
60765
  const compatFlagsArg = compatFlags ? `--compatibility-flags ${compatFlags}` : "";
60751
- 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}`;
60752
60768
  try {
60753
60769
  await retry(
60754
60770
  CREATE_PROJECT_RETRIES,
@@ -60757,7 +60773,7 @@ var createProject = async (ctx) => {
60757
60773
  cwd: ctx.project.path,
60758
60774
  env: { CLOUDFLARE_ACCOUNT_ID },
60759
60775
  startText: "Creating Pages project",
60760
- doneText: `${brandColor("created")} ${dim(`via \`${cmd}\``)}`
60776
+ doneText: `${brandColor("created")} ${dim(`via \`${cmd.trim()}\``)}`
60761
60777
  })
60762
60778
  );
60763
60779
  } catch (error) {
@@ -60791,14 +60807,12 @@ var runWorkersGenerator = async (args) => {
60791
60807
  await printSummary(ctx);
60792
60808
  };
60793
60809
  async function getTemplate(ctx) {
60794
- if (ctx.args.ts === void 0) {
60795
- ctx.args.ts = await processArgument(ctx.args, "ts", {
60796
- type: "confirm",
60797
- question: "Do you want to use TypeScript?",
60798
- label: "typescript",
60799
- defaultValue: C3_DEFAULTS.ts
60800
- });
60801
- }
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
+ });
60802
60816
  const preexisting = ctx.args.type === "pre-existing";
60803
60817
  const template = preexisting ? "hello-world" : ctx.args.type;
60804
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-e72a5794",
3
+ "version": "0.0.0-ec358f4f",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",