create-cloudflare 0.0.0-6d7d00a8 → 0.0.0-6dda3626
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 +131 -392
- package/package.json +2 -4
- package/templates/angular/c3.ts +4 -5
- package/templates/astro/c3.ts +1 -1
- package/templates/common/c3.ts +0 -1
- package/templates/hello-world/c3.ts +0 -1
- package/templates/hello-world-durable-object/c3.ts +0 -1
- package/templates/hono/c3.ts +2 -2
- package/templates/next/c3.ts +3 -1
- package/templates/next/templates.ts +18 -18
- package/templates/nuxt/c3.ts +1 -1
- package/templates/openapi/c3.ts +0 -1
- package/templates/pre-existing/c3.ts +2 -4
- package/templates/queues/c3.ts +0 -1
- package/templates/qwik/c3.ts +1 -1
- package/templates/remix/c3.ts +1 -1
- package/templates/scheduled/c3.ts +0 -1
- package/templates/solid/c3.ts +7 -18
- package/templates/solid/js/vite.config.js +9 -4
- package/templates/solid/ts/vite.config.ts +9 -4
- package/templates/svelte/c3.ts +3 -1
- package/templates/chatgptPlugin/c3.ts +0 -10
- package/templates/chatgptPlugin/ts/.assets/example.png +0 -0
- package/templates/chatgptPlugin/ts/README.md +0 -25
- package/templates/chatgptPlugin/ts/__dot__gitignore +0 -171
- package/templates/chatgptPlugin/ts/package.json +0 -16
- package/templates/chatgptPlugin/ts/src/index.ts +0 -33
- package/templates/chatgptPlugin/ts/src/search.ts +0 -59
- package/templates/chatgptPlugin/ts/wrangler.toml +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-6dda3626",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@types/esprima": "^4.0.3",
|
|
41
41
|
"@types/node": "^18.15.3",
|
|
42
42
|
"@types/semver": "^7.5.1",
|
|
43
|
-
"@types/shell-quote": "^1.7.2",
|
|
44
43
|
"@types/which-pm-runs": "^1.0.0",
|
|
45
44
|
"@types/yargs": "^17.0.22",
|
|
46
45
|
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
@@ -60,7 +59,6 @@
|
|
|
60
59
|
"pnpm": "^8.10.0",
|
|
61
60
|
"recast": "^0.22.0",
|
|
62
61
|
"semver": "^7.5.1",
|
|
63
|
-
"shell-quote": "^1.8.1",
|
|
64
62
|
"typescript": "^5.0.2",
|
|
65
63
|
"undici": "5.28.2",
|
|
66
64
|
"vite-tsconfig-paths": "^4.0.8",
|
|
@@ -69,7 +67,7 @@
|
|
|
69
67
|
"yarn": "^1.22.19",
|
|
70
68
|
"@cloudflare/cli": "1.1.1",
|
|
71
69
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
72
|
-
"wrangler": "3.
|
|
70
|
+
"wrangler": "3.26.0"
|
|
73
71
|
},
|
|
74
72
|
"engines": {
|
|
75
73
|
"node": ">=18.14.1"
|
package/templates/angular/c3.ts
CHANGED
|
@@ -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(
|
|
21
|
+
await installCFWorker();
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
async function installCFWorker(
|
|
24
|
+
async function installCFWorker() {
|
|
26
25
|
await installPackages(
|
|
27
26
|
["@cloudflare/workers-types", "@miniflare/tre@next", "wrangler@beta"],
|
|
28
27
|
{
|
|
@@ -93,8 +92,8 @@ const config: TemplateConfig = {
|
|
|
93
92
|
deploy: `${npm} run pages:build && wrangler pages deploy dist/cloudflare`,
|
|
94
93
|
},
|
|
95
94
|
}),
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
deployScript: "deploy",
|
|
96
|
+
devScript: "start",
|
|
98
97
|
testFlags: ["--style", "sass"],
|
|
99
98
|
};
|
|
100
99
|
export default config;
|
package/templates/astro/c3.ts
CHANGED
|
@@ -14,7 +14,7 @@ const generate = async (ctx: C3Context) => {
|
|
|
14
14
|
logRaw(""); // newline
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const configure = async (
|
|
17
|
+
const configure = async () => {
|
|
18
18
|
await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
|
|
19
19
|
silent: true,
|
|
20
20
|
startText: "Installing adapter",
|
package/templates/common/c3.ts
CHANGED
package/templates/hono/c3.ts
CHANGED
package/templates/next/c3.ts
CHANGED
|
@@ -112,7 +112,7 @@ const configure = async (ctx: C3Context) => {
|
|
|
112
112
|
await writeEslintrc(ctx);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
writeFile(`${projectPath}/next.config.
|
|
115
|
+
writeFile(`${projectPath}/next.config.mjs`, nextConfig);
|
|
116
116
|
updateStatus("Updated the next.config.js file");
|
|
117
117
|
|
|
118
118
|
writeFile(`${projectPath}/README.md`, readme);
|
|
@@ -177,6 +177,8 @@ export default {
|
|
|
177
177
|
id: "next",
|
|
178
178
|
platform: "pages",
|
|
179
179
|
displayName: "Next",
|
|
180
|
+
devScript: "dev",
|
|
181
|
+
previewScript: "pages:preview",
|
|
180
182
|
generate,
|
|
181
183
|
configure,
|
|
182
184
|
transformPackageJson: async () => {
|
|
@@ -180,30 +180,30 @@ const styles = {
|
|
|
180
180
|
} as const;
|
|
181
181
|
`;
|
|
182
182
|
|
|
183
|
-
export const nextConfig =
|
|
184
|
-
const nextConfig = {}
|
|
183
|
+
export const nextConfig = `import { setupDevBindings } from '@cloudflare/next-on-pages/next-dev';
|
|
185
184
|
|
|
186
|
-
|
|
185
|
+
/** @type {import('next').NextConfig} */
|
|
186
|
+
const nextConfig = {};
|
|
187
187
|
|
|
188
188
|
// Here we use the @cloudflare/next-on-pages next-dev module to allow us to use bindings during local development
|
|
189
189
|
// (when running the application with \`next dev\`), for more information see:
|
|
190
|
-
// https://github.com/
|
|
190
|
+
// https://github.com/cloudflare/next-on-pages/blob/8e93067/internal-packages/next-dev/README.md
|
|
191
191
|
if (process.env.NODE_ENV === 'development') {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
})
|
|
205
|
-
})
|
|
192
|
+
await setupDevBindings({
|
|
193
|
+
bindings: {
|
|
194
|
+
// Add here the Cloudflare Bindings you want to have available during local development,
|
|
195
|
+
// for more details on Bindings see: https://developers.cloudflare.com/pages/functions/bindings/)
|
|
196
|
+
//
|
|
197
|
+
// KV Example:
|
|
198
|
+
// MY_KV: {
|
|
199
|
+
// type: 'kv',
|
|
200
|
+
// id: 'xxx',
|
|
201
|
+
// }
|
|
202
|
+
}
|
|
203
|
+
});
|
|
206
204
|
}
|
|
205
|
+
|
|
206
|
+
export default nextConfig;
|
|
207
207
|
`;
|
|
208
208
|
|
|
209
209
|
export const envDts = `declare global {
|
package/templates/nuxt/c3.ts
CHANGED
|
@@ -27,7 +27,7 @@ const generate = async (ctx: C3Context) => {
|
|
|
27
27
|
logRaw(""); // newline
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const configure = async (
|
|
30
|
+
const configure = async () => {
|
|
31
31
|
const configFileName = "nuxt.config.ts";
|
|
32
32
|
const configFilePath = resolve(configFileName);
|
|
33
33
|
const s = spinner();
|
package/templates/openapi/c3.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { cp, mkdtemp
|
|
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
|
|
12
|
+
const { dlx } = detectPackageManager();
|
|
14
13
|
|
|
15
14
|
await chooseAccount(ctx);
|
|
16
15
|
|
|
@@ -72,7 +71,6 @@ export default {
|
|
|
72
71
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
73
72
|
platform: "workers",
|
|
74
73
|
hidden: true,
|
|
75
|
-
languages: ["js"],
|
|
76
74
|
copyFiles: {
|
|
77
75
|
path: "./js",
|
|
78
76
|
},
|
package/templates/queues/c3.ts
CHANGED
package/templates/qwik/c3.ts
CHANGED
|
@@ -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 (
|
|
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)}`);
|
package/templates/remix/c3.ts
CHANGED
|
@@ -27,7 +27,7 @@ const config: TemplateConfig = {
|
|
|
27
27
|
"pages:deploy": `${npm} run build && wrangler pages deploy ./public`,
|
|
28
28
|
},
|
|
29
29
|
}),
|
|
30
|
-
|
|
30
|
+
devScript: "dev",
|
|
31
31
|
testFlags: ["--typescript", "--no-install", "--no-git-init"],
|
|
32
32
|
};
|
|
33
33
|
export default config;
|
package/templates/solid/c3.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { logRaw
|
|
2
|
-
import {
|
|
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";
|
|
@@ -15,18 +14,6 @@ const generate = async (ctx: C3Context) => {
|
|
|
15
14
|
logRaw("");
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
const configure = async (ctx: C3Context) => {
|
|
19
|
-
// Install the pages adapter
|
|
20
|
-
const pkg = "solid-start-cloudflare-pages";
|
|
21
|
-
await installPackages([pkg], {
|
|
22
|
-
dev: true,
|
|
23
|
-
startText: "Adding the Cloudflare Pages adapter",
|
|
24
|
-
doneText: `${brandColor(`installed`)} ${dim(pkg)}`,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
updateStatus(`Adding the Cloudflare Pages adapter to vite config`);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
17
|
const config: TemplateConfig = {
|
|
31
18
|
configVersion: 1,
|
|
32
19
|
id: "solid",
|
|
@@ -37,12 +24,14 @@ const config: TemplateConfig = {
|
|
|
37
24
|
ts: { path: "./ts" },
|
|
38
25
|
},
|
|
39
26
|
generate,
|
|
40
|
-
configure,
|
|
41
27
|
transformPackageJson: async () => ({
|
|
42
28
|
scripts: {
|
|
43
|
-
"pages:
|
|
44
|
-
"pages:deploy": `${npm} run build && wrangler pages deploy ./dist
|
|
29
|
+
"pages:preview": `${npm} run build && npx wrangler pages dev dist ${await compatDateFlag()} --compatibility-flag nodejs_compat`,
|
|
30
|
+
"pages:deploy": `${npm} run build && wrangler pages deploy ./dist`,
|
|
45
31
|
},
|
|
46
32
|
}),
|
|
33
|
+
devScript: "dev",
|
|
34
|
+
previewScript: "pages:preview",
|
|
35
|
+
compatibilityFlags: ["nodejs_compat"],
|
|
47
36
|
};
|
|
48
37
|
export default config;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import solid from "solid-start/vite";
|
|
3
|
-
import { defineConfig } from "vite";
|
|
1
|
+
import { defineConfig } from "@solidjs/start/config";
|
|
4
2
|
|
|
5
3
|
export default defineConfig({
|
|
6
|
-
|
|
4
|
+
start: {
|
|
5
|
+
server: {
|
|
6
|
+
preset: "cloudflare-pages",
|
|
7
|
+
rollupConfig: {
|
|
8
|
+
external: ["node:async_hooks"]
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
}
|
|
7
12
|
});
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import solid from "solid-start/vite";
|
|
3
|
-
import { defineConfig } from "vite";
|
|
1
|
+
import { defineConfig } from "@solidjs/start/config";
|
|
4
2
|
|
|
5
3
|
export default defineConfig({
|
|
6
|
-
|
|
4
|
+
start: {
|
|
5
|
+
server: {
|
|
6
|
+
preset: "cloudflare-pages",
|
|
7
|
+
rollupConfig: {
|
|
8
|
+
external: ["node:async_hooks"]
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
}
|
|
7
12
|
});
|
package/templates/svelte/c3.ts
CHANGED
|
@@ -67,9 +67,11 @@ const config: TemplateConfig = {
|
|
|
67
67
|
configure,
|
|
68
68
|
transformPackageJson: async () => ({
|
|
69
69
|
scripts: {
|
|
70
|
-
"pages:
|
|
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;
|
|
Binary file
|
|
@@ -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
|
-

|
|
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
|
-
};
|