@batijs/cli 0.0.187 → 0.0.189

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/dist/boilerplates/@batijs/edgedb/files/$package.json.js +1 -1
  2. package/dist/boilerplates/@batijs/express/files/$package.json.js +2 -2
  3. package/dist/boilerplates/@batijs/fastify/files/$package.json.js +131 -0
  4. package/dist/boilerplates/@batijs/fastify/files/fastify-entry.ts +246 -0
  5. package/dist/boilerplates/@batijs/fastify/files/vike.d.ts +21 -0
  6. package/dist/boilerplates/@batijs/fastify/types/fastify-entry.d.ts +1 -0
  7. package/dist/boilerplates/@batijs/h3/files/$package.json.js +2 -2
  8. package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
  9. package/dist/boilerplates/@batijs/hono/files/$package.json.js +6 -6
  10. package/dist/boilerplates/@batijs/prettier/files/$.eslintrc.json.js +1 -2
  11. package/dist/boilerplates/@batijs/react/files/$.eslintrc.json.js +1 -2
  12. package/dist/boilerplates/@batijs/react/files/$package.json.js +2 -2
  13. package/dist/boilerplates/@batijs/react/files/pages/+onPageTransitionEnd.ts +1 -1
  14. package/dist/boilerplates/@batijs/react/files/pages/+onPageTransitionStart.ts +1 -1
  15. package/dist/boilerplates/@batijs/react/files/pages/_error/+Page.tsx +6 -7
  16. package/dist/boilerplates/@batijs/react/files/pages/star-wars/@id/+data.ts +2 -2
  17. package/dist/boilerplates/@batijs/react/types/pages/+config.d.ts +11 -0
  18. package/dist/boilerplates/@batijs/solid/files/$.eslintrc.json.js +1 -2
  19. package/dist/boilerplates/@batijs/solid/files/pages/+onPageTransitionEnd.ts +1 -1
  20. package/dist/boilerplates/@batijs/solid/files/pages/+onPageTransitionStart.ts +1 -1
  21. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+data.ts +2 -2
  22. package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +1 -1
  23. package/dist/boilerplates/@batijs/vue/files/$.eslintrc.json.js +1 -2
  24. package/dist/boilerplates/@batijs/vue/files/$package.json.js +4 -4
  25. package/dist/boilerplates/@batijs/vue/files/pages/+onPageTransitionEnd.ts +1 -1
  26. package/dist/boilerplates/@batijs/vue/files/pages/+onPageTransitionStart.ts +1 -1
  27. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/@id/+data.ts +2 -2
  28. package/dist/boilerplates/boilerplates.json +11 -0
  29. package/dist/index.js +3 -3
  30. package/package.json +7 -7
@@ -46,7 +46,7 @@ var require_package = __commonJS({
46
46
  "@prisma/client": "^5.13.0",
47
47
  "@types/node": "^18.19.14",
48
48
  colorette: "^2.0.20",
49
- edgedb: "^1.5.5"
49
+ edgedb: "^1.5.6"
50
50
  },
51
51
  dependencies: {
52
52
  "@batijs/core": "workspace:*"
@@ -41,7 +41,7 @@ var require_package = __commonJS({
41
41
  author: "",
42
42
  license: "MIT",
43
43
  devDependencies: {
44
- "@auth/core": "^0.30.0",
44
+ "@auth/core": "^0.31.0",
45
45
  "@batijs/compile": "workspace:*",
46
46
  "@batijs/firebase-auth": "workspace:*",
47
47
  "@batijs/trpc": "workspace:*",
@@ -56,7 +56,7 @@ var require_package = __commonJS({
56
56
  "express-openid-connect": "^2.17.1",
57
57
  "firebase-admin": "^12.1.0",
58
58
  telefunc: "^0.1.72",
59
- tsx: "^4.9.3",
59
+ tsx: "^4.10.1",
60
60
  vike: "^0.4.171",
61
61
  "vike-authjs": "^0.1.5",
62
62
  vite: "^5.2.11"
@@ -0,0 +1,131 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // package.json
28
+ var require_package = __commonJS({
29
+ "package.json"(exports, module) {
30
+ module.exports = {
31
+ name: "@batijs/fastify",
32
+ private: true,
33
+ version: "0.0.1",
34
+ description: "",
35
+ type: "module",
36
+ scripts: {
37
+ "check-types": "tsc --noEmit",
38
+ build: "bati-compile-boilerplate"
39
+ },
40
+ keywords: [],
41
+ author: "",
42
+ license: "MIT",
43
+ devDependencies: {
44
+ "@auth/core": "^0.31.0",
45
+ "@batijs/compile": "workspace:*",
46
+ "@batijs/firebase-auth": "workspace:*",
47
+ "@batijs/trpc": "workspace:^",
48
+ "@fastify/cookie": "^9.3.1",
49
+ "@fastify/formbody": "^7.4.0",
50
+ "@fastify/middie": "^8.3.1",
51
+ "@fastify/static": "^7.0.4",
52
+ "@hattip/adapter-node": "^0.0.45",
53
+ "@trpc/server": "^10.45.2",
54
+ "@types/express": "^4.17.21",
55
+ "@types/node": "^18.19.14",
56
+ dotenv: "^16.4.5",
57
+ express: "^4.19.2",
58
+ "express-openid-connect": "^2.17.1",
59
+ fastify: "^4.27.0",
60
+ "firebase-admin": "^12.1.0",
61
+ telefunc: "^0.1.72",
62
+ tsx: "^4.10.1",
63
+ vike: "^0.4.171",
64
+ "vike-authjs": "^0.1.5",
65
+ vite: "^5.2.11"
66
+ },
67
+ dependencies: {
68
+ "@batijs/core": "workspace:*"
69
+ },
70
+ files: [
71
+ "dist/"
72
+ ],
73
+ bati: {
74
+ if: {
75
+ flag: "fastify"
76
+ }
77
+ },
78
+ exports: {
79
+ "./fastify-entry": {
80
+ types: "./dist/types/fastify-entry.d.ts"
81
+ }
82
+ },
83
+ typesVersions: {
84
+ "*": {
85
+ "fastify-entry": [
86
+ "./dist/types/fastify-entry.d.ts"
87
+ ]
88
+ }
89
+ }
90
+ };
91
+ }
92
+ });
93
+
94
+ // files/$package.json.ts
95
+ import { addDependency, loadAsJson, setScripts } from "@batijs/core";
96
+ async function getPackageJson(props) {
97
+ const packageJson = await loadAsJson(props);
98
+ setScripts(packageJson, {
99
+ dev: {
100
+ value: "tsx ./fastify-entry.ts",
101
+ precedence: 20,
102
+ warnIfReplaced: true
103
+ },
104
+ build: {
105
+ value: "vite build",
106
+ precedence: 1,
107
+ warnIfReplaced: true
108
+ },
109
+ preview: {
110
+ value: "NODE_ENV=production tsx ./fastify-entry.ts",
111
+ precedence: 20
112
+ }
113
+ });
114
+ return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
115
+ devDependencies: ["@types/node", ...props.meta.BATI.has("auth0") ? ["@types/express", "dotenv"] : []],
116
+ dependencies: [
117
+ "@fastify/middie",
118
+ "@fastify/static",
119
+ "fastify",
120
+ "tsx",
121
+ "vike",
122
+ "vite",
123
+ ...props.meta.BATI.has("authjs") ? ["@auth/core", "@fastify/formbody", "@hattip/adapter-node", "vike-authjs"] : [],
124
+ ...props.meta.BATI.has("firebase-auth") ? ["@fastify/cookie"] : [],
125
+ ...props.meta.BATI.has("auth0") ? ["express", "express-openid-connect"] : []
126
+ ]
127
+ });
128
+ }
129
+ export {
130
+ getPackageJson as default
131
+ };
@@ -0,0 +1,246 @@
1
+ // BATI.has("auth0")
2
+ import "dotenv/config";
3
+ import { dirname } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import CredentialsProvider from "@auth/core/providers/credentials";
6
+ import { firebaseAdmin } from "@batijs/firebase-auth/libs/firebaseAdmin";
7
+ import { appRouter, type AppRouter } from "@batijs/trpc/trpc/server";
8
+ import { createMiddleware } from "@hattip/adapter-node";
9
+ import {
10
+ fastifyTRPCPlugin,
11
+ type CreateFastifyContextOptions,
12
+ type FastifyTRPCPluginOptions,
13
+ } from "@trpc/server/adapters/fastify";
14
+ import express from "express";
15
+ import { auth, type ConfigParams } from "express-openid-connect";
16
+ import Fastify from "fastify";
17
+ import { getAuth } from "firebase-admin/auth";
18
+ import { telefunc } from "telefunc";
19
+ import { VikeAuth } from "vike-authjs";
20
+ import { renderPage } from "vike/server";
21
+
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = dirname(__filename);
24
+ const isProduction = process.env.NODE_ENV === "production";
25
+ const root = __dirname;
26
+ const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
27
+ const hmrPort = process.env.HMR_PORT ? parseInt(process.env.HMR_PORT, 10) : 24678;
28
+
29
+ startServer();
30
+
31
+ async function startServer() {
32
+ const app = Fastify();
33
+
34
+ await app.register(await import("@fastify/middie"));
35
+
36
+ if (isProduction) {
37
+ await app.register(await import("@fastify/static"), {
38
+ root: `${root}/dist/client`,
39
+ wildcard: false,
40
+ });
41
+ } else {
42
+ // Instantiate Vite's development server and integrate its middleware to our server.
43
+ // ⚠️ We should instantiate it *only* in development. (It isn't needed in production
44
+ // and would unnecessarily bloat our server in production.)
45
+ const vite = await import("vite");
46
+ const viteDevMiddleware = (
47
+ await vite.createServer({
48
+ root,
49
+ server: { middlewareMode: true, hmr: { port: hmrPort } },
50
+ })
51
+ ).middlewares;
52
+ app.use(viteDevMiddleware);
53
+ }
54
+
55
+ if (BATI.has("authjs")) {
56
+ await app.register(await import("@fastify/formbody"));
57
+ /**
58
+ * AuthJS
59
+ *
60
+ * TODO: Replace secret {@see https://authjs.dev/reference/core#secret}
61
+ * TODO: Choose and implement providers
62
+ *
63
+ * @link {@see https://authjs.dev/guides/providers/custom-provider}
64
+ **/
65
+ const Auth = VikeAuth({
66
+ secret: "MY_SECRET",
67
+ providers: [
68
+ CredentialsProvider({
69
+ name: "Credentials",
70
+ credentials: {
71
+ username: { label: "Username", type: "text", placeholder: "jsmith" },
72
+ password: { label: "Password", type: "password" },
73
+ },
74
+ async authorize() {
75
+ // Add logic here to look up the user from the credentials supplied
76
+ const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
77
+
78
+ // Any object returned will be saved in `user` property of the JWT
79
+ // If you return null then an error will be displayed advising the user to check their details.
80
+ // You can also Reject this callback with an Error thus the user will be sent to the error page with the error message as a query parameter
81
+ return user ?? null;
82
+ },
83
+ }),
84
+ ],
85
+ });
86
+
87
+ app.addHook("onRequest", async (request, reply) => {
88
+ const vikeAuth = createMiddleware(Auth, {
89
+ alwaysCallNext: false,
90
+ });
91
+ const next = () =>
92
+ new Promise<void>((resolve) => {
93
+ vikeAuth(request.raw, reply.raw, () => resolve());
94
+ });
95
+ if (request.url.startsWith("/api/auth/")) {
96
+ await next();
97
+ }
98
+ return;
99
+ });
100
+ }
101
+
102
+ if (BATI.has("firebase-auth")) {
103
+ await app.register(await import("@fastify/cookie"));
104
+
105
+ app.addHook("onRequest", async (request) => {
106
+ const sessionCookie = request.cookies.__session;
107
+ if (sessionCookie) {
108
+ try {
109
+ const auth = getAuth(firebaseAdmin);
110
+ const decodedIdToken = await auth.verifySessionCookie(sessionCookie);
111
+ const user = await auth.getUser(decodedIdToken.sub);
112
+ request.user = user;
113
+ } catch (error) {
114
+ console.debug("verifySessionCookie:", error);
115
+ request.user = null;
116
+ }
117
+ }
118
+ });
119
+
120
+ app.post<{ Body: { idToken: string } }>("/api/sessionLogin", async (request, reply) => {
121
+ const idToken = request.body.idToken || "";
122
+
123
+ const expiresIn = 60 * 60 * 24 * 5 * 1000; // 5 days
124
+
125
+ try {
126
+ const auth = getAuth(firebaseAdmin);
127
+ const sessionCookie = await auth.createSessionCookie(idToken, { expiresIn });
128
+ reply.setCookie("__session", sessionCookie, {
129
+ path: "/", // The path needs to be set manually; otherwise, it will default to "/api" in this case.
130
+ maxAge: expiresIn,
131
+ httpOnly: true,
132
+ secure: true,
133
+ });
134
+
135
+ reply.code(200);
136
+ return reply.send({ status: "success" });
137
+ } catch (error) {
138
+ console.error("createSessionCookie failed :", error);
139
+
140
+ reply.code(401);
141
+ return reply.send({ status: "Unauthorized" });
142
+ }
143
+ });
144
+
145
+ app.post("/api/sessionLogout", (_, reply) => {
146
+ reply.clearCookie("__session");
147
+ reply.code(200);
148
+ return reply.send({ status: "Logged Out" });
149
+ });
150
+ }
151
+
152
+ if (BATI.has("auth0")) {
153
+ const config: ConfigParams = {
154
+ authRequired: false, // Controls whether authentication is required for all routes
155
+ auth0Logout: true, // Uses Auth0 logout feature
156
+ baseURL: process.env.BASE_URL?.startsWith("http") ? process.env.BASE_URL : `http://localhost:${port}`, // The URL where the application is served
157
+ routes: {
158
+ login: "/api/auth/login", // Custom login route, default is "/login"
159
+ logout: "/api/auth/logout", // Custom logout route, default is "/logout"
160
+ callback: "/api/auth/callback", // Custom callback route, default is "/callback"
161
+ },
162
+ };
163
+
164
+ const expressApp = express();
165
+
166
+ app.use(expressApp.use(auth(config)));
167
+ }
168
+
169
+ if (BATI.has("trpc")) {
170
+ /**
171
+ * tRPC route
172
+ *
173
+ * @link {@see https://trpc.io/docs/server/adapters/fastify}
174
+ **/
175
+ await app.register(fastifyTRPCPlugin, {
176
+ prefix: "/api/trpc",
177
+ trpcOptions: {
178
+ router: appRouter,
179
+ createContext({ req, res }: CreateFastifyContextOptions) {
180
+ return { req, res };
181
+ },
182
+ onError({ path, error }) {
183
+ // report to error monitoring
184
+ console.error(`Error in tRPC handler on path '${path}':`, error);
185
+ },
186
+ } satisfies FastifyTRPCPluginOptions<AppRouter>["trpcOptions"],
187
+ });
188
+ }
189
+
190
+ if (BATI.has("telefunc")) {
191
+ /**
192
+ * Telefunc route
193
+ *
194
+ * @link {@see https://telefunc.com}
195
+ **/
196
+ app.post<{ Body: string }>("/_telefunc", async (request, reply) => {
197
+ const httpResponse = await telefunc({
198
+ url: request.originalUrl || request.url,
199
+ method: request.method,
200
+ body: request.body,
201
+ context: request,
202
+ });
203
+ const { body, statusCode, contentType } = httpResponse;
204
+
205
+ reply.code(statusCode);
206
+ reply.type(contentType);
207
+ return reply.send(body);
208
+ });
209
+ }
210
+
211
+ /**
212
+ * Vike route
213
+ *
214
+ * @link {@see https://vike.dev}
215
+ **/
216
+ app.all("/*", async function (request, reply) {
217
+ const pageContextInit = BATI.has("auth0")
218
+ ? { urlOriginal: request.originalUrl || request.url, user: request.raw.oidc.user }
219
+ : BATI.has("firebase-auth")
220
+ ? { urlOriginal: request.originalUrl || request.url, user: request.user }
221
+ : { urlOriginal: request.originalUrl || request.url };
222
+
223
+ const pageContext = await renderPage(pageContextInit);
224
+ const { httpResponse } = pageContext;
225
+
226
+ if (!httpResponse) {
227
+ return;
228
+ } else {
229
+ const { statusCode, headers, body } = httpResponse;
230
+
231
+ headers.forEach(([name, value]) => reply.header(name, value));
232
+ reply.code(statusCode);
233
+
234
+ return reply.send(body);
235
+ }
236
+ });
237
+
238
+ app.listen(
239
+ {
240
+ port: port,
241
+ },
242
+ () => {
243
+ console.log(`Server listening on http://localhost:${port}`);
244
+ },
245
+ );
246
+ }
@@ -0,0 +1,21 @@
1
+ import type { RequestContext, ResponseContext } from "express-openid-connect";
2
+ import type { UserRecord } from "firebase-admin/auth";
3
+
4
+ //# BATI.has("auth0")
5
+ declare module "node:http" {
6
+ interface IncomingMessage {
7
+ oidc: RequestContext;
8
+ }
9
+ interface ServerResponse {
10
+ oidc: ResponseContext;
11
+ }
12
+ }
13
+
14
+ //# BATI.has("firebase-auth")
15
+ declare module "fastify" {
16
+ interface FastifyRequest {
17
+ user: UserRecord | null;
18
+ }
19
+ }
20
+
21
+ export {};
@@ -0,0 +1 @@
1
+ import "dotenv/config";
@@ -41,7 +41,7 @@ var require_package = __commonJS({
41
41
  author: "",
42
42
  license: "MIT",
43
43
  devDependencies: {
44
- "@auth/core": "^0.30.0",
44
+ "@auth/core": "^0.31.0",
45
45
  "@batijs/compile": "workspace:*",
46
46
  "@batijs/firebase-auth": "workspace:*",
47
47
  "@batijs/trpc": "workspace:^",
@@ -57,7 +57,7 @@ var require_package = __commonJS({
57
57
  h3: "~1.11.1",
58
58
  "serve-static": "^1.15.0",
59
59
  telefunc: "^0.1.72",
60
- tsx: "^4.9.3",
60
+ tsx: "^4.10.1",
61
61
  vike: "^0.4.171",
62
62
  "vike-authjs": "^0.1.5",
63
63
  vite: "^5.2.11"
@@ -41,7 +41,7 @@ var require_package = __commonJS({
41
41
  author: "",
42
42
  license: "MIT",
43
43
  devDependencies: {
44
- "@auth/core": "^0.30.0",
44
+ "@auth/core": "^0.31.0",
45
45
  "@batijs/compile": "workspace:*",
46
46
  "@batijs/trpc": "workspace:^",
47
47
  "@hattip/adapter-node": "^0.0.45",
@@ -41,21 +41,21 @@ var require_package = __commonJS({
41
41
  author: "",
42
42
  license: "MIT",
43
43
  devDependencies: {
44
- "@auth/core": "^0.29.0",
44
+ "@auth/core": "^0.31.0",
45
45
  "@batijs/compile": "workspace:*",
46
46
  "@batijs/firebase-auth": "workspace:*",
47
47
  "@batijs/trpc": "workspace:^",
48
48
  "@hono/node-server": "^1.11.1",
49
- "@hono/vite-dev-server": "^0.12.0",
49
+ "@hono/vite-dev-server": "^0.12.1",
50
50
  "@trpc/server": "^10.45.2",
51
51
  "@types/node": "^18.19.14",
52
52
  "firebase-admin": "^12.1.0",
53
- hono: "^4.2.9",
53
+ hono: "^4.3.6",
54
54
  telefunc: "^0.1.72",
55
- tsx: "^4.7.2",
56
- vike: "^0.4.168",
55
+ tsx: "^4.10.1",
56
+ vike: "^0.4.171",
57
57
  "vike-authjs": "^0.1.5",
58
- vite: "^5.2.8"
58
+ vite: "^5.2.11"
59
59
  },
60
60
  dependencies: {
61
61
  "@batijs/core": "workspace:*"
@@ -1,8 +1,7 @@
1
1
  // files/$.eslintrc.json.ts
2
2
  import { loadAsJson } from "@batijs/core";
3
3
  async function getEslintConfig(props) {
4
- if (!props.meta.BATI.has("eslint"))
5
- return;
4
+ if (!props.meta.BATI.has("eslint")) return;
6
5
  const eslintConfig = await loadAsJson(props);
7
6
  eslintConfig.extends.push("prettier");
8
7
  return eslintConfig;
@@ -1,8 +1,7 @@
1
1
  // files/$.eslintrc.json.ts
2
2
  import { loadAsJson } from "@batijs/core";
3
3
  async function getEslintConfig(props) {
4
- if (!props.meta.BATI.has("eslint"))
5
- return;
4
+ if (!props.meta.BATI.has("eslint")) return;
6
5
  const eslintConfig = await loadAsJson(props);
7
6
  eslintConfig.extends = eslintConfig.extends.filter(
8
7
  (p) => p !== "eslint:recommended" && p !== "plugin:@typescript-eslint/recommended"
@@ -46,7 +46,7 @@ var require_package = __commonJS({
46
46
  "@babel/plugin-transform-react-jsx": "^7.23.4",
47
47
  "@batijs/compile": "workspace:*",
48
48
  "@types/node": "^18.19.14",
49
- "@types/react": "^18.3.1",
49
+ "@types/react": "^18.3.2",
50
50
  "@types/react-dom": "^18.3.0",
51
51
  "@vitejs/plugin-react": "^4.2.1",
52
52
  "cross-fetch": "^4.0.0",
@@ -56,7 +56,7 @@ var require_package = __commonJS({
56
56
  tailwindcss: "^3.4.3",
57
57
  typescript: "^5.4.5",
58
58
  vike: "^0.4.171",
59
- "vike-react": "^0.4.8",
59
+ "vike-react": "^0.4.9",
60
60
  vite: "^5.2.11"
61
61
  },
62
62
  dependencies: {
@@ -2,5 +2,5 @@ import type { OnPageTransitionEndAsync } from "vike/types";
2
2
 
3
3
  export const onPageTransitionEnd: OnPageTransitionEndAsync = async () => {
4
4
  console.log("Page transition end");
5
- document.querySelector("body")!.classList.remove("page-is-transitioning");
5
+ document.querySelector("body")?.classList.remove("page-is-transitioning");
6
6
  };
@@ -2,5 +2,5 @@ import type { OnPageTransitionStartAsync } from "vike/types";
2
2
 
3
3
  export const onPageTransitionStart: OnPageTransitionStartAsync = async () => {
4
4
  console.log("Page transition start");
5
- document.querySelector("body")!.classList.add("page-is-transitioning");
5
+ document.querySelector("body")?.classList.add("page-is-transitioning");
6
6
  };
@@ -10,12 +10,11 @@ export default function Page() {
10
10
  <p>This page could not be found.</p>
11
11
  </>
12
12
  );
13
- } else {
14
- return (
15
- <>
16
- <h1>500 Internal Server Error</h1>
17
- <p>Something went wrong.</p>
18
- </>
19
- );
20
13
  }
14
+ return (
15
+ <>
16
+ <h1>500 Internal Server Error</h1>
17
+ <p>Something went wrong.</p>
18
+ </>
19
+ );
21
20
  }
@@ -17,6 +17,6 @@ export const data = async (pageContext: PageContextServer) => {
17
17
 
18
18
  function minimize(movie: MovieDetails): MovieDetails {
19
19
  const { id, title, release_date, director, producer } = movie;
20
- movie = { id, title, release_date, director, producer };
21
- return movie;
20
+ const minimizedMovie = { id, title, release_date, director, producer };
21
+ return minimizedMovie;
22
22
  }
@@ -58,6 +58,11 @@ declare const _default: {
58
58
  server: true;
59
59
  };
60
60
  };
61
+ onBeforeRenderClient: {
62
+ env: {
63
+ client: true;
64
+ };
65
+ };
61
66
  onAfterRenderClient: {
62
67
  env: {
63
68
  client: true;
@@ -80,6 +85,12 @@ declare const _default: {
80
85
  config: true;
81
86
  };
82
87
  };
88
+ reactStrictMode: {
89
+ env: {
90
+ client: true;
91
+ server: true;
92
+ };
93
+ };
83
94
  };
84
95
  };
85
96
  meta: {
@@ -1,8 +1,7 @@
1
1
  // files/$.eslintrc.json.ts
2
2
  import { loadAsJson } from "@batijs/core";
3
3
  async function getEslintConfig(props) {
4
- if (!props.meta.BATI.has("eslint"))
5
- return;
4
+ if (!props.meta.BATI.has("eslint")) return;
6
5
  const eslintConfig = await loadAsJson(props);
7
6
  eslintConfig.extends.push("plugin:solid/typescript");
8
7
  eslintConfig.plugins.push("solid");
@@ -2,5 +2,5 @@ import type { OnPageTransitionEndAsync } from "vike/types";
2
2
 
3
3
  export const onPageTransitionEnd: OnPageTransitionEndAsync = async () => {
4
4
  console.log("Page transition end");
5
- document.querySelector("body")!.classList.remove("page-is-transitioning");
5
+ document.querySelector("body")?.classList.remove("page-is-transitioning");
6
6
  };
@@ -2,5 +2,5 @@ import type { OnPageTransitionStartAsync } from "vike/types";
2
2
 
3
3
  export const onPageTransitionStart: OnPageTransitionStartAsync = async () => {
4
4
  console.log("Page transition start");
5
- document.querySelector("body")!.classList.add("page-is-transitioning");
5
+ document.querySelector("body")?.classList.add("page-is-transitioning");
6
6
  };
@@ -17,6 +17,6 @@ export const data = async (pageContext: PageContextServer) => {
17
17
 
18
18
  function minimize(movie: MovieDetails): MovieDetails {
19
19
  const { id, title, release_date, director, producer } = movie;
20
- movie = { id, title, release_date, director, producer };
21
- return movie;
20
+ const minimizedMovie = { id, title, release_date, director, producer };
21
+ return minimizedMovie;
22
22
  }
@@ -44,7 +44,7 @@ var require_package = __commonJS({
44
44
  "@batijs/compile": "workspace:*",
45
45
  "@types/node": "^18.19.14",
46
46
  autoprefixer: "^10.4.19",
47
- daisyui: "^4.10.5",
47
+ daisyui: "^4.11.1",
48
48
  postcss: "^8.4.38",
49
49
  tailwindcss: "^3.4.3",
50
50
  vike: "^0.4.171",
@@ -1,8 +1,7 @@
1
1
  // files/$.eslintrc.json.ts
2
2
  import { loadAsJson } from "@batijs/core";
3
3
  async function getEslintConfig(props) {
4
- if (!props.meta.BATI.has("eslint"))
5
- return;
4
+ if (!props.meta.BATI.has("eslint")) return;
6
5
  const eslintConfig = await loadAsJson(props);
7
6
  eslintConfig.extends.push("plugin:vue/vue3-recommended");
8
7
  eslintConfig.parser = "vue-eslint-parser";
@@ -44,17 +44,17 @@ var require_package = __commonJS({
44
44
  "@batijs/compile": "workspace:*",
45
45
  "@types/node": "^18.19.14",
46
46
  "@vitejs/plugin-vue": "^5.0.4",
47
- "@vue/compiler-sfc": "^3.4.26",
48
- "@vue/server-renderer": "^3.4.26",
47
+ "@vue/compiler-sfc": "^3.4.27",
48
+ "@vue/server-renderer": "^3.4.27",
49
49
  "cross-fetch": "^4.0.0",
50
- "eslint-plugin-vue": "^9.25.0",
50
+ "eslint-plugin-vue": "^9.26.0",
51
51
  tailwindcss: "^3.4.3",
52
52
  typescript: "^5.4.5",
53
53
  "unplugin-vue-markdown": "^0.26.2",
54
54
  vike: "^0.4.171",
55
55
  "vike-vue": "^0.6.5",
56
56
  vite: "^5.2.11",
57
- vue: "^3.4.26",
57
+ vue: "^3.4.27",
58
58
  "vue-gtag": "^2.0.1"
59
59
  },
60
60
  dependencies: {
@@ -2,5 +2,5 @@ import type { OnPageTransitionEndAsync } from "vike/types";
2
2
 
3
3
  export const onPageTransitionEnd: OnPageTransitionEndAsync = async () => {
4
4
  console.log("Page transition end");
5
- document.querySelector("body")!.classList.remove("page-is-transitioning");
5
+ document.querySelector("body")?.classList.remove("page-is-transitioning");
6
6
  };
@@ -2,5 +2,5 @@ import type { OnPageTransitionStartAsync } from "vike/types";
2
2
 
3
3
  export const onPageTransitionStart: OnPageTransitionStartAsync = async () => {
4
4
  console.log("Page transition start");
5
- document.querySelector("body")!.classList.add("page-is-transitioning");
5
+ document.querySelector("body")?.classList.add("page-is-transitioning");
6
6
  };
@@ -17,6 +17,6 @@ export const data = async (pageContext: PageContextServer) => {
17
17
 
18
18
  function minimize(movie: MovieDetails): MovieDetails {
19
19
  const { id, title, release_date, director, producer } = movie;
20
- movie = { id, title, release_date, director, producer };
21
- return movie;
20
+ const minimizedMovie = { id, title, release_date, director, producer };
21
+ return minimizedMovie;
22
22
  }
@@ -54,6 +54,17 @@
54
54
  "files"
55
55
  ]
56
56
  },
57
+ {
58
+ "config": {
59
+ "if": {
60
+ "flag": "fastify"
61
+ }
62
+ },
63
+ "folder": "@batijs/fastify",
64
+ "subfolders": [
65
+ "files"
66
+ ]
67
+ },
57
68
  {
58
69
  "config": {
59
70
  "if": {
package/dist/index.js CHANGED
@@ -1537,7 +1537,7 @@ var createDefaultQueryTester = function(query, options) {
1537
1537
  // package.json
1538
1538
  var package_default = {
1539
1539
  name: "@batijs/cli",
1540
- version: "0.0.187",
1540
+ version: "0.0.189",
1541
1541
  type: "module",
1542
1542
  scripts: {
1543
1543
  "check-types": "tsc --noEmit",
@@ -1557,9 +1557,9 @@ var package_default = {
1557
1557
  "@types/which": "^3.0.3",
1558
1558
  citty: "^0.1.6",
1559
1559
  colorette: "^2.0.20",
1560
- esbuild: "^0.20.2",
1560
+ esbuild: "^0.21.2",
1561
1561
  execa: "^8.0.1",
1562
- rimraf: "^5.0.5",
1562
+ rimraf: "^5.0.7",
1563
1563
  sift: "^17.1.3",
1564
1564
  tsup: "^8.0.2",
1565
1565
  typescript: "^5.4.5",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.187",
3
+ "version": "0.0.189",
4
4
  "type": "module",
5
5
  "keywords": [],
6
6
  "description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
@@ -12,19 +12,19 @@
12
12
  "@types/which": "^3.0.3",
13
13
  "citty": "^0.1.6",
14
14
  "colorette": "^2.0.20",
15
- "esbuild": "^0.20.2",
15
+ "esbuild": "^0.21.2",
16
16
  "execa": "^8.0.1",
17
- "rimraf": "^5.0.5",
17
+ "rimraf": "^5.0.7",
18
18
  "sift": "^17.1.3",
19
19
  "tsup": "^8.0.2",
20
20
  "typescript": "^5.4.5",
21
21
  "vite": "^5.2.11",
22
- "@batijs/build": "0.0.187",
23
- "@batijs/compile": "0.0.187"
22
+ "@batijs/compile": "0.0.189",
23
+ "@batijs/build": "0.0.189"
24
24
  },
25
25
  "dependencies": {
26
- "@batijs/core": "0.0.187",
27
- "@batijs/features": "0.0.187"
26
+ "@batijs/features": "0.0.189",
27
+ "@batijs/core": "0.0.189"
28
28
  },
29
29
  "bin": "./dist/index.js",
30
30
  "exports": {