@batijs/cli 0.0.24 → 0.0.25

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 (40) hide show
  1. package/README.md +3 -3
  2. package/dist/boilerplates/@batijs/edgedb/files/$package.json.js +1 -1
  3. package/dist/boilerplates/@batijs/edgedb/{package-N7DN6762.js → package-NAEM3YOJ.js} +1 -1
  4. package/dist/boilerplates/@batijs/express/files/$package.json.js +1 -1
  5. package/dist/boilerplates/@batijs/express/files/express-entry.ts +124 -124
  6. package/dist/boilerplates/@batijs/express/{package-MQDB4QVK.js → package-VWSKNQQS.js} +1 -1
  7. package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
  8. package/dist/boilerplates/@batijs/hattip/files/hattip-entry.ts +88 -88
  9. package/dist/boilerplates/@batijs/hattip/{package-ZHZMC652.js → package-PAHNC63I.js} +1 -1
  10. package/dist/boilerplates/@batijs/prisma/files/$package.json.js +1 -1
  11. package/dist/boilerplates/@batijs/prisma/{package-3DP6BNRZ.js → package-42T5MPMS.js} +1 -1
  12. package/dist/boilerplates/@batijs/shared/files/package.json +2 -2
  13. package/dist/boilerplates/@batijs/shared/files/tsconfig.json +18 -18
  14. package/dist/boilerplates/@batijs/shared/files/vite.config.ts +5 -5
  15. package/dist/boilerplates/@batijs/solid/files/$package.json.js +1 -1
  16. package/dist/boilerplates/@batijs/solid/files/assets/logo.svg +36 -36
  17. package/dist/boilerplates/@batijs/solid/files/components/Link.tsx +14 -14
  18. package/dist/boilerplates/@batijs/solid/files/layouts/HeadDefault.tsx +22 -22
  19. package/dist/boilerplates/@batijs/solid/files/layouts/LayoutDefault.tsx +87 -87
  20. package/dist/boilerplates/@batijs/solid/files/layouts/style.css +29 -29
  21. package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +13 -13
  22. package/dist/boilerplates/@batijs/solid/files/pages/_error/+Page.tsx +18 -18
  23. package/dist/boilerplates/@batijs/solid/files/pages/index/+Page.tsx +21 -21
  24. package/dist/boilerplates/@batijs/solid/files/pages/index/Counter.tsx +18 -18
  25. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+Page.tsx +14 -14
  26. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+onBeforeRender.ts +27 -27
  27. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/filterMovieData.ts +11 -11
  28. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+Page.tsx +22 -22
  29. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+onBeforeRender.ts +80 -80
  30. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/types.ts +13 -13
  31. package/dist/boilerplates/@batijs/solid/{package-6HR5REIL.js → package-DVZ6BETH.js} +1 -1
  32. package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +1 -1
  33. package/dist/boilerplates/@batijs/tailwindcss/files/layouts/tailwind.css +2 -2
  34. package/dist/boilerplates/@batijs/tailwindcss/files/postcss.config.js +6 -6
  35. package/dist/boilerplates/@batijs/tailwindcss/files/tailwind.config.js +8 -8
  36. package/dist/boilerplates/@batijs/tailwindcss/{package-G265GCGU.js → package-7CSFX2AA.js} +1 -1
  37. package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +1 -1
  38. package/dist/boilerplates/@batijs/telefunc/{package-JYH3G3DH.js → package-42IE3DIX.js} +1 -1
  39. package/dist/index.js +12 -5
  40. package/package.json +9 -6
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @batijs/cli
2
-
3
- WIP
1
+ # @batijs/cli
2
+
3
+ WIP
@@ -4,7 +4,7 @@ async function getPackageJson(currentContent) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
5
  packageJson.scripts["edgedb:generate-queries"] = "@edgedb/generate queries";
6
6
  packageJson.scripts["edgedb:generate-edgeql-js"] = "@edgedb/generate edgeql-js";
7
- return addDependency(packageJson, await import("../package-N7DN6762.js"), {
7
+ return addDependency(packageJson, await import("../package-NAEM3YOJ.js"), {
8
8
  devDependencies: ["@edgedb/generate"],
9
9
  dependencies: ["edgedb"]
10
10
  });
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/edgedb";
3
3
  var private2 = true;
4
- var version = "0.0.24";
4
+ var version = "0.0.25";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -4,7 +4,7 @@ async function getPackageJson(currentContent, meta) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
5
  packageJson.scripts.dev = "tsx ./express-entry.ts";
6
6
  packageJson.scripts.build = "vite build";
7
- return addDependency(packageJson, await import("../package-MQDB4QVK.js"), {
7
+ return addDependency(packageJson, await import("../package-VWSKNQQS.js"), {
8
8
  devDependencies: ["@types/express"],
9
9
  dependencies: [
10
10
  "@hattip/adapter-node",
@@ -1,124 +1,124 @@
1
- import { renderPage } from "vite-plugin-ssr/server";
2
- import { telefunc } from "telefunc";
3
- import { VikeAuth } from "vike-authjs";
4
- import CredentialsProvider from "@auth/core/providers/credentials";
5
- import express from "express";
6
- import { createMiddleware } from "@hattip/adapter-node";
7
- import { fileURLToPath } from "node:url";
8
- import { dirname } from "node:path/posix";
9
-
10
- const __filename = fileURLToPath(import.meta.url);
11
- const __dirname = dirname(__filename);
12
- const isProduction = process.env.NODE_ENV === "production";
13
- const root = __dirname;
14
-
15
- startServer();
16
-
17
- async function startServer() {
18
- const app = express();
19
-
20
- if (isProduction) {
21
- app.use(express.static(`${root}/dist/client`));
22
- } else {
23
- // Instantiate Vite's development server and integrate its middleware to our server.
24
- // ⚠️ We should instantiate it *only* in development. (It isn't needed in production
25
- // and would unnecessarily bloat our server in production.)
26
- const vite = await import("vite");
27
- const viteDevMiddleware = (
28
- await vite.createServer({
29
- root,
30
- server: { middlewareMode: true },
31
- })
32
- ).middlewares;
33
- app.use(viteDevMiddleware);
34
- }
35
-
36
- if (import.meta.BATI_MODULES?.includes("auth:authjs")) {
37
- /**
38
- * AuthJS
39
- *
40
- * TODO: Replace secret {@see https://authjs.dev/reference/core#secret}
41
- * TODO: Choose and implement providers
42
- *
43
- * @link {@see https://authjs.dev/guides/providers/custom-provider}
44
- **/
45
- const Auth = VikeAuth({
46
- secret: "MY_SECRET",
47
- providers: [
48
- CredentialsProvider({
49
- name: "Credentials",
50
- credentials: {
51
- username: { label: "Username", type: "text", placeholder: "jsmith" },
52
- password: { label: "Password", type: "password" },
53
- },
54
- async authorize(credentials, req) {
55
- // Add logic here to look up the user from the credentials supplied
56
- const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
57
-
58
- // Any object returned will be saved in `user` property of the JWT
59
- // If you return null then an error will be displayed advising the user to check their details.
60
- // 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
61
- return user ?? null;
62
- },
63
- }),
64
- ],
65
- });
66
-
67
- app.all(
68
- "/api/auth/*",
69
- createMiddleware(Auth, {
70
- alwaysCallNext: false,
71
- })
72
- );
73
- }
74
-
75
- if (import.meta.BATI_MODULES?.includes("rpc:telefunc")) {
76
- /**
77
- * Telefunc route
78
- *
79
- * @link {@see https://telefunc.com}
80
- **/
81
- app.post(
82
- "/_telefunc",
83
- createMiddleware(
84
- async (context) => {
85
- const httpResponse = await telefunc({
86
- url: context.request.url.toString(),
87
- method: context.request.method,
88
- body: await context.request.text(),
89
- context,
90
- });
91
- const { body, statusCode, contentType } = httpResponse;
92
- return new Response(body, {
93
- status: statusCode,
94
- headers: {
95
- "content-type": contentType,
96
- },
97
- });
98
- },
99
- {
100
- alwaysCallNext: false,
101
- }
102
- )
103
- );
104
- }
105
-
106
- /**
107
- * Vike route
108
- *
109
- * @link {@see https://vite-plugin-ssr.com}
110
- **/
111
- app.all("*", async (req, res, next) => {
112
- const pageContextInit = { urlOriginal: req.originalUrl };
113
- const pageContext = await renderPage(pageContextInit);
114
- if (pageContext.httpResponse === null) return next();
115
-
116
- const { statusCode, contentType } = pageContext.httpResponse;
117
- res.status(statusCode).type(contentType);
118
- pageContext.httpResponse.pipe(res);
119
- });
120
-
121
- app.listen(process.env.PORT ? parseInt(process.env.PORT) : 3000, "localhost", () => {
122
- console.log("Server listening on http://localhost:3000");
123
- });
124
- }
1
+ import { renderPage } from "vite-plugin-ssr/server";
2
+ import { telefunc } from "telefunc";
3
+ import { VikeAuth } from "vike-authjs";
4
+ import CredentialsProvider from "@auth/core/providers/credentials";
5
+ import express from "express";
6
+ import { createMiddleware } from "@hattip/adapter-node";
7
+ import { fileURLToPath } from "node:url";
8
+ import { dirname } from "node:path/posix";
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
12
+ const isProduction = process.env.NODE_ENV === "production";
13
+ const root = __dirname;
14
+
15
+ startServer();
16
+
17
+ async function startServer() {
18
+ const app = express();
19
+
20
+ if (isProduction) {
21
+ app.use(express.static(`${root}/dist/client`));
22
+ } else {
23
+ // Instantiate Vite's development server and integrate its middleware to our server.
24
+ // ⚠️ We should instantiate it *only* in development. (It isn't needed in production
25
+ // and would unnecessarily bloat our server in production.)
26
+ const vite = await import("vite");
27
+ const viteDevMiddleware = (
28
+ await vite.createServer({
29
+ root,
30
+ server: { middlewareMode: true },
31
+ })
32
+ ).middlewares;
33
+ app.use(viteDevMiddleware);
34
+ }
35
+
36
+ if (import.meta.BATI_MODULES?.includes("auth:authjs")) {
37
+ /**
38
+ * AuthJS
39
+ *
40
+ * TODO: Replace secret {@see https://authjs.dev/reference/core#secret}
41
+ * TODO: Choose and implement providers
42
+ *
43
+ * @link {@see https://authjs.dev/guides/providers/custom-provider}
44
+ **/
45
+ const Auth = VikeAuth({
46
+ secret: "MY_SECRET",
47
+ providers: [
48
+ CredentialsProvider({
49
+ name: "Credentials",
50
+ credentials: {
51
+ username: { label: "Username", type: "text", placeholder: "jsmith" },
52
+ password: { label: "Password", type: "password" },
53
+ },
54
+ async authorize(credentials, req) {
55
+ // Add logic here to look up the user from the credentials supplied
56
+ const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
57
+
58
+ // Any object returned will be saved in `user` property of the JWT
59
+ // If you return null then an error will be displayed advising the user to check their details.
60
+ // 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
61
+ return user ?? null;
62
+ },
63
+ }),
64
+ ],
65
+ });
66
+
67
+ app.all(
68
+ "/api/auth/*",
69
+ createMiddleware(Auth, {
70
+ alwaysCallNext: false,
71
+ })
72
+ );
73
+ }
74
+
75
+ if (import.meta.BATI_MODULES?.includes("rpc:telefunc")) {
76
+ /**
77
+ * Telefunc route
78
+ *
79
+ * @link {@see https://telefunc.com}
80
+ **/
81
+ app.post(
82
+ "/_telefunc",
83
+ createMiddleware(
84
+ async (context) => {
85
+ const httpResponse = await telefunc({
86
+ url: context.request.url.toString(),
87
+ method: context.request.method,
88
+ body: await context.request.text(),
89
+ context,
90
+ });
91
+ const { body, statusCode, contentType } = httpResponse;
92
+ return new Response(body, {
93
+ status: statusCode,
94
+ headers: {
95
+ "content-type": contentType,
96
+ },
97
+ });
98
+ },
99
+ {
100
+ alwaysCallNext: false,
101
+ }
102
+ )
103
+ );
104
+ }
105
+
106
+ /**
107
+ * Vike route
108
+ *
109
+ * @link {@see https://vite-plugin-ssr.com}
110
+ **/
111
+ app.all("*", async (req, res, next) => {
112
+ const pageContextInit = { urlOriginal: req.originalUrl };
113
+ const pageContext = await renderPage(pageContextInit);
114
+ if (pageContext.httpResponse === null) return next();
115
+
116
+ const { statusCode, contentType } = pageContext.httpResponse;
117
+ res.status(statusCode).type(contentType);
118
+ pageContext.httpResponse.pipe(res);
119
+ });
120
+
121
+ app.listen(process.env.PORT ? parseInt(process.env.PORT) : 3000, "localhost", () => {
122
+ console.log("Server listening on http://localhost:3000");
123
+ });
124
+ }
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/express";
3
3
  var private2 = true;
4
- var version = "0.0.24";
4
+ var version = "0.0.25";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -7,7 +7,7 @@ async function getPackageJson(currentContent, meta) {
7
7
  if (packageJson.scripts.preview) {
8
8
  delete packageJson.scripts.preview;
9
9
  }
10
- return addDependency(packageJson, await import("../package-ZHZMC652.js"), {
10
+ return addDependency(packageJson, await import("../package-PAHNC63I.js"), {
11
11
  devDependencies: ["@hattip/vite", "@hattip/adapter-node"],
12
12
  dependencies: [
13
13
  "@hattip/router",
@@ -1,88 +1,88 @@
1
- import { createRouter } from "@hattip/router";
2
- import { renderPage } from "vite-plugin-ssr/server";
3
- import { telefunc } from "telefunc";
4
- import { VikeAuth } from "vike-authjs";
5
- import CredentialsProvider from "@auth/core/providers/credentials";
6
-
7
- const router = createRouter();
8
-
9
- if (import.meta.BATI_MODULES?.includes("rpc:telefunc")) {
10
- /**
11
- * Telefunc route
12
- *
13
- * @link {@see https://telefunc.com}
14
- **/
15
- router.post("/_telefunc", async (context) => {
16
- const httpResponse = await telefunc({
17
- url: context.url.toString(),
18
- method: context.method,
19
- body: await context.request.text(),
20
- context,
21
- });
22
- const { body, statusCode, contentType } = httpResponse;
23
- return new Response(body, {
24
- status: statusCode,
25
- headers: {
26
- "content-type": contentType,
27
- },
28
- });
29
- });
30
- }
31
-
32
- if (import.meta.BATI_MODULES?.includes("auth:authjs")) {
33
- /**
34
- * AuthJS
35
- *
36
- * TODO: Replace secret {@see https://authjs.dev/reference/core#secret}
37
- * TODO: Choose and implement providers
38
- *
39
- * @link {@see https://authjs.dev/guides/providers/custom-provider}
40
- **/
41
- const Auth = VikeAuth({
42
- secret: "MY_SECRET", // See
43
-
44
- providers: [
45
- CredentialsProvider({
46
- name: "Credentials",
47
- credentials: {
48
- username: { label: "Username", type: "text", placeholder: "username" },
49
- password: { label: "Password", type: "password" },
50
- },
51
- async authorize(credentials, req) {
52
- // Add logic here to look up the user from the credentials supplied
53
- const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
54
-
55
- // Any object returned will be saved in `user` property of the JWT
56
- // If you return null then an error will be displayed advising the user to check their details.
57
- // 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
58
- return user ?? null;
59
- },
60
- }),
61
- ],
62
- });
63
-
64
- router.get("/api/auth/*", Auth);
65
- router.post("/api/auth/*", Auth);
66
- }
67
-
68
- /**
69
- * Vike route
70
- *
71
- * @link {@see https://vite-plugin-ssr.com}
72
- **/
73
- router.use(async (context) => {
74
- const pageContextInit = { urlOriginal: context.request.url };
75
- const pageContext = await renderPage(pageContextInit);
76
- const response = pageContext.httpResponse;
77
-
78
- return new Response(await response?.getBody(), {
79
- status: response?.statusCode,
80
- headers: response
81
- ? {
82
- "content-type": response.contentType,
83
- }
84
- : {},
85
- });
86
- });
87
-
88
- export default router.buildHandler();
1
+ import { createRouter } from "@hattip/router";
2
+ import { renderPage } from "vite-plugin-ssr/server";
3
+ import { telefunc } from "telefunc";
4
+ import { VikeAuth } from "vike-authjs";
5
+ import CredentialsProvider from "@auth/core/providers/credentials";
6
+
7
+ const router = createRouter();
8
+
9
+ if (import.meta.BATI_MODULES?.includes("rpc:telefunc")) {
10
+ /**
11
+ * Telefunc route
12
+ *
13
+ * @link {@see https://telefunc.com}
14
+ **/
15
+ router.post("/_telefunc", async (context) => {
16
+ const httpResponse = await telefunc({
17
+ url: context.url.toString(),
18
+ method: context.method,
19
+ body: await context.request.text(),
20
+ context,
21
+ });
22
+ const { body, statusCode, contentType } = httpResponse;
23
+ return new Response(body, {
24
+ status: statusCode,
25
+ headers: {
26
+ "content-type": contentType,
27
+ },
28
+ });
29
+ });
30
+ }
31
+
32
+ if (import.meta.BATI_MODULES?.includes("auth:authjs")) {
33
+ /**
34
+ * AuthJS
35
+ *
36
+ * TODO: Replace secret {@see https://authjs.dev/reference/core#secret}
37
+ * TODO: Choose and implement providers
38
+ *
39
+ * @link {@see https://authjs.dev/guides/providers/custom-provider}
40
+ **/
41
+ const Auth = VikeAuth({
42
+ secret: "MY_SECRET", // See
43
+
44
+ providers: [
45
+ CredentialsProvider({
46
+ name: "Credentials",
47
+ credentials: {
48
+ username: { label: "Username", type: "text", placeholder: "username" },
49
+ password: { label: "Password", type: "password" },
50
+ },
51
+ async authorize(credentials, req) {
52
+ // Add logic here to look up the user from the credentials supplied
53
+ const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
54
+
55
+ // Any object returned will be saved in `user` property of the JWT
56
+ // If you return null then an error will be displayed advising the user to check their details.
57
+ // 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
58
+ return user ?? null;
59
+ },
60
+ }),
61
+ ],
62
+ });
63
+
64
+ router.get("/api/auth/*", Auth);
65
+ router.post("/api/auth/*", Auth);
66
+ }
67
+
68
+ /**
69
+ * Vike route
70
+ *
71
+ * @link {@see https://vite-plugin-ssr.com}
72
+ **/
73
+ router.use(async (context) => {
74
+ const pageContextInit = { urlOriginal: context.request.url };
75
+ const pageContext = await renderPage(pageContextInit);
76
+ const response = pageContext.httpResponse;
77
+
78
+ return new Response(await response?.getBody(), {
79
+ status: response?.statusCode,
80
+ headers: response
81
+ ? {
82
+ "content-type": response.contentType,
83
+ }
84
+ : {},
85
+ });
86
+ });
87
+
88
+ export default router.buildHandler();
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/hattip";
3
3
  var private2 = true;
4
- var version = "0.0.24";
4
+ var version = "0.0.25";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -4,7 +4,7 @@ async function getPackageJson(currentContent) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
5
  packageJson.scripts["prisma:studio"] = "prisma studio";
6
6
  packageJson.scripts["prisma:generate"] = "prisma generate";
7
- return addDependency(packageJson, await import("../package-3DP6BNRZ.js"), {
7
+ return addDependency(packageJson, await import("../package-42T5MPMS.js"), {
8
8
  devDependencies: ["prisma"],
9
9
  dependencies: ["@prisma/client"]
10
10
  });
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/prisma";
3
3
  var private2 = true;
4
- var version = "0.0.24";
4
+ var version = "0.0.25";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-app",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -15,4 +15,4 @@
15
15
  "vite": "^4.3.9"
16
16
  },
17
17
  "dependencies": {}
18
- }
18
+ }
@@ -1,18 +1,18 @@
1
- {
2
- "compilerOptions": {
3
- "strict": true,
4
- "allowJs": true,
5
- "checkJs": true,
6
- "esModuleInterop": true,
7
- "forceConsistentCasingInFileNames": true,
8
- "resolveJsonModule": true,
9
- "skipLibCheck": true,
10
- "sourceMap": true,
11
- "module": "ESNext",
12
- "noEmit": true,
13
- "moduleResolution": "node",
14
- "target": "ES2020",
15
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
16
- "types": ["vite/client"]
17
- }
18
- }
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "allowJs": true,
5
+ "checkJs": true,
6
+ "esModuleInterop": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "resolveJsonModule": true,
9
+ "skipLibCheck": true,
10
+ "sourceMap": true,
11
+ "module": "ESNext",
12
+ "noEmit": true,
13
+ "moduleResolution": "node",
14
+ "target": "ES2020",
15
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
16
+ "types": ["vite/client"]
17
+ }
18
+ }
@@ -1,5 +1,5 @@
1
- import { defineConfig } from "vite";
2
-
3
- export default defineConfig({
4
- plugins: [],
5
- });
1
+ import { defineConfig } from "vite";
2
+
3
+ export default defineConfig({
4
+ plugins: [],
5
+ });
@@ -2,7 +2,7 @@
2
2
  import { addDependency, loadAsJson } from "@batijs/core";
3
3
  async function getPackageJson(currentContent) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
- return addDependency(packageJson, await import("../package-6HR5REIL.js"), {
5
+ return addDependency(packageJson, await import("../package-DVZ6BETH.js"), {
6
6
  devDependencies: ["vite"],
7
7
  dependencies: ["cross-fetch", "solid-js", "vike-solid"]
8
8
  });