@alxia/create 0.1.7 → 0.2.0

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 (65) hide show
  1. package/README.md +80 -25
  2. package/dist/args.d.ts +3 -1
  3. package/dist/args.d.ts.map +1 -1
  4. package/dist/index.js +19 -9
  5. package/dist/index.js.map +7 -7
  6. package/dist/main.d.ts +1 -1
  7. package/dist/main.d.ts.map +1 -1
  8. package/dist/registry.d.ts +2 -0
  9. package/dist/registry.d.ts.map +1 -1
  10. package/dist/versions.d.ts +5 -2
  11. package/dist/versions.d.ts.map +1 -1
  12. package/docs/README.md +16 -6
  13. package/docs/guide.md +428 -47
  14. package/docs/roadmap.md +24 -0
  15. package/docs/troubleshooting.md +152 -9
  16. package/package.json +15 -5
  17. package/templates/api/.env.example +9 -1
  18. package/templates/api/README.md +40 -12
  19. package/templates/api/openapi.yaml +13 -9
  20. package/templates/api/package.json +5 -3
  21. package/templates/api/src/app.spec.ts +42 -28
  22. package/templates/api/src/app.ts +13 -3
  23. package/templates/api/src/context.ts +3 -4
  24. package/templates/api/src/env.ts +20 -0
  25. package/templates/api/src/generated/alxia.ts +3 -3
  26. package/templates/api/src/generated/operations.ts +3 -3
  27. package/templates/api/src/generated/paths.ts +6 -6
  28. package/templates/api/src/generated/types.ts +14 -10
  29. package/templates/api/src/generated/zod.ts +6 -2
  30. package/templates/api/src/routes/todos.ts +2 -2
  31. package/templates/api/src/server.ts +8 -16
  32. package/templates/graphql/.dockerignore +6 -0
  33. package/templates/graphql/.env.example +3 -0
  34. package/templates/graphql/.vscode/extensions.json +3 -0
  35. package/templates/graphql/.vscode/settings.json +8 -0
  36. package/templates/graphql/Dockerfile +26 -0
  37. package/templates/graphql/README.md +171 -0
  38. package/templates/graphql/_biome.json +32 -0
  39. package/templates/graphql/codegen.ts +22 -0
  40. package/templates/graphql/gitignore +6 -0
  41. package/templates/graphql/package.json +34 -0
  42. package/templates/graphql/schema.graphql +26 -0
  43. package/templates/graphql/src/app.spec.ts +119 -0
  44. package/templates/graphql/src/app.ts +14 -0
  45. package/templates/graphql/src/context.ts +24 -0
  46. package/templates/graphql/src/env.ts +8 -0
  47. package/templates/graphql/src/generated/resolvers.ts +180 -0
  48. package/templates/graphql/src/graphql.d.ts +6 -0
  49. package/templates/graphql/src/resolvers.ts +42 -0
  50. package/templates/graphql/src/schema.ts +6 -0
  51. package/templates/graphql/src/server.ts +10 -0
  52. package/templates/graphql/src/store.ts +25 -0
  53. package/templates/graphql/tsconfig.json +25 -0
  54. package/templates/minimal/.dockerignore +6 -0
  55. package/templates/minimal/.vscode/extensions.json +3 -0
  56. package/templates/minimal/.vscode/settings.json +8 -0
  57. package/templates/minimal/Dockerfile +26 -0
  58. package/templates/minimal/README.md +107 -0
  59. package/templates/minimal/_biome.json +32 -0
  60. package/templates/minimal/gitignore +6 -0
  61. package/templates/minimal/package.json +25 -0
  62. package/templates/minimal/src/index.spec.ts +12 -0
  63. package/templates/minimal/src/index.ts +17 -0
  64. package/templates/minimal/tsconfig.json +25 -0
  65. package/templates/react-router/package.json +2 -2
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "my-app",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "NODE_ENV=development bun --hot src/index.ts",
7
+ "build": "bun build src/index.ts --target=bun --outdir=dist --minify --sourcemap=linked",
8
+ "start": "NODE_ENV=production bun dist/index.js",
9
+ "test": "bun test",
10
+ "typecheck": "tsc --noEmit",
11
+ "lint": "biome lint",
12
+ "format": "biome format --write",
13
+ "check": "biome check --write",
14
+ "check:ci": "biome ci",
15
+ "verify": "bun run check:ci && bun run typecheck && bun run test"
16
+ },
17
+ "dependencies": {
18
+ "@alxia/core": "workspace:^"
19
+ },
20
+ "devDependencies": {
21
+ "@biomejs/biome": "2.5.15",
22
+ "@types/bun": "^1.4.2",
23
+ "typescript": "^6.0.3"
24
+ }
25
+ }
@@ -0,0 +1,12 @@
1
+ import { expect, test } from "bun:test";
2
+ import { app } from "./index";
3
+
4
+ test("GET / says hello", async () => {
5
+ const response = await app.request("/");
6
+ expect(response.status).toBe(200);
7
+ expect(await response.json()).toEqual({ hello: "world" });
8
+ });
9
+
10
+ test("a path no route has is a 404", async () => {
11
+ expect((await app.request("/nowhere")).status).toBe(404);
12
+ });
@@ -0,0 +1,17 @@
1
+ import { alxia } from "@alxia/core";
2
+
3
+ export const app = alxia().get("/", ({ reply }) =>
4
+ reply(200, { hello: "world" }),
5
+ );
6
+
7
+ // Only when this file is the entry: the test imports `app` and listens on
8
+ // no port.
9
+ if (import.meta.main) {
10
+ // In dev, the URL and the route table; in production, the URL alone. On
11
+ // SIGINT and SIGTERM, listen drains the requests in flight and exits.
12
+ app.listen({
13
+ port: Number(Bun.env["PORT"] ?? 3000),
14
+ onListen: ({ dev, table, url }) =>
15
+ console.log(dev ? table : `listening on ${url}`),
16
+ });
17
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "types": ["bun"],
4
+ "lib": ["ESNext", "DOM"],
5
+ "target": "ESNext",
6
+ "module": "ESNext",
7
+ "moduleDetection": "force",
8
+ "moduleResolution": "bundler",
9
+ "verbatimModuleSyntax": true,
10
+ "noEmit": true,
11
+ "skipLibCheck": true,
12
+ "resolveJsonModule": true,
13
+ "strict": true,
14
+ "noImplicitOverride": true,
15
+ "noImplicitReturns": true,
16
+ "noFallthroughCasesInSwitch": true,
17
+ "noUncheckedIndexedAccess": true,
18
+ "exactOptionalPropertyTypes": true,
19
+ "noPropertyAccessFromIndexSignature": true,
20
+ "noUnusedLocals": true,
21
+ "noUnusedParameters": true,
22
+ "forceConsistentCasingInFileNames": true
23
+ },
24
+ "include": ["src"]
25
+ }
@@ -4,8 +4,8 @@
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "react-router build",
7
- "dev": "react-router dev",
8
- "start": "bun build/server/index.js",
7
+ "dev": "NODE_ENV=development react-router dev",
8
+ "start": "NODE_ENV=production bun build/server/index.js",
9
9
  "typecheck": "react-router typegen && tsc",
10
10
  "lint": "biome lint",
11
11
  "format": "biome format --write",