create-cloudflare 0.0.0-a027b57e → 0.0.0-a1c9f43f

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/README.md CHANGED
@@ -2,58 +2,7 @@
2
2
 
3
3
  A CLI for creating and deploying new applications to [Cloudflare](https://developers.cloudflare.com/).
4
4
 
5
- ## Usage
6
-
7
- ### Setup via Interactive CLI
8
-
9
- To create new applications via interactive CLI, run:
10
-
11
- ```bash
12
- npm create cloudflare@latest
13
- # or
14
- pnpm create cloudflare@latest
15
- # or
16
- yarn create cloudflare
17
- ```
18
-
19
- ### Setup via CLI Arguments
20
-
21
- #### New Websites or Web applications via Frameworks
22
-
23
- To create a new website or web framework without interaction, run:
24
-
25
- ```bash
26
- npm create cloudflare@latest -- --type webFramework --framework <frameworkName>
27
- # or
28
- pnpm create cloudflare@latest ...
29
- # or
30
- yarn create cloudflare ...
31
- ```
32
-
33
- Currently supported framework options: `angular`, `astro`, `docusaurus`, `gatsby`, `hono`, `next`, `nuxt`, `qwik`, `react`, `remix`, `solid`, `svelte`, `vue`.
34
-
35
- #### New Workers via Templates
36
-
37
- To create a new Javascript "Hello World" worker, run:
38
-
39
- ```bash
40
- npm create cloudflare@latest hello-world -- --type hello-world --no-ts
41
- ```
42
-
43
- To create a new Typescript "Hello World" worker, run:
44
-
45
- ```bash
46
- npm create cloudflare@latest hello-world -- --type hello-world --ts
47
- ```
48
-
49
- Current template options are: `hello-world`, `common`, `chatgptPlugin`, or `openapi`.
50
-
51
- #### Additional arguments
52
-
53
- | | |
54
- | ------------- | :---------------------------------------------------------------------: |
55
- | `--deploy` | deploy your application automatically, bypassing the interactive prompt |
56
- | `--no-deploy` | create and scaffold a new application and bypass deployment prompt |
5
+ For more details on how to use the create-cloudflare CLI (C3) please visit the [official C3 documentation](https://developers.cloudflare.com/pages/get-started/c3).
57
6
 
58
7
  ### Community
59
8
 
package/dist/cli.js CHANGED
@@ -60107,7 +60107,7 @@ var Yargs = YargsFactory(esm_default);
60107
60107
  var yargs_default = Yargs;
60108
60108
 
60109
60109
  // package.json
60110
- var version = "0.0.0-a027b57e";
60110
+ var version = "0.0.0-a1c9f43f";
60111
60111
  var devDependencies = {
60112
60112
  "@babel/parser": "^7.21.3",
60113
60113
  "@babel/types": "^7.21.4",
@@ -61004,18 +61004,18 @@ var package_default = {
61004
61004
  ],
61005
61005
  dependencies: {
61006
61006
  "@angular/cli": "16.2.2",
61007
- "create-astro": "4.3.0",
61007
+ "create-astro": "4.4.1",
61008
61008
  "create-docusaurus": "2.4.3",
61009
61009
  "create-hono": "0.3.2",
61010
61010
  "create-next-app": "13.4.19",
61011
- "create-qwik": "1.2.14",
61011
+ "create-qwik": "1.2.15",
61012
61012
  "create-react-app": "5.0.1",
61013
61013
  "create-remix": "2.1.0",
61014
61014
  "create-solid": "0.3.8",
61015
61015
  "create-svelte": "5.1.1",
61016
61016
  "create-vue": "3.8.0",
61017
61017
  gatsby: "5.12.8",
61018
- nuxi: "3.9.0"
61018
+ nuxi: "3.9.1"
61019
61019
  },
61020
61020
  frameworkCliMap: {
61021
61021
  angular: "@angular/cli",
@@ -61423,9 +61423,12 @@ var { name, npm: npm12 } = detectPackageManager();
61423
61423
  var validateProjectDirectory = (relativePath, args) => {
61424
61424
  const path3 = (0, import_path7.resolve)(relativePath);
61425
61425
  const existsAlready = (0, import_fs8.existsSync)(path3);
61426
- const isEmpty = existsAlready && (0, import_fs8.readdirSync)(path3).length === 0;
61427
- if (existsAlready && !isEmpty) {
61428
- return `Directory \`${relativePath}\` already exists and is not empty. Please choose a new name.`;
61426
+ if (existsAlready) {
61427
+ for (const file of (0, import_fs8.readdirSync)(path3)) {
61428
+ if (!isAllowedExistingFile(file)) {
61429
+ return `Directory \`${relativePath}\` already exists and contains files that might conflict. Please choose a new name.`;
61430
+ }
61431
+ }
61429
61432
  }
61430
61433
  if (!args.existingScript) {
61431
61434
  const projectName = (0, import_path7.basename)(path3);
@@ -61442,6 +61445,46 @@ var validateProjectDirectory = (relativePath, args) => {
61442
61445
  }
61443
61446
  }
61444
61447
  };
61448
+ var isAllowedExistingFile = (file) => {
61449
+ const allowedExistingFiles = /* @__PURE__ */ new Set([
61450
+ ".DS_Store",
61451
+ ".git",
61452
+ ".gitattributes",
61453
+ ".gitignore",
61454
+ ".gitlab-ci.yml",
61455
+ ".hg",
61456
+ ".hgcheck",
61457
+ ".hgignore",
61458
+ ".idea",
61459
+ ".npmignore",
61460
+ ".travis.yml",
61461
+ ".vscode",
61462
+ "Thumbs.db",
61463
+ "docs",
61464
+ "mkdocs.yml",
61465
+ "npm-debug.log",
61466
+ "yarn-debug.log",
61467
+ "yarn-error.log",
61468
+ "yarnrc.yml",
61469
+ ".yarn",
61470
+ ".gitkeep"
61471
+ ]);
61472
+ if (allowedExistingFiles.has(file))
61473
+ return true;
61474
+ const allowedExistingPatters = [
61475
+ /readme(\.md)?$/i,
61476
+ /license(\.md)?$/i,
61477
+ /\.iml$/,
61478
+ /^npm-debug\.log/,
61479
+ /^yarn-debug\.log/,
61480
+ /^yarn-error\.log/
61481
+ ];
61482
+ for (const regex2 of allowedExistingPatters) {
61483
+ if (regex2.test(file))
61484
+ return true;
61485
+ }
61486
+ return false;
61487
+ };
61445
61488
  var setupProjectDirectory = (args) => {
61446
61489
  const path3 = (0, import_path7.resolve)(args.projectName);
61447
61490
  const err = validateProjectDirectory(path3, args);
@@ -62105,26 +62148,61 @@ var parseArgs = async (argv) => {
62105
62148
  doubleDashesIdx < 0 ? void 0 : doubleDashesIdx
62106
62149
  );
62107
62150
  const additionalArgs = doubleDashesIdx < 0 ? [] : argv.slice(doubleDashesIdx + 1);
62108
- const yargsObj = yargs_default(hideBin(c3Args)).scriptName("create-cloudflare").usage("$0 [args]").positional("name", { type: "string" }).option("type", { type: "string" }).option("framework", { type: "string" }).option("deploy", { type: "boolean" }).option("ts", { type: "boolean" }).option("git", { type: "boolean" }).option("open", {
62151
+ const yargsObj = yargs_default(hideBin(c3Args)).scriptName("create-cloudflare").usage("$0 [args]").positional("directory", {
62152
+ type: "string",
62153
+ description: "The directory where the application should be created. The name of the application is taken from the directory name"
62154
+ }).option("type", {
62155
+ type: "string",
62156
+ description: "The type of application that should be created"
62157
+ }).option("framework", {
62158
+ type: "string",
62159
+ description: "The type of framework to use to create a web application (when using this option `--type` is ignored)"
62160
+ }).option("deploy", {
62161
+ type: "boolean",
62162
+ description: "Deploy your application after it has been created"
62163
+ }).option("ts", {
62164
+ type: "boolean",
62165
+ description: "Use TypeScript in your application"
62166
+ }).option("git", {
62167
+ type: "boolean",
62168
+ description: "Initialize a local git repository for your application"
62169
+ }).option("open", {
62109
62170
  type: "boolean",
62110
62171
  default: true,
62111
- description: "opens your browser after your deployment, set --no-open to disable"
62172
+ description: "Opens the deployed application in your browser (this option is ignored if the application is not deployed)"
62112
62173
  }).option("existing-script", {
62113
62174
  type: "string",
62114
62175
  hidden: templateMap["pre-existing"].hidden
62115
62176
  }).option("accept-defaults", {
62116
62177
  alias: "y",
62117
- type: "boolean"
62178
+ type: "boolean",
62179
+ description: "Use all the default C3 options (each can also be overridden by specifying it)"
62118
62180
  }).option("auto-update", {
62119
62181
  type: "boolean",
62120
62182
  default: C3_DEFAULTS.autoUpdate,
62121
- description: "Automatically uses the latest version of `create-cloudflare`. Set --no-auto-update to disable"
62122
- }).option("wrangler-defaults", { type: "boolean", hidden: true }).version(version).strictOptions().alias("h", "help").help();
62123
- const args = await yargsObj.argv;
62183
+ description: "Automatically uses the latest version of C3"
62184
+ }).option("wrangler-defaults", { type: "boolean", hidden: true }).version(version).alias("v", "version").strictOptions().exitProcess(false).alias("h", "help").help();
62185
+ let args = null;
62186
+ try {
62187
+ args = await yargsObj.argv;
62188
+ } catch {
62189
+ }
62190
+ if (args === null) {
62191
+ showMoreInfoNote();
62192
+ process.exit(1);
62193
+ }
62194
+ if (args.version) {
62195
+ process.exit(0);
62196
+ }
62197
+ if (args.help) {
62198
+ showMoreInfoNote();
62199
+ process.exit(0);
62200
+ }
62124
62201
  const positionalArgs = args._;
62125
62202
  if (positionalArgs.length > 1) {
62126
62203
  yargsObj.showHelp();
62127
62204
  console.error("\nToo many positional arguments provided");
62205
+ showMoreInfoNote();
62128
62206
  process.exit(1);
62129
62207
  }
62130
62208
  return {
@@ -62150,6 +62228,13 @@ var processArgument = async (args, name2, promptConfig) => {
62150
62228
  value = await inputPrompt(promptConfig);
62151
62229
  return value;
62152
62230
  };
62231
+ var showMoreInfoNote = () => {
62232
+ const c3CliArgsDocsPage = "https://developers.cloudflare.com/pages/get-started/c3/#cli-arguments";
62233
+ console.log(
62234
+ `
62235
+ For more information regarding how to invoke C3 please visit ${c3CliArgsDocsPage}`
62236
+ );
62237
+ };
62153
62238
 
62154
62239
  // src/cli.ts
62155
62240
  var import_semver2 = __toESM(require_semver2());
@@ -62209,9 +62294,12 @@ var runCli = async (args) => {
62209
62294
  options: templateOptions,
62210
62295
  defaultValue: C3_DEFAULTS.type
62211
62296
  });
62212
- if (!type || !Object.keys(templateMap).includes(type)) {
62297
+ if (!type) {
62213
62298
  return crash("An application type must be specified to continue.");
62214
62299
  }
62300
+ if (!Object.keys(templateMap).includes(type)) {
62301
+ return crash(`Unknown application type provided: ${type}.`);
62302
+ }
62215
62303
  const validatedArgs = {
62216
62304
  ...args,
62217
62305
  type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "0.0.0-a027b57e",
3
+ "version": "0.0.0-a1c9f43f",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -1,6 +1,6 @@
1
1
  name = "<TBD>"
2
2
  main = "src/index.ts"
3
- compatibility_date = "2023-05-15"
3
+ compatibility_date = "<TBD>"
4
4
 
5
5
  # Cron Triggers
6
6
  # Docs: https://developers.cloudflare.com/workers/platform/triggers/cron-triggers/