create-cloudflare 0.0.0-fa91ff54 → 0.0.0-fbd2a4cf

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
@@ -3814,7 +3814,7 @@ var init_args = __esm({
3814
3814
  var version, devDependencies;
3815
3815
  var init_package = __esm({
3816
3816
  "package.json"() {
3817
- version = "0.0.0-fa91ff54";
3817
+ version = "0.0.0-fbd2a4cf";
3818
3818
  devDependencies = {
3819
3819
  "@babel/parser": "^7.21.3",
3820
3820
  "@babel/types": "^7.21.4",
@@ -24228,7 +24228,7 @@ var init_package2 = __esm({
24228
24228
  "create-solid": "0.3.10",
24229
24229
  "create-svelte": "6.0.8",
24230
24230
  "create-vue": "3.9.1",
24231
- gatsby: "5.13.2",
24231
+ gatsby: "5.13.3",
24232
24232
  nuxi: "3.10.0"
24233
24233
  },
24234
24234
  frameworkCliMap: {
@@ -25812,7 +25812,7 @@ var init_poll = __esm({
25812
25812
  var version2;
25813
25813
  var init_package3 = __esm({
25814
25814
  "../wrangler/package.json"() {
25815
- version2 = "3.24.0";
25815
+ version2 = "3.25.0";
25816
25816
  }
25817
25817
  });
25818
25818
 
@@ -29456,26 +29456,32 @@ var init_common2 = __esm({
29456
29456
  printSummary = async (ctx) => {
29457
29457
  const dirRelativePath = (0, import_path7.relative)(ctx.originalCWD, ctx.project.path);
29458
29458
  const nextSteps = [
29459
- dirRelativePath ? [`Navigate to the new directory`, `cd ${dirRelativePath}`] : [],
29459
+ dirRelativePath ? ["Navigate to the new directory", `cd ${dirRelativePath}`] : [],
29460
29460
  [
29461
- `Run the development server`,
29461
+ "Run the development server",
29462
29462
  quoteShellArgs([npm2, "run", ctx.template.devScript ?? "start"])
29463
29463
  ],
29464
+ ...ctx.template.previewScript ? [
29465
+ [
29466
+ "Preview your application",
29467
+ quoteShellArgs([npm2, "run", ctx.template.previewScript])
29468
+ ]
29469
+ ] : [],
29464
29470
  [
29465
- `Deploy your application`,
29471
+ "Deploy your application",
29466
29472
  quoteShellArgs([npm2, "run", ctx.template.deployScript ?? "deploy"])
29467
29473
  ],
29468
29474
  [
29469
- `Read the documentation`,
29475
+ "Read the documentation",
29470
29476
  `https://developers.cloudflare.com/${ctx.template.platform}`
29471
29477
  ],
29472
- [`Stuck? Join us at`, `https://discord.gg/cloudflaredev`]
29478
+ ["Stuck? Join us at", "https://discord.gg/cloudflaredev"]
29473
29479
  ];
29474
29480
  if (ctx.deployment.url) {
29475
29481
  const msg = [
29476
29482
  `${gray(shapes.leftT)}`,
29477
29483
  `${bgGreen(" SUCCESS ")}`,
29478
- `${dim(`View your deployed application at`)}`,
29484
+ `${dim("View your deployed application at")}`,
29479
29485
  `${blue(ctx.deployment.url)}`
29480
29486
  ].join(" ");
29481
29487
  logRaw(msg);
@@ -29483,7 +29489,7 @@ var init_common2 = __esm({
29483
29489
  const msg = [
29484
29490
  `${gray(shapes.leftT)}`,
29485
29491
  `${bgGreen(" APPLICATION CREATED ")}`,
29486
- `${dim(`Deploy your application with`)}`,
29492
+ `${dim("Deploy your application with")}`,
29487
29493
  `${blue(
29488
29494
  quoteShellArgs([npm2, "run", ctx.template.deployScript ?? "deploy"])
29489
29495
  )}`
@@ -33737,10 +33743,10 @@ var require_index_688c5d50 = __commonJS({
33737
33743
  }
33738
33744
  } : (path4, uid, gid) => lchownSync(path4, uid, gid);
33739
33745
  var nodeVersion2 = process.version;
33740
- var readdir2 = (path4, options, cb) => fs__default["default"].readdir(path4, options, cb);
33746
+ var readdir = (path4, options, cb) => fs__default["default"].readdir(path4, options, cb);
33741
33747
  var readdirSync4 = (path4, options) => fs__default["default"].readdirSync(path4, options);
33742
33748
  if (/^v4\./.test(nodeVersion2))
33743
- readdir2 = (path4, options, cb) => fs__default["default"].readdir(path4, cb);
33749
+ readdir = (path4, options, cb) => fs__default["default"].readdir(path4, cb);
33744
33750
  var chown = (cpath, uid, gid, cb) => {
33745
33751
  fs__default["default"][LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, (er) => {
33746
33752
  cb(er && er.code !== "ENOENT" ? er : null);
@@ -33767,7 +33773,7 @@ var require_index_688c5d50 = __commonJS({
33767
33773
  }
33768
33774
  };
33769
33775
  var chownr = (p2, uid, gid, cb) => {
33770
- readdir2(p2, { withFileTypes: true }, (er, children) => {
33776
+ readdir(p2, { withFileTypes: true }, (er, children) => {
33771
33777
  if (er) {
33772
33778
  if (er.code === "ENOENT")
33773
33779
  return cb();
@@ -36644,8 +36650,8 @@ var require_index_688c5d50 = __commonJS({
36644
36650
  }
36645
36651
  }
36646
36652
  var fs$readdir = fs3.readdir;
36647
- fs3.readdir = readdir3;
36648
- function readdir3(path4, options, cb) {
36653
+ fs3.readdir = readdir2;
36654
+ function readdir2(path4, options, cb) {
36649
36655
  var args = [path4];
36650
36656
  if (typeof options !== "function") {
36651
36657
  args.push(options);
@@ -40936,7 +40942,7 @@ var c3_exports = {};
40936
40942
  __export(c3_exports, {
40937
40943
  default: () => c3_default
40938
40944
  });
40939
- async function installCFWorker(ctx) {
40945
+ async function installCFWorker() {
40940
40946
  await installPackages(
40941
40947
  ["@cloudflare/workers-types", "@miniflare/tre@next", "wrangler@beta"],
40942
40948
  {
@@ -40993,7 +40999,7 @@ var init_c3 = __esm({
40993
40999
  configure = async (ctx) => {
40994
41000
  updateAngularJson(ctx);
40995
41001
  await updateAppCode();
40996
- await installCFWorker(ctx);
41002
+ await installCFWorker();
40997
41003
  };
40998
41004
  config = {
40999
41005
  configVersion: 1,
@@ -41039,7 +41045,7 @@ var init_c32 = __esm({
41039
41045
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
41040
41046
  logRaw("");
41041
41047
  };
41042
- configure2 = async (ctx) => {
41048
+ configure2 = async () => {
41043
41049
  await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
41044
41050
  silent: true,
41045
41051
  startText: "Installing adapter",
@@ -41591,6 +41597,7 @@ var init_c36 = __esm({
41591
41597
  platform: "pages",
41592
41598
  displayName: "Next",
41593
41599
  devScript: "dev",
41600
+ previewScript: "pages:preview",
41594
41601
  generate: generate6,
41595
41602
  configure: configure3,
41596
41603
  transformPackageJson: async () => {
@@ -41653,7 +41660,7 @@ var init_c37 = __esm({
41653
41660
  writeFile2("./.node-version", "17");
41654
41661
  logRaw("");
41655
41662
  };
41656
- configure4 = async (ctx) => {
41663
+ configure4 = async () => {
41657
41664
  const configFileName = "nuxt.config.ts";
41658
41665
  const configFilePath = (0, import_node_path2.resolve)(configFileName);
41659
41666
  const s = spinner();
@@ -41701,7 +41708,7 @@ var init_c38 = __esm({
41701
41708
  generate8 = async (ctx) => {
41702
41709
  await runFrameworkGenerator(ctx, ["basic", ctx.project.name]);
41703
41710
  };
41704
- configure5 = async (ctx) => {
41711
+ configure5 = async () => {
41705
41712
  const cmd = [npx4, "qwik", "add", "cloudflare-pages"];
41706
41713
  endSection(`Running ${quoteShellArgs(cmd)}`);
41707
41714
  await runCommand(cmd);
@@ -41830,6 +41837,7 @@ var init_c311 = __esm({
41830
41837
  }
41831
41838
  }),
41832
41839
  devScript: "dev",
41840
+ previewScript: "pages:preview",
41833
41841
  compatibilityFlags: ["nodejs_compat"]
41834
41842
  };
41835
41843
  c3_default11 = config10;
@@ -73006,10 +73014,12 @@ var init_c312 = __esm({
73006
73014
  configure: configure6,
73007
73015
  transformPackageJson: async () => ({
73008
73016
  scripts: {
73009
- "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 5173 -- ${npm12} run dev`,
73017
+ "pages:preview": `${npm12} run build && wrangler pages dev ${await compatDateFlag()} .svelte-kit/cloudflare`,
73010
73018
  "pages:deploy": `${npm12} run build && wrangler pages deploy .svelte-kit/cloudflare`
73011
73019
  }
73012
- })
73020
+ }),
73021
+ devScript: "dev",
73022
+ previewScript: "pages:preview"
73013
73023
  };
73014
73024
  c3_default12 = config11;
73015
73025
  }
@@ -73183,35 +73193,15 @@ var init_c318 = __esm({
73183
73193
  }
73184
73194
  });
73185
73195
 
73186
- // templates/chatgptPlugin/c3.ts
73196
+ // templates/openapi/c3.ts
73187
73197
  var c3_exports19 = {};
73188
73198
  __export(c3_exports19, {
73189
73199
  default: () => c3_default19
73190
73200
  });
73191
73201
  var c3_default19;
73192
73202
  var init_c319 = __esm({
73193
- "templates/chatgptPlugin/c3.ts"() {
73194
- c3_default19 = {
73195
- configVersion: 1,
73196
- id: "chatgptPlugin",
73197
- displayName: "ChatGPT plugin",
73198
- platform: "workers",
73199
- copyFiles: {
73200
- path: "./ts"
73201
- }
73202
- };
73203
- }
73204
- });
73205
-
73206
- // templates/openapi/c3.ts
73207
- var c3_exports20 = {};
73208
- __export(c3_exports20, {
73209
- default: () => c3_default20
73210
- });
73211
- var c3_default20;
73212
- var init_c320 = __esm({
73213
73203
  "templates/openapi/c3.ts"() {
73214
- c3_default20 = {
73204
+ c3_default19 = {
73215
73205
  configVersion: 1,
73216
73206
  id: "openapi",
73217
73207
  displayName: "API starter (OpenAPI compliant)",
@@ -73224,13 +73214,13 @@ var init_c320 = __esm({
73224
73214
  });
73225
73215
 
73226
73216
  // templates/pre-existing/c3.ts
73227
- var c3_exports21 = {};
73228
- __export(c3_exports21, {
73217
+ var c3_exports20 = {};
73218
+ __export(c3_exports20, {
73229
73219
  copyExistingWorkerFiles: () => copyExistingWorkerFiles,
73230
- default: () => c3_default21
73220
+ default: () => c3_default20
73231
73221
  });
73232
73222
  async function copyExistingWorkerFiles(ctx) {
73233
- const { dlx, npm: npm15 } = detectPackageManager();
73223
+ const { dlx } = detectPackageManager();
73234
73224
  await chooseAccount(ctx);
73235
73225
  if (ctx.args.existingScript === void 0) {
73236
73226
  ctx.args.existingScript = await processArgument(
@@ -73276,8 +73266,8 @@ async function copyExistingWorkerFiles(ctx) {
73276
73266
  (0, import_path10.join)(ctx.project.path, "wrangler.toml")
73277
73267
  );
73278
73268
  }
73279
- var import_promises, import_os, import_path10, c3_default21;
73280
- var init_c321 = __esm({
73269
+ var import_promises, import_os, import_path10, c3_default20;
73270
+ var init_c320 = __esm({
73281
73271
  "templates/pre-existing/c3.ts"() {
73282
73272
  import_promises = require("fs/promises");
73283
73273
  import_os = require("os");
@@ -73287,7 +73277,7 @@ var init_c321 = __esm({
73287
73277
  init_command();
73288
73278
  init_packages();
73289
73279
  init_common2();
73290
- c3_default21 = {
73280
+ c3_default20 = {
73291
73281
  configVersion: 1,
73292
73282
  id: "pre-existing",
73293
73283
  displayName: "Pre-existing Worker (from Dashboard)",
@@ -78408,13 +78398,12 @@ var getTemplateMap = async () => {
78408
78398
  common: (await Promise.resolve().then(() => (init_c316(), c3_exports16))).default,
78409
78399
  scheduled: (await Promise.resolve().then(() => (init_c317(), c3_exports17))).default,
78410
78400
  queues: (await Promise.resolve().then(() => (init_c318(), c3_exports18))).default,
78411
- chatgptPlugin: (await Promise.resolve().then(() => (init_c319(), c3_exports19))).default,
78412
- openapi: (await Promise.resolve().then(() => (init_c320(), c3_exports20))).default,
78401
+ openapi: (await Promise.resolve().then(() => (init_c319(), c3_exports19))).default,
78413
78402
  // Dummy record -- actual template config resolved in `processRemoteTemplate`
78414
78403
  "remote-template": {
78415
78404
  displayName: "Worker built from a template hosted in a git repository"
78416
78405
  },
78417
- "pre-existing": (await Promise.resolve().then(() => (init_c321(), c3_exports21))).default
78406
+ "pre-existing": (await Promise.resolve().then(() => (init_c320(), c3_exports20))).default
78418
78407
  };
78419
78408
  };
78420
78409
  var selectTemplate = async (args) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "0.0.0-fa91ff54",
3
+ "version": "0.0.0-fbd2a4cf",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -65,9 +65,9 @@
65
65
  "which-pm-runs": "^1.1.0",
66
66
  "yargs": "^17.7.1",
67
67
  "yarn": "^1.22.19",
68
- "wrangler": "3.24.0",
68
+ "@cloudflare/cli": "1.1.1",
69
69
  "@cloudflare/workers-tsconfig": "0.0.0",
70
- "@cloudflare/cli": "1.1.1"
70
+ "wrangler": "3.25.0"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=18.14.1"
@@ -1,4 +1,3 @@
1
- import { cp } from "node:fs/promises";
2
1
  import { resolve } from "node:path";
3
2
  import { logRaw } from "@cloudflare/cli";
4
3
  import { brandColor, dim } from "@cloudflare/cli/colors";
@@ -19,10 +18,10 @@ const generate = async (ctx: C3Context) => {
19
18
  const configure = async (ctx: C3Context) => {
20
19
  updateAngularJson(ctx);
21
20
  await updateAppCode();
22
- await installCFWorker(ctx);
21
+ await installCFWorker();
23
22
  };
24
23
 
25
- async function installCFWorker(ctx: C3Context) {
24
+ async function installCFWorker() {
26
25
  await installPackages(
27
26
  ["@cloudflare/workers-types", "@miniflare/tre@next", "wrangler@beta"],
28
27
  {
@@ -14,7 +14,7 @@ const generate = async (ctx: C3Context) => {
14
14
  logRaw(""); // newline
15
15
  };
16
16
 
17
- const configure = async (ctx: C3Context) => {
17
+ const configure = async () => {
18
18
  await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
19
19
  silent: true,
20
20
  startText: "Installing adapter",
@@ -178,6 +178,7 @@ export default {
178
178
  platform: "pages",
179
179
  displayName: "Next",
180
180
  devScript: "dev",
181
+ previewScript: "pages:preview",
181
182
  generate,
182
183
  configure,
183
184
  transformPackageJson: async () => {
@@ -27,7 +27,7 @@ const generate = async (ctx: C3Context) => {
27
27
  logRaw(""); // newline
28
28
  };
29
29
 
30
- const configure = async (ctx: C3Context) => {
30
+ const configure = async () => {
31
31
  const configFileName = "nuxt.config.ts";
32
32
  const configFilePath = resolve(configFileName);
33
33
  const s = spinner();
@@ -1,7 +1,6 @@
1
- import { cp, mkdtemp, readdir, rm } from "fs/promises";
1
+ import { cp, mkdtemp } from "fs/promises";
2
2
  import { tmpdir } from "os";
3
3
  import { join } from "path";
4
- import { crash } from "@cloudflare/cli";
5
4
  import { processArgument } from "@cloudflare/cli/args";
6
5
  import { brandColor, dim } from "@cloudflare/cli/colors";
7
6
  import { runCommand } from "helpers/command";
@@ -10,7 +9,7 @@ import { chooseAccount } from "../../src/common";
10
9
  import type { C3Context } from "types";
11
10
 
12
11
  export async function copyExistingWorkerFiles(ctx: C3Context) {
13
- const { dlx, npm } = detectPackageManager();
12
+ const { dlx } = detectPackageManager();
14
13
 
15
14
  await chooseAccount(ctx);
16
15
 
@@ -12,7 +12,7 @@ const generate = async (ctx: C3Context) => {
12
12
  await runFrameworkGenerator(ctx, ["basic", ctx.project.name]);
13
13
  };
14
14
 
15
- const configure = async (ctx: C3Context) => {
15
+ const configure = async () => {
16
16
  // Add the pages integration
17
17
  const cmd = [npx, "qwik", "add", "cloudflare-pages"];
18
18
  endSection(`Running ${quoteShellArgs(cmd)}`);
@@ -1,6 +1,5 @@
1
- import { logRaw, updateStatus } from "@cloudflare/cli";
2
- import { blue, brandColor, dim } from "@cloudflare/cli/colors";
3
- import { installPackages, runFrameworkGenerator } from "helpers/command";
1
+ import { logRaw } from "@cloudflare/cli";
2
+ import { runFrameworkGenerator } from "helpers/command";
4
3
  import { compatDateFlag } from "helpers/files";
5
4
  import { detectPackageManager } from "helpers/packages";
6
5
  import type { TemplateConfig } from "../../src/templates";
@@ -32,6 +31,7 @@ const config: TemplateConfig = {
32
31
  },
33
32
  }),
34
33
  devScript: "dev",
34
+ previewScript: "pages:preview",
35
35
  compatibilityFlags: ["nodejs_compat"],
36
36
  };
37
37
  export default config;
@@ -67,9 +67,11 @@ const config: TemplateConfig = {
67
67
  configure,
68
68
  transformPackageJson: async () => ({
69
69
  scripts: {
70
- "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 5173 -- ${npm} run dev`,
70
+ "pages:preview": `${npm} run build && wrangler pages dev ${await compatDateFlag()} .svelte-kit/cloudflare`,
71
71
  "pages:deploy": `${npm} run build && wrangler pages deploy .svelte-kit/cloudflare`,
72
72
  },
73
73
  }),
74
+ devScript: "dev",
75
+ previewScript: "pages:preview",
74
76
  };
75
77
  export default config;
@@ -1,9 +0,0 @@
1
- export default {
2
- configVersion: 1,
3
- id: "chatgptPlugin",
4
- displayName: "ChatGPT plugin",
5
- platform: "workers",
6
- copyFiles: {
7
- path: "./ts",
8
- },
9
- };
@@ -1,25 +0,0 @@
1
- # Example ChatGPT Plugin for Cloudflare Workers
2
-
3
- This is an example plugin showing how to build [ChatGPT plugins](https://platform.openai.com/docs/plugins/introduction) using [Cloudflare Workers](https://workers.dev). Using this example, you can deploy a plugin to Cloudflare Workers in just a few minutes.
4
-
5
- The sample plugin allows ChatGPT users to search for repositories using GitHub's search API. The plugin is implemented in TypeScript and uses the [OpenAPI](https://www.openapis.org/) specification to define the plugin's API.
6
-
7
- ![Example conversation in ChatGPT showing the plugin in use](./.assets/example.png)
8
-
9
- ## Get started
10
-
11
- 0. Sign up for [Cloudflare Workers](https://workers.dev). The free tier is more than enough for most use cases.
12
- 1. Install [wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update), the Cloudflare Workers CLI
13
- 2. Clone this project and install dependencies with `npm install`
14
- 3. Run `wrangler login` to login to your Cloudflare account in wrangler
15
- 4. Run `wrangler deploy` to publish the plugin to Cloudflare Workers
16
-
17
- ## Usage
18
-
19
- 1. You can configure the `.well-known/ai-plugin.json` route in `index.ts`.
20
- 2. You can set up any new routes and the associated OpenAPI schema by defining new routes. See `search.ts` for an example.
21
- 3. For more information read the [itty-router-openapi official documentation](https://cloudflare.github.io/itty-router-openapi/).
22
-
23
- ## Deploying to OpenAI's API
24
-
25
- Follow the instructions [in the ChatGPT documentation](https://platform.openai.com/docs/plugins/introduction/plugin-flow) to deploy your plugin and begin using it in ChatGPT.
@@ -1,171 +0,0 @@
1
- # Logs
2
-
3
- logs
4
- _.log
5
- npm-debug.log_
6
- yarn-debug.log*
7
- yarn-error.log*
8
- lerna-debug.log*
9
- .pnpm-debug.log*
10
-
11
- # Diagnostic reports (https://nodejs.org/api/report.html)
12
-
13
- report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
14
-
15
- # Runtime data
16
-
17
- pids
18
- _.pid
19
- _.seed
20
- \*.pid.lock
21
-
22
- # Directory for instrumented libs generated by jscoverage/JSCover
23
-
24
- lib-cov
25
-
26
- # Coverage directory used by tools like istanbul
27
-
28
- coverage
29
- \*.lcov
30
-
31
- # nyc test coverage
32
-
33
- .nyc_output
34
-
35
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
36
-
37
- .grunt
38
-
39
- # Bower dependency directory (https://bower.io/)
40
-
41
- bower_components
42
-
43
- # node-waf configuration
44
-
45
- .lock-wscript
46
-
47
- # Compiled binary addons (https://nodejs.org/api/addons.html)
48
-
49
- build/Release
50
-
51
- # Dependency directories
52
-
53
- node_modules/
54
- jspm_packages/
55
-
56
- # Snowpack dependency directory (https://snowpack.dev/)
57
-
58
- web_modules/
59
-
60
- # TypeScript cache
61
-
62
- \*.tsbuildinfo
63
-
64
- # Optional npm cache directory
65
-
66
- .npm
67
-
68
- # Optional eslint cache
69
-
70
- .eslintcache
71
-
72
- # Optional stylelint cache
73
-
74
- .stylelintcache
75
-
76
- # Microbundle cache
77
-
78
- .rpt2_cache/
79
- .rts2_cache_cjs/
80
- .rts2_cache_es/
81
- .rts2_cache_umd/
82
-
83
- # Optional REPL history
84
-
85
- .node_repl_history
86
-
87
- # Output of 'npm pack'
88
-
89
- \*.tgz
90
-
91
- # Yarn Integrity file
92
-
93
- .yarn-integrity
94
-
95
- # dotenv environment variable files
96
-
97
- .env
98
- .env.development.local
99
- .env.test.local
100
- .env.production.local
101
- .env.local
102
-
103
- # parcel-bundler cache (https://parceljs.org/)
104
-
105
- .cache
106
- .parcel-cache
107
-
108
- # Next.js build output
109
-
110
- .next
111
- out
112
-
113
- # Nuxt.js build / generate output
114
-
115
- .nuxt
116
- dist
117
-
118
- # Gatsby files
119
-
120
- .cache/
121
-
122
- # Comment in the public line in if your project uses Gatsby and not Next.js
123
-
124
- # https://nextjs.org/blog/next-9-1#public-directory-support
125
-
126
- # public
127
-
128
- # vuepress build output
129
-
130
- .vuepress/dist
131
-
132
- # vuepress v2.x temp and cache directory
133
-
134
- .temp
135
- .cache
136
-
137
- # Docusaurus cache and generated files
138
-
139
- .docusaurus
140
-
141
- # Serverless directories
142
-
143
- .serverless/
144
-
145
- # FuseBox cache
146
-
147
- .fusebox/
148
-
149
- # DynamoDB Local files
150
-
151
- .dynamodb/
152
-
153
- # TernJS port file
154
-
155
- .tern-port
156
-
157
- # Stores VSCode versions used for testing VSCode extensions
158
-
159
- .vscode-test
160
-
161
- # yarn v2
162
-
163
- .yarn/cache
164
- .yarn/unplugged
165
- .yarn/build-state.yml
166
- .yarn/install-state.gz
167
- .pnp.\*
168
-
169
- # wrangler project
170
-
171
- .dev.vars
@@ -1,16 +0,0 @@
1
- {
2
- "name": "cloudflare-workers-chatgpt-plugin-example",
3
- "version": "0.0.1",
4
- "private": true,
5
- "scripts": {
6
- "deploy": "wrangler deploy",
7
- "dev": "wrangler dev",
8
- "start": "wrangler dev"
9
- },
10
- "dependencies": {
11
- "@cloudflare/itty-router-openapi": "^1.0.1"
12
- },
13
- "devDependencies": {
14
- "wrangler": "^3.0.0"
15
- }
16
- }
@@ -1,33 +0,0 @@
1
- import { OpenAPIRouter } from "@cloudflare/itty-router-openapi";
2
- import { GetSearch } from "./search";
3
-
4
- export const router = OpenAPIRouter({
5
- schema: {
6
- info: {
7
- title: "GitHub Repositories Search API",
8
- description:
9
- "A plugin that allows the user to search for GitHub repositories using ChatGPT",
10
- version: "v0.0.1",
11
- },
12
- },
13
- docs_url: "/",
14
- aiPlugin: {
15
- name_for_human: "GitHub Repositories Search",
16
- name_for_model: "github_repositories_search",
17
- description_for_human: "GitHub Repositories Search plugin for ChatGPT.",
18
- description_for_model:
19
- "GitHub Repositories Search plugin for ChatGPT. You can search for GitHub repositories using this plugin.",
20
- contact_email: "support@example.com",
21
- legal_info_url: "http://www.example.com/legal",
22
- logo_url: "https://workers.cloudflare.com/resources/logo/logo.svg",
23
- },
24
- });
25
-
26
- router.get("/search", GetSearch);
27
-
28
- // 404 for everything else
29
- router.all("*", () => new Response("Not Found.", { status: 404 }));
30
-
31
- export default {
32
- fetch: router.handle,
33
- };
@@ -1,59 +0,0 @@
1
- import { OpenAPIRoute, Query } from "@cloudflare/itty-router-openapi";
2
-
3
- export class GetSearch extends OpenAPIRoute {
4
- static schema = {
5
- tags: ["Search"],
6
- summary: "Search repositories by a query parameter",
7
- parameters: {
8
- q: Query(String, {
9
- description: "The query to search for",
10
- default: "cloudflare workers",
11
- }),
12
- },
13
- responses: {
14
- "200": {
15
- description: "Successfully response",
16
- schema: {
17
- repos: [
18
- {
19
- name: "itty-router-openapi",
20
- description:
21
- "OpenAPI 3 schema generator and validator for Cloudflare Workers",
22
- stars: "80",
23
- url: "https://github.com/cloudflare/itty-router-openapi",
24
- },
25
- ],
26
- },
27
- },
28
- },
29
- };
30
-
31
- async handle(request: Request, env, ctx, data: Record<string, any>) {
32
- const url = `https://api.github.com/search/repositories?q=${data.query.q}`;
33
-
34
- const resp = await fetch(url, {
35
- headers: {
36
- Accept: "application/vnd.github.v3+json",
37
- "User-Agent": "RepoAI - Cloudflare Workers ChatGPT Plugin Example",
38
- },
39
- });
40
-
41
- if (!resp.ok) {
42
- return new Response(await resp.text(), { status: 400 });
43
- }
44
-
45
- const json = await resp.json();
46
-
47
- // @ts-ignore
48
- const repos = json.items.map((item: any) => ({
49
- name: item.name,
50
- description: item.description,
51
- stars: item.stargazers_count,
52
- url: item.html_url,
53
- }));
54
-
55
- return {
56
- repos: repos,
57
- };
58
- }
59
- }
@@ -1,3 +0,0 @@
1
- name = "<TBD>"
2
- main = "src/index.ts"
3
- compatibility_date = "<TBD>"