create-cloudflare 2.21.2 → 2.21.3

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
@@ -3902,7 +3902,7 @@ var init_args = __esm({
3902
3902
  var version;
3903
3903
  var init_package = __esm({
3904
3904
  "package.json"() {
3905
- version = "2.21.2";
3905
+ version = "2.21.3";
3906
3906
  }
3907
3907
  });
3908
3908
 
@@ -24714,19 +24714,19 @@ var init_package2 = __esm({
24714
24714
  "additionally it also contains a map that maps frameworks to their respective clis"
24715
24715
  ],
24716
24716
  dependencies: {
24717
- "create-astro": "4.7.5",
24718
- "create-analog": "1.2.0",
24717
+ "create-astro": "4.8.0",
24718
+ "create-analog": "1.3.1",
24719
24719
  "@angular/create": "17.3.7",
24720
- "create-docusaurus": "3.1.1",
24721
- "create-hono": "0.7.0",
24720
+ "create-docusaurus": "3.3.2",
24721
+ "create-hono": "0.7.3",
24722
24722
  "create-next-app": "14.1.0",
24723
24723
  "create-qwik": "1.5.4",
24724
24724
  "create-react-app": "5.0.1",
24725
- "create-remix": "2.8.1",
24725
+ "create-remix": "2.9.2",
24726
24726
  "create-solid": "0.5.5",
24727
- "create-svelte": "6.0.10",
24727
+ "create-svelte": "6.1.2",
24728
24728
  "create-vue": "3.10.2",
24729
- gatsby: "5.13.4",
24729
+ gatsby: "5.13.5",
24730
24730
  nuxi: "3.11.1"
24731
24731
  },
24732
24732
  frameworkCliMap: {
@@ -24757,6 +24757,7 @@ var init_frameworks = __esm({
24757
24757
  init_colors();
24758
24758
  init_command();
24759
24759
  init_packageManagers();
24760
+ init_git();
24760
24761
  init_package2();
24761
24762
  getFrameworkCli = (ctx, withVersion = true) => {
24762
24763
  if (!ctx.template) {
@@ -24782,6 +24783,222 @@ var init_frameworks = __esm({
24782
24783
  );
24783
24784
  logRaw("");
24784
24785
  await runCommand(cmd, { env: env2 });
24786
+ if (process.env.SAVE_DIFFS) {
24787
+ const cmdEnv = {
24788
+ silent: true,
24789
+ cwd: ctx.project.path
24790
+ };
24791
+ if (!isInsideGitRepo(ctx.project.path)) {
24792
+ await runCommand(["git", "init"], cmdEnv);
24793
+ await runCommand(["git", "add", "."], cmdEnv);
24794
+ const commitMessage = `Initial commit by ${cli}`;
24795
+ await runCommand(["git", "commit", "-m", commitMessage], cmdEnv);
24796
+ }
24797
+ }
24798
+ };
24799
+ }
24800
+ });
24801
+
24802
+ // ../wrangler/package.json
24803
+ var version2;
24804
+ var init_package3 = __esm({
24805
+ "../wrangler/package.json"() {
24806
+ version2 = "3.57.1";
24807
+ }
24808
+ });
24809
+
24810
+ // src/git.ts
24811
+ async function getGitVersion() {
24812
+ try {
24813
+ const rawGitVersion = await runCommand(["git", "--version"], {
24814
+ useSpinner: false,
24815
+ silent: true
24816
+ });
24817
+ const gitVersion = rawGitVersion.replace(/^git\s+version\s+/, "");
24818
+ return gitVersion;
24819
+ } catch {
24820
+ return null;
24821
+ }
24822
+ }
24823
+ async function isGitInstalled() {
24824
+ return await getGitVersion() !== null;
24825
+ }
24826
+ async function isGitConfigured() {
24827
+ try {
24828
+ const userName = await runCommand(["git", "config", "user.name"], {
24829
+ useSpinner: false,
24830
+ silent: true
24831
+ });
24832
+ if (!userName) {
24833
+ return false;
24834
+ }
24835
+ const email = await runCommand(["git", "config", "user.email"], {
24836
+ useSpinner: false,
24837
+ silent: true
24838
+ });
24839
+ if (!email) {
24840
+ return false;
24841
+ }
24842
+ return true;
24843
+ } catch {
24844
+ return false;
24845
+ }
24846
+ }
24847
+ async function isInsideGitRepo(cwd) {
24848
+ try {
24849
+ const output = await runCommand(["git", "status"], {
24850
+ cwd,
24851
+ useSpinner: false,
24852
+ silent: true,
24853
+ captureOutput: true
24854
+ });
24855
+ return output.includes("not a git repository") === false;
24856
+ } catch (err) {
24857
+ return false;
24858
+ }
24859
+ }
24860
+ async function initializeGit(cwd) {
24861
+ const s = spinner();
24862
+ s.start("Initializing git repo");
24863
+ try {
24864
+ const defaultBranchName = await runCommand(
24865
+ ["git", "config", "--get", "init.defaultBranch"],
24866
+ { useSpinner: false, silent: true, cwd }
24867
+ );
24868
+ await runCommand(
24869
+ ["git", "init", "--initial-branch", defaultBranchName.trim() ?? "main"],
24870
+ // branch names can't contain spaces, so this is safe
24871
+ { useSpinner: false, silent: true, cwd }
24872
+ );
24873
+ } catch {
24874
+ await runCommand(["git", "init"], { useSpinner: false, silent: true, cwd });
24875
+ } finally {
24876
+ s.stop(`${brandColor("initialized")} ${dim(`git`)}`);
24877
+ }
24878
+ }
24879
+ async function getProductionBranch(cwd) {
24880
+ try {
24881
+ const productionBranch = await runCommand(
24882
+ ["git", "branch", "--show-current"],
24883
+ {
24884
+ silent: true,
24885
+ cwd,
24886
+ useSpinner: false,
24887
+ captureOutput: true
24888
+ }
24889
+ );
24890
+ return productionBranch.trim();
24891
+ } catch (err) {
24892
+ }
24893
+ return "main";
24894
+ }
24895
+ var offerGit, gitCommit, createCommitMessage;
24896
+ var init_git = __esm({
24897
+ "src/git.ts"() {
24898
+ init_cli();
24899
+ init_args();
24900
+ init_colors();
24901
+ init_interactive();
24902
+ init_frameworks();
24903
+ init_cli2();
24904
+ init_command();
24905
+ init_packageManagers();
24906
+ init_package3();
24907
+ init_package();
24908
+ offerGit = async (ctx) => {
24909
+ const gitInstalled = await isGitInstalled();
24910
+ if (!gitInstalled) {
24911
+ if (ctx.args.git) {
24912
+ updateStatus(
24913
+ "Couldn't find `git` installed on your machine. Continuing without git."
24914
+ );
24915
+ }
24916
+ ctx.args.git = false;
24917
+ return;
24918
+ }
24919
+ const gitConfigured = await isGitConfigured();
24920
+ if (!gitConfigured) {
24921
+ if (ctx.args.git) {
24922
+ updateStatus(
24923
+ "Must configure `user.name` and user.email` to use git. Continuing without git."
24924
+ );
24925
+ }
24926
+ ctx.args.git = false;
24927
+ return;
24928
+ }
24929
+ const insideGitRepo = await isInsideGitRepo(ctx.project.path);
24930
+ if (insideGitRepo) {
24931
+ return;
24932
+ }
24933
+ ctx.args.git = await processArgument(ctx.args, "git", {
24934
+ type: "confirm",
24935
+ question: "Do you want to use git for version control?",
24936
+ label: "git",
24937
+ defaultValue: C3_DEFAULTS.git
24938
+ });
24939
+ if (ctx.args.git) {
24940
+ await initializeGit(ctx.project.path);
24941
+ }
24942
+ };
24943
+ gitCommit = async (ctx) => {
24944
+ const commitMessage = await createCommitMessage(ctx);
24945
+ if (!ctx.args.git) {
24946
+ return;
24947
+ }
24948
+ if (ctx.gitRepoAlreadyExisted) {
24949
+ return;
24950
+ }
24951
+ const gitInstalled = await isGitInstalled();
24952
+ const gitInitialized = await isInsideGitRepo(ctx.project.path);
24953
+ if (!gitInstalled || !gitInitialized) {
24954
+ return;
24955
+ }
24956
+ const s = spinner();
24957
+ s.start("Committing new files");
24958
+ await runCommand(["git", "add", "."], {
24959
+ silent: true,
24960
+ cwd: ctx.project.path
24961
+ });
24962
+ await runCommand(["git", "commit", "-m", commitMessage], {
24963
+ silent: true,
24964
+ cwd: ctx.project.path
24965
+ });
24966
+ s.stop(`${brandColor("git")} ${dim(`commit`)}`);
24967
+ };
24968
+ createCommitMessage = async (ctx) => {
24969
+ const isPages = ctx.template.platform === "pages";
24970
+ const header = isPages ? "Initialize web application via create-cloudflare CLI" : "Initial commit (by create-cloudflare CLI)";
24971
+ const packageManager = detectPackageManager();
24972
+ const gitVersion = await getGitVersion();
24973
+ const insideRepo = await isInsideGitRepo(ctx.project.path);
24974
+ const showFramework = isPages || ctx.template.id === "hono";
24975
+ const details = [
24976
+ { key: "C3", value: `create-cloudflare@${version}` },
24977
+ { key: "project name", value: ctx.project.name },
24978
+ ...showFramework ? [{ key: "framework", value: ctx.template.id }] : [],
24979
+ ...showFramework ? [{ key: "framework cli", value: getFrameworkCli(ctx) }] : [],
24980
+ {
24981
+ key: "package manager",
24982
+ value: `${packageManager.name}@${packageManager.version}`
24983
+ },
24984
+ {
24985
+ key: "wrangler",
24986
+ value: `wrangler@${version2}`
24987
+ },
24988
+ {
24989
+ key: "git",
24990
+ value: insideRepo ? gitVersion : "N/A"
24991
+ }
24992
+ ];
24993
+ const body = `Details:
24994
+ ${details.map(({ key, value }) => ` ${key} = ${value}`).join("\n")}
24995
+ `;
24996
+ const commitMessage = `${header}
24997
+
24998
+ ${body}
24999
+ `;
25000
+ ctx.commitMessage = commitMessage;
25001
+ return commitMessage;
24785
25002
  };
24786
25003
  }
24787
25004
  });
@@ -77948,200 +78165,7 @@ init_colors();
77948
78165
  init_cli2();
77949
78166
  init_command();
77950
78167
  init_packageManagers();
77951
-
77952
- // src/git.ts
77953
- init_cli();
77954
- init_args();
77955
- init_colors();
77956
- init_interactive();
77957
- init_frameworks();
77958
- init_cli2();
77959
- init_command();
77960
- init_packageManagers();
77961
-
77962
- // ../wrangler/package.json
77963
- var version2 = "3.57.0";
77964
-
77965
- // src/git.ts
77966
- init_package();
77967
- var offerGit = async (ctx) => {
77968
- const gitInstalled = await isGitInstalled();
77969
- if (!gitInstalled) {
77970
- if (ctx.args.git) {
77971
- updateStatus(
77972
- "Couldn't find `git` installed on your machine. Continuing without git."
77973
- );
77974
- }
77975
- ctx.args.git = false;
77976
- return;
77977
- }
77978
- const gitConfigured = await isGitConfigured();
77979
- if (!gitConfigured) {
77980
- if (ctx.args.git) {
77981
- updateStatus(
77982
- "Must configure `user.name` and user.email` to use git. Continuing without git."
77983
- );
77984
- }
77985
- ctx.args.git = false;
77986
- return;
77987
- }
77988
- const insideGitRepo = await isInsideGitRepo(ctx.project.path);
77989
- if (insideGitRepo) {
77990
- return;
77991
- }
77992
- ctx.args.git = await processArgument(ctx.args, "git", {
77993
- type: "confirm",
77994
- question: "Do you want to use git for version control?",
77995
- label: "git",
77996
- defaultValue: C3_DEFAULTS.git
77997
- });
77998
- if (ctx.args.git) {
77999
- await initializeGit(ctx.project.path);
78000
- }
78001
- };
78002
- var gitCommit = async (ctx) => {
78003
- const commitMessage = await createCommitMessage(ctx);
78004
- if (ctx.gitRepoAlreadyExisted) {
78005
- return;
78006
- }
78007
- const gitInstalled = await isGitInstalled();
78008
- const gitInitialized = await isInsideGitRepo(ctx.project.path);
78009
- if (!gitInstalled || !gitInitialized) {
78010
- return;
78011
- }
78012
- const s = spinner();
78013
- s.start("Committing new files");
78014
- await runCommand(["git", "add", "."], {
78015
- silent: true,
78016
- cwd: ctx.project.path
78017
- });
78018
- await runCommand(["git", "commit", "-m", commitMessage], {
78019
- silent: true,
78020
- cwd: ctx.project.path
78021
- });
78022
- s.stop(`${brandColor("git")} ${dim(`commit`)}`);
78023
- };
78024
- var createCommitMessage = async (ctx) => {
78025
- const isPages = ctx.template.platform === "pages";
78026
- const header = isPages ? "Initialize web application via create-cloudflare CLI" : "Initial commit (by create-cloudflare CLI)";
78027
- const packageManager = detectPackageManager();
78028
- const gitVersion = await getGitVersion();
78029
- const insideRepo = await isInsideGitRepo(ctx.project.path);
78030
- const showFramework = isPages || ctx.template.id === "hono";
78031
- const details = [
78032
- { key: "C3", value: `create-cloudflare@${version}` },
78033
- { key: "project name", value: ctx.project.name },
78034
- ...showFramework ? [{ key: "framework", value: ctx.template.id }] : [],
78035
- ...showFramework ? [{ key: "framework cli", value: getFrameworkCli(ctx) }] : [],
78036
- {
78037
- key: "package manager",
78038
- value: `${packageManager.name}@${packageManager.version}`
78039
- },
78040
- {
78041
- key: "wrangler",
78042
- value: `wrangler@${version2}`
78043
- },
78044
- {
78045
- key: "git",
78046
- value: insideRepo ? gitVersion : "N/A"
78047
- }
78048
- ];
78049
- const body = `Details:
78050
- ${details.map(({ key, value }) => ` ${key} = ${value}`).join("\n")}
78051
- `;
78052
- const commitMessage = `${header}
78053
-
78054
- ${body}
78055
- `;
78056
- ctx.commitMessage = commitMessage;
78057
- return commitMessage;
78058
- };
78059
- async function getGitVersion() {
78060
- try {
78061
- const rawGitVersion = await runCommand(["git", "--version"], {
78062
- useSpinner: false,
78063
- silent: true
78064
- });
78065
- const gitVersion = rawGitVersion.replace(/^git\s+version\s+/, "");
78066
- return gitVersion;
78067
- } catch {
78068
- return null;
78069
- }
78070
- }
78071
- async function isGitInstalled() {
78072
- return await getGitVersion() !== null;
78073
- }
78074
- async function isGitConfigured() {
78075
- try {
78076
- const userName = await runCommand(["git", "config", "user.name"], {
78077
- useSpinner: false,
78078
- silent: true
78079
- });
78080
- if (!userName) {
78081
- return false;
78082
- }
78083
- const email = await runCommand(["git", "config", "user.email"], {
78084
- useSpinner: false,
78085
- silent: true
78086
- });
78087
- if (!email) {
78088
- return false;
78089
- }
78090
- return true;
78091
- } catch {
78092
- return false;
78093
- }
78094
- }
78095
- async function isInsideGitRepo(cwd) {
78096
- try {
78097
- const output = await runCommand(["git", "status"], {
78098
- cwd,
78099
- useSpinner: false,
78100
- silent: true,
78101
- captureOutput: true
78102
- });
78103
- return output.includes("not a git repository") === false;
78104
- } catch (err) {
78105
- return false;
78106
- }
78107
- }
78108
- async function initializeGit(cwd) {
78109
- const s = spinner();
78110
- s.start("Initializing git repo");
78111
- try {
78112
- const defaultBranchName = await runCommand(
78113
- ["git", "config", "--get", "init.defaultBranch"],
78114
- { useSpinner: false, silent: true, cwd }
78115
- );
78116
- await runCommand(
78117
- ["git", "init", "--initial-branch", defaultBranchName.trim() ?? "main"],
78118
- // branch names can't contain spaces, so this is safe
78119
- { useSpinner: false, silent: true, cwd }
78120
- );
78121
- } catch {
78122
- await runCommand(["git", "init"], { useSpinner: false, silent: true, cwd });
78123
- } finally {
78124
- s.stop(`${brandColor("initialized")} ${dim(`git`)}`);
78125
- }
78126
- }
78127
- async function getProductionBranch(cwd) {
78128
- try {
78129
- const productionBranch = await runCommand(
78130
- ["git", "branch", "--show-current"],
78131
- {
78132
- silent: true,
78133
- cwd,
78134
- useSpinner: false,
78135
- captureOutput: true
78136
- }
78137
- );
78138
- return productionBranch.trim();
78139
- } catch (err) {
78140
- }
78141
- return "main";
78142
- }
78143
-
78144
- // src/deploy.ts
78168
+ init_git();
78145
78169
  init_accounts();
78146
78170
 
78147
78171
  // src/wrangler/config.ts
@@ -79344,6 +79368,9 @@ var runDeploy = async (ctx) => {
79344
79368
  }
79345
79369
  };
79346
79370
 
79371
+ // src/cli.ts
79372
+ init_git();
79373
+
79347
79374
  // src/pages.ts
79348
79375
  init_cli();
79349
79376
  init_colors();
@@ -79369,6 +79396,7 @@ var retry = async (config14, fn) => {
79369
79396
  };
79370
79397
 
79371
79398
  // src/pages.ts
79399
+ init_git();
79372
79400
  var CREATE_PROJECT_RETRIES = 3;
79373
79401
  var VERIFY_PROJECT_RETRIES = 3;
79374
79402
  var { npx } = detectPackageManager();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "2.21.2",
3
+ "version": "2.21.3",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -64,10 +64,10 @@
64
64
  "which-pm-runs": "^1.1.0",
65
65
  "wrap-ansi": "^9.0.0",
66
66
  "yargs": "^17.7.1",
67
- "@cloudflare/cli": "1.1.1",
68
67
  "@cloudflare/eslint-config-worker": "1.1.0",
69
- "@cloudflare/workers-tsconfig": "0.0.0",
70
- "wrangler": "3.57.0"
68
+ "wrangler": "3.57.1",
69
+ "@cloudflare/cli": "1.1.1",
70
+ "@cloudflare/workers-tsconfig": "0.0.0"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=18.14.1"
@@ -32,7 +32,7 @@ export class MyDurableObject extends DurableObject {
32
32
 
33
33
  /**
34
34
  * The Durable Object exposes an RPC method sayHello which will be invoked when when a Durable
35
- * Object instance receives a request from a Worker via the same method invokation on the stub
35
+ * Object instance receives a request from a Worker via the same method invocation on the stub
36
36
  *
37
37
  * @param {string} name - The name provided to a Durable Object instance from a Worker
38
38
  * @returns {Promise<string>} The greeting to be sent back to the Worker
@@ -49,7 +49,7 @@ export class MyDurableObject extends DurableObject {
49
49
 
50
50
  /**
51
51
  * The Durable Object exposes an RPC method sayHello which will be invoked when when a Durable
52
- * Object instance receives a request from a Worker via the same method invokation on the stub
52
+ * Object instance receives a request from a Worker via the same method invocation on the stub
53
53
  *
54
54
  * @param name - The name provided to a Durable Object instance from a Worker
55
55
  * @returns The greeting to be sent back to the Worker