create-discord-https 2.0.15 → 2.0.16

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 (30) hide show
  1. package/index.js +2 -3
  2. package/package.json +1 -1
  3. package/templates/vercel/.vercelignore +0 -5
  4. package/templates/vercel/README.md +2 -2
  5. package/templates/vercel/api/interactions.js +2 -2
  6. package/templates/vercel/vercel.json +9 -0
  7. package/templates/vercel-ts/.vercelignore +0 -5
  8. package/templates/vercel-ts/README.md +5 -5
  9. package/templates/vercel-ts/api/interactions.ts +2 -2
  10. package/templates/vercel-ts/vercel.json +9 -0
  11. /package/templates/vercel/{api/src → src}/DevLayer.js +0 -0
  12. /package/templates/vercel/{api/src → src}/commands/fun/joke.js +0 -0
  13. /package/templates/vercel/{api/src → src}/commands/index.js +0 -0
  14. /package/templates/vercel/{api/src → src}/commands/reply/ping.js +0 -0
  15. /package/templates/vercel/{api/src → src}/commands/utility/help.js +0 -0
  16. /package/templates/vercel/{api/src → src}/commands/utility/index.js +0 -0
  17. /package/templates/vercel/{api/src → src}/commands/utility/info.js +0 -0
  18. /package/templates/vercel/{api/src → src}/commands/utility/profile.js +0 -0
  19. /package/templates/vercel/{api/src → src}/index.js +0 -0
  20. /package/templates/vercel/{api/src → src}/spawner.js +0 -0
  21. /package/templates/vercel-ts/{api/src → src}/DevLayer.js +0 -0
  22. /package/templates/vercel-ts/{api/src → src}/commands/fun/joke.ts +0 -0
  23. /package/templates/vercel-ts/{api/src → src}/commands/index.ts +0 -0
  24. /package/templates/vercel-ts/{api/src → src}/commands/reply/ping.ts +0 -0
  25. /package/templates/vercel-ts/{api/src → src}/commands/utility/help.ts +0 -0
  26. /package/templates/vercel-ts/{api/src → src}/commands/utility/index.ts +0 -0
  27. /package/templates/vercel-ts/{api/src → src}/commands/utility/info.ts +0 -0
  28. /package/templates/vercel-ts/{api/src → src}/commands/utility/profile.ts +0 -0
  29. /package/templates/vercel-ts/{api/src → src}/index.ts +0 -0
  30. /package/templates/vercel-ts/{api/src → src}/spawner.js +0 -0
package/index.js CHANGED
@@ -253,9 +253,8 @@ async function init() {
253
253
  pkg.name = packageName;
254
254
  write("package.json", JSON.stringify(pkg, null, 2) + "\n");
255
255
  const ext = template.split("-")[1] ? "ts" : "js";
256
- let srcEntry = template.startsWith("vercel") ? "api/src" : "src";
257
- await setupSecret(root, `${srcEntry}/index.${ext}`, secret);
258
- await setupSubdomain(root, `${srcEntry}/DevLayer.js`);
256
+ await setupSecret(root, `src/index.${ext}`, secret);
257
+ await setupSubdomain(root, `src/DevLayer.js`);
259
258
  let doneMessage = "";
260
259
  const cdProjectName = path.relative(cwd, root);
261
260
  doneMessage += `All done! Execute:\n`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-discord-https",
3
3
  "description": "Create Discord.https-powered bots with one command.",
4
- "version": "2.0.15",
4
+ "version": "2.0.16",
5
5
  "bin": {
6
6
  "create-discord-https": "index.js"
7
7
  },
@@ -1,5 +0,0 @@
1
- /*
2
- !api
3
- !vercel.json
4
- !*.html
5
- !package.json
@@ -1,8 +1,8 @@
1
1
  ## Discord.https
2
2
 
3
- Vercel’s serverless functions must be placed inside the api directory, anything outside this directory will be served as a public asset.
3
+ Vercel’s serverless functions must be placed inside the `api` directory. Anything outside this directory will be served as a public asset. Therefore, `vercel.json` is used to rewrite all requests to point to `api/interactions`, so that interactions will also resolve to `api/interactions`.
4
4
 
5
- By default, the URL is: `<vercel_url>/api/interactions`
5
+ By default, the URL is: `<vercel_url>/interactions`
6
6
 
7
7
  More details:
8
8
 
@@ -1,5 +1,5 @@
1
- import client from "./src/index.js";
1
+ import client from "../src/index.js";
2
2
 
3
3
  export default async function handler(req, res) {
4
- return await client.listen("api/interactions", req, res);
4
+ return await client.listen("interactions", req, res);
5
5
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://openapi.vercel.sh/vercel.json",
3
+ "rewrites": [
4
+ {
5
+ "source": "/(.*)",
6
+ "destination": "/api/interactions"
7
+ }
8
+ ]
9
+ }
@@ -1,5 +0,0 @@
1
- /*
2
- !api
3
- !vercel.json
4
- !*.html
5
- !package.json
@@ -1,13 +1,13 @@
1
1
  ## Discord.https
2
2
 
3
- Vercel’s serverless functions must be placed inside the api directory, anything outside this directory will be served as a public asset.
3
+ Vercel’s serverless functions must be placed inside the `api` directory. Anything outside this directory will be served as a public asset. Therefore, `vercel.json` is used to rewrite all requests to point to `api/interactions`, so that interactions will also resolve to `api/interactions`.
4
4
 
5
- By default, the URL is: `<vercel_url>/api/interactions`
5
+ By default, the URL is: `<vercel_url>/interactions`
6
6
 
7
7
  More details:
8
8
 
9
- * [Vercel](https://vercel.com)
10
- * [Vercel Functions Documentation](https://vercel.com/docs/functions)
9
+ - [Vercel](https://vercel.com)
10
+ - [Vercel Functions Documentation](https://vercel.com/docs/functions)
11
11
 
12
12
  ### How to deploy
13
13
 
@@ -29,4 +29,4 @@ npm run dev
29
29
 
30
30
  For more information, view `DevLayer.ts` or, `DevLayer.js`
31
31
 
32
- You don’t need a separate TypeScript build step—Vercel handles it automatically.
32
+ You don’t need a separate TypeScript build step—Vercel handles it automatically.
@@ -1,5 +1,5 @@
1
- import client from "./src/index.js";
1
+ import client from "../src/index.js";
2
2
  import type { VercelRequest, VercelResponse } from "@vercel/node";
3
3
  export default async function handler(req: VercelRequest, res: VercelResponse) {
4
- return await client.listen("api/interactions", req, res);
4
+ return await client.listen("interactions", req, res);
5
5
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://openapi.vercel.sh/vercel.json",
3
+ "rewrites": [
4
+ {
5
+ "source": "/(.*)",
6
+ "destination": "/api/interactions"
7
+ }
8
+ ]
9
+ }
File without changes
File without changes
File without changes
File without changes
File without changes