@batijs/cli 0.0.234 → 0.0.236

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 (26) hide show
  1. package/dist/boilerplates/@batijs/eslint/files/$package.json.js +42 -7
  2. package/dist/boilerplates/@batijs/eslint/files/eslint.config.js +110 -0
  3. package/dist/boilerplates/@batijs/eslint/types/eslint.config.d.ts +2 -0
  4. package/dist/boilerplates/@batijs/firebase-auth/files/vike.d.ts +0 -1
  5. package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +8 -16
  6. package/dist/boilerplates/@batijs/prettier/files/$package.json.js +1 -2
  7. package/dist/boilerplates/@batijs/prettier/files/.prettierrc +3 -0
  8. package/dist/boilerplates/@batijs/react/files/$package.json.js +0 -6
  9. package/dist/boilerplates/@batijs/solid/files/$package.json.js +0 -6
  10. package/dist/boilerplates/@batijs/vue/files/$package.json.js +1 -13
  11. package/dist/boilerplates/@batijs/vue/files/components/Content.vue +3 -15
  12. package/dist/boilerplates/@batijs/vue/files/components/Counter.vue +6 -11
  13. package/dist/boilerplates/@batijs/vue/files/components/Logo.vue +5 -21
  14. package/dist/boilerplates/@batijs/vue/files/components/Sidebar.vue +2 -6
  15. package/dist/boilerplates/@batijs/vue/files/pages/_error/+Page.vue +5 -5
  16. package/dist/boilerplates/@batijs/vue/files/pages/todo/TodoList.vue +2 -8
  17. package/dist/boilerplates/@batijs/vue-firebase-auth/files/pages/login/+Page.vue +33 -33
  18. package/dist/index.js +8 -5
  19. package/package.json +5 -5
  20. package/dist/boilerplates/@batijs/compiled/files/$.eslintrc.json.js +0 -17
  21. package/dist/boilerplates/@batijs/eslint/files/.eslintignore +0 -7
  22. package/dist/boilerplates/@batijs/eslint/files/.eslintrc.json +0 -23
  23. package/dist/boilerplates/@batijs/prettier/files/$.eslintrc.json.js +0 -11
  24. package/dist/boilerplates/@batijs/react/files/$.eslintrc.json.js +0 -17
  25. package/dist/boilerplates/@batijs/solid/files/$.eslintrc.json.js +0 -12
  26. package/dist/boilerplates/@batijs/vue/files/$.eslintrc.json.js +0 -18
@@ -42,9 +42,16 @@ var require_package = __commonJS({
42
42
  },
43
43
  devDependencies: {
44
44
  "@batijs/compile": "workspace:^",
45
- "@typescript-eslint/eslint-plugin": "^7.16.1",
46
- "@typescript-eslint/parser": "^7.16.1",
47
- eslint: "^8.57.0"
45
+ "@eslint/js": "^9.7.0",
46
+ "eslint-config-prettier": "^9.1.0",
47
+ "eslint-plugin-prettier": "^5.2.1",
48
+ "typescript-eslint": "^7.16.1",
49
+ "eslint-plugin-react": "^7.35.0",
50
+ "eslint-plugin-vue": "^9.27.0",
51
+ eslint: "^9.7.0",
52
+ "eslint-plugin-solid": "^0.14.1",
53
+ globals: "^15.8.0",
54
+ "vue-eslint-parser": "^9.4.3"
48
55
  },
49
56
  dependencies: {
50
57
  "@batijs/core": "workspace:*"
@@ -57,9 +64,17 @@ var require_package = __commonJS({
57
64
  flag: "eslint"
58
65
  }
59
66
  },
60
- exports: {},
67
+ exports: {
68
+ "./eslint.config": {
69
+ types: "./dist/types/eslint.config.d.ts"
70
+ }
71
+ },
61
72
  typesVersions: {
62
- "*": {}
73
+ "*": {
74
+ "eslint.config": [
75
+ "./dist/types/eslint.config.d.ts"
76
+ ]
77
+ }
63
78
  }
64
79
  };
65
80
  }
@@ -71,12 +86,32 @@ async function getPackageJson(props) {
71
86
  const packageJson = await loadAsJson(props);
72
87
  setScripts(packageJson, {
73
88
  lint: {
74
- value: "eslint --ext .js,.jsx,.ts,.tsx .",
89
+ value: "eslint .",
75
90
  precedence: 0
76
91
  }
77
92
  });
93
+ if (props.meta.BATI.has("prettier")) {
94
+ addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
95
+ devDependencies: ["eslint-plugin-prettier", "eslint-config-prettier"]
96
+ });
97
+ }
98
+ if (props.meta.BATI.has("react")) {
99
+ addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
100
+ devDependencies: ["eslint-plugin-react", "globals"]
101
+ });
102
+ }
103
+ if (props.meta.BATI.has("vue")) {
104
+ addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
105
+ devDependencies: ["eslint-plugin-vue", "vue-eslint-parser"]
106
+ });
107
+ }
108
+ if (props.meta.BATI.has("solid")) {
109
+ addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
110
+ devDependencies: ["eslint-plugin-solid", "globals"]
111
+ });
112
+ }
78
113
  return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
79
- devDependencies: ["eslint", "@typescript-eslint/parser", "@typescript-eslint/eslint-plugin"]
114
+ devDependencies: ["eslint", "@eslint/js", "typescript-eslint"]
80
115
  });
81
116
  }
82
117
  export {
@@ -0,0 +1,110 @@
1
+ // @ts-nocheck
2
+
3
+ import eslint from "@eslint/js";
4
+ import prettier from "eslint-plugin-prettier/recommended";
5
+ import react from "eslint-plugin-react/configs/recommended.js";
6
+ import solid from "eslint-plugin-solid/dist/configs/typescript.js";
7
+ import pluginVue from "eslint-plugin-vue";
8
+ import globals from "globals";
9
+ import tseslint from "typescript-eslint";
10
+ import vueParser from "vue-eslint-parser";
11
+
12
+ export default tseslint.config(
13
+ {
14
+ ignores: [
15
+ "dist/*",
16
+ // JS files at the root of the project
17
+ "*.js",
18
+ "*.cjs",
19
+ "*.mjs",
20
+ //# BATI.has("vercel")
21
+ ".vercel/*",
22
+ ],
23
+ },
24
+ eslint.configs.recommended,
25
+ ...tseslint.configs.recommended,
26
+ {
27
+ languageOptions: {
28
+ parserOptions: {
29
+ sourceType: "module",
30
+ ecmaVersion: "latest",
31
+ },
32
+ },
33
+ },
34
+ {
35
+ rules: {
36
+ "@typescript-eslint/no-unused-vars": [
37
+ 1,
38
+ {
39
+ argsIgnorePattern: "^_",
40
+ },
41
+ ],
42
+ },
43
+ },
44
+ //# BATI.has("vue")
45
+ {
46
+ files: ["**/*.vue"],
47
+ languageOptions: {
48
+ parser: vueParser,
49
+ parserOptions: {
50
+ parser: tseslint.parser,
51
+ sourceType: "module",
52
+ ecmaVersion: "latest",
53
+ },
54
+ },
55
+ },
56
+ //# BATI.has("react")
57
+ {
58
+ files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
59
+ ...react,
60
+ languageOptions: {
61
+ ...react.languageOptions,
62
+ globals: {
63
+ ...globals.serviceworker,
64
+ ...globals.browser,
65
+ },
66
+ },
67
+
68
+ settings: {
69
+ react: {
70
+ version: "detect",
71
+ },
72
+ },
73
+ },
74
+ //# BATI.has("solid")
75
+ {
76
+ files: ["**/*.{ts,tsx,js,jsx}"],
77
+ ...solid,
78
+ languageOptions: {
79
+ parser: tseslint.parser,
80
+ globals: {
81
+ ...globals.serviceworker,
82
+ ...globals.browser,
83
+ },
84
+ },
85
+ },
86
+ //# BATI.has("vue")
87
+ ...pluginVue.configs["flat/recommended"],
88
+ //# BATI.has("vue")
89
+ {
90
+ rules: {
91
+ "vue/multi-word-component-names": "off",
92
+ "vue/singleline-html-element-content-newline": "off",
93
+ "vue/max-attributes-per-line": "off",
94
+ "vue/html-self-closing": "off",
95
+ },
96
+ },
97
+ //# BATI.has("compiled-css")
98
+ {
99
+ rules: {
100
+ "react/no-unknown-property": [
101
+ "error",
102
+ {
103
+ ignore: ["css"],
104
+ },
105
+ ],
106
+ },
107
+ },
108
+ //# BATI.has("prettier")
109
+ prettier,
110
+ );
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
2
+ export default _default;
@@ -1,7 +1,6 @@
1
1
  import type { UserRecord } from "firebase-admin/auth";
2
2
 
3
3
  declare global {
4
- // eslint-disable-next-line
5
4
  namespace Vike {
6
5
  interface PageContext {
7
6
  user?: UserRecord | null;
@@ -18,15 +18,7 @@ import installCrypto from "@hattip/polyfills/crypto";
18
18
  import installGetSetCookie from "@hattip/polyfills/get-set-cookie";
19
19
  import installWhatwgNodeFetch from "@hattip/polyfills/whatwg-node";
20
20
  import { type NodeHTTPCreateContextFnOptions, nodeHTTPRequestHandler } from "@trpc/server/adapters/node-http";
21
- import {
22
- createApp,
23
- createRouter,
24
- eventHandler,
25
- fromNodeMiddleware,
26
- fromWebHandler,
27
- toNodeListener,
28
- toWebRequest,
29
- } from "h3";
21
+ import { createApp, createRouter, eventHandler, fromNodeMiddleware, toNodeListener, toWebRequest } from "h3";
30
22
  import serveStatic from "serve-static";
31
23
 
32
24
  installWhatwgNodeFetch();
@@ -86,13 +78,13 @@ async function startServer() {
86
78
  * Auth.js route
87
79
  * @link {@see https://authjs.dev/getting-started/installation}
88
80
  **/
89
- router.use("/api/auth/**", fromWebHandler(authjsHandler));
81
+ router.use("/api/auth/**", fromWebMiddleware(authjsHandler));
90
82
  }
91
83
 
92
84
  if (BATI.has("firebase-auth")) {
93
85
  app.use(fromWebMiddleware(firebaseAuthMiddleware));
94
- router.post("/api/sessionLogin", fromWebHandler(firebaseAuthLoginHandler));
95
- router.post("/api/sessionLogout", fromWebHandler(firebaseAuthLogoutHandler));
86
+ router.post("/api/sessionLogin", fromWebMiddleware(firebaseAuthLoginHandler));
87
+ router.post("/api/sessionLogout", fromWebMiddleware(firebaseAuthLogoutHandler));
96
88
  }
97
89
 
98
90
  if (BATI.has("trpc")) {
@@ -123,15 +115,15 @@ async function startServer() {
123
115
  *
124
116
  * @link {@see https://telefunc.com}
125
117
  **/
126
- router.post("/_telefunc", fromWebHandler(telefuncHandler));
118
+ router.post("/_telefunc", fromWebMiddleware(telefuncHandler));
127
119
  }
128
120
 
129
121
  if (BATI.has("ts-rest")) {
130
- router.use("/api/**", fromWebHandler(tsRestHandler));
122
+ router.use("/api/**", fromWebMiddleware(tsRestHandler));
131
123
  }
132
124
 
133
125
  if (!BATI.has("telefunc") && !BATI.has("trpc") && !BATI.has("ts-rest")) {
134
- router.post("/api/todo/create", fromWebHandler(createTodoHandler));
126
+ router.post("/api/todo/create", fromWebMiddleware(createTodoHandler));
135
127
  }
136
128
 
137
129
  /**
@@ -139,7 +131,7 @@ async function startServer() {
139
131
  *
140
132
  * @link {@see https://vike.dev}
141
133
  **/
142
- router.use("/**", fromWebHandler(vikeHandler));
134
+ router.use("/**", fromWebMiddleware(vikeHandler));
143
135
 
144
136
  app.use(router);
145
137
 
@@ -43,7 +43,6 @@ var require_package = __commonJS({
43
43
  devDependencies: {
44
44
  "@batijs/compile": "workspace:*",
45
45
  "@types/node": "^18.19.14",
46
- "eslint-config-prettier": "^9.1.0",
47
46
  prettier: "^3.3.3"
48
47
  },
49
48
  dependencies: {
@@ -66,7 +65,7 @@ import { addDependency, loadAsJson } from "@batijs/core";
66
65
  async function getPackageJson(props) {
67
66
  const packageJson = await loadAsJson(props);
68
67
  return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
69
- devDependencies: ["prettier", "eslint-config-prettier"]
68
+ devDependencies: ["prettier"]
70
69
  });
71
70
  }
72
71
  export {
@@ -0,0 +1,3 @@
1
+ {
2
+ "printWidth": 120
3
+ }
@@ -55,7 +55,6 @@ var require_package = __commonJS({
55
55
  "@types/react-dom": "^18.3.0",
56
56
  "@vitejs/plugin-react": "^4.3.1",
57
57
  "cross-fetch": "^4.0.0",
58
- "eslint-plugin-react": "^7.35.0",
59
58
  react: "^18.3.1",
60
59
  "react-dom": "^18.3.1",
61
60
  tailwindcss: "^3.4.6",
@@ -198,11 +197,6 @@ var require_package = __commonJS({
198
197
  import { addDependency, loadAsJson } from "@batijs/core";
199
198
  async function getPackageJson(props) {
200
199
  const packageJson = await loadAsJson(props);
201
- if (props.meta.BATI.has("eslint")) {
202
- addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
203
- devDependencies: ["eslint-plugin-react"]
204
- });
205
- }
206
200
  return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
207
201
  devDependencies: ["vite", "@types/react", "@types/react-dom"],
208
202
  dependencies: ["@vitejs/plugin-react", "cross-fetch", "react", "react-dom", "vike", "vike-react"]
@@ -49,7 +49,6 @@ var require_package = __commonJS({
49
49
  "@batijs/ts-rest": "workspace:*",
50
50
  "@types/node": "^18.19.14",
51
51
  "cross-fetch": "^4.0.0",
52
- "eslint-plugin-solid": "^0.14.1",
53
52
  "solid-js": "^1.8.18",
54
53
  tailwindcss: "^3.4.6",
55
54
  typescript: "^5.5.3",
@@ -191,11 +190,6 @@ var require_package = __commonJS({
191
190
  import { addDependency, loadAsJson } from "@batijs/core";
192
191
  async function getPackageJson(props) {
193
192
  const packageJson = await loadAsJson(props);
194
- if (props.meta.BATI.has("eslint")) {
195
- addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
196
- devDependencies: ["eslint-plugin-solid"]
197
- });
198
- }
199
193
  return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
200
194
  devDependencies: ["vite"],
201
195
  dependencies: ["cross-fetch", "solid-js", "vike-solid", "vike"]
@@ -52,7 +52,6 @@ var require_package = __commonJS({
52
52
  "@vue/compiler-sfc": "^3.4.33",
53
53
  "@vue/server-renderer": "^3.4.33",
54
54
  "cross-fetch": "^4.0.0",
55
- "eslint-plugin-vue": "^9.27.0",
56
55
  tailwindcss: "^3.4.6",
57
56
  typescript: "^5.5.3",
58
57
  "unplugin-vue-markdown": "^0.26.2",
@@ -138,20 +137,9 @@ var require_package = __commonJS({
138
137
  });
139
138
 
140
139
  // files/$package.json.ts
141
- import { addDependency, loadAsJson, setScripts } from "@batijs/core";
140
+ import { addDependency, loadAsJson } from "@batijs/core";
142
141
  async function getPackageJson(props) {
143
142
  const packageJson = await loadAsJson(props);
144
- if (props.meta.BATI.has("eslint")) {
145
- setScripts(packageJson, {
146
- lint: {
147
- value: "eslint --ext .js,.jsx,.ts,.tsx,.vue .",
148
- precedence: 20
149
- }
150
- });
151
- addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
152
- devDependencies: ["eslint-plugin-vue"]
153
- });
154
- }
155
143
  if (props.meta.BATI.has("google-analytics")) {
156
144
  addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
157
145
  dependencies: ["vue-gtag"]
@@ -1,28 +1,17 @@
1
1
  <template>
2
2
  <div id="page-container">
3
3
  <!-- BATI.has("tailwindcss") -->
4
- <div
5
- id="page-content"
6
- class="p-5 pb-12 min-h-screen"
7
- >
4
+ <div id="page-content" class="p-5 pb-12 min-h-screen">
8
5
  <slot />
9
6
  </div>
10
7
  <!-- !BATI.has("tailwindcss") -->
11
- <div
12
- id="page-content"
13
- style="
14
- padding: 20px;
15
- padding-bottom: 50px;
16
- min-height: 100vh;
17
- "
18
- >
8
+ <div id="page-content" style="padding: 20px; padding-bottom: 50px; min-height: 100vh">
19
9
  <slot />
20
10
  </div>
21
11
  </div>
22
12
  </template>
23
13
 
24
- <script setup lang="ts">
25
- </script>
14
+ <script setup lang="ts"></script>
26
15
 
27
16
  <style>
28
17
  /* Page Transition Animation */
@@ -38,4 +27,3 @@ body.page-is-transitioning #page-content {
38
27
  transition: opacity 0.3s ease-in-out;
39
28
  }
40
29
  </style>
41
-
@@ -8,12 +8,7 @@
8
8
  Counter {{ state.count }}
9
9
  </button>
10
10
  <!-- !BATI.has("tailwindcss") -->
11
- <button
12
- type="button"
13
- @click="state.count++"
14
- >
15
- Counter {{ state.count }}
16
- </button>
11
+ <button type="button" @click="state.count++">Counter {{ state.count }}</button>
17
12
  </template>
18
13
 
19
14
  <script lang="ts">
@@ -21,10 +16,10 @@ import { reactive } from "vue";
21
16
 
22
17
  export default {
23
18
  setup() {
24
- const state = reactive({ count: 0 })
19
+ const state = reactive({ count: 0 });
25
20
  return {
26
- state
27
- }
28
- }
29
- }
21
+ state,
22
+ };
23
+ },
24
+ };
30
25
  </script>
@@ -1,31 +1,15 @@
1
1
  <template>
2
2
  <!-- BATI.has("tailwindcss") -->
3
- <div
4
- class="p-5 mb-2"
5
- >
3
+ <div class="p-5 mb-2">
6
4
  <a href="/">
7
- <img
8
- src="../assets/logo.svg"
9
- height="64"
10
- width="64"
11
- >
5
+ <img src="../assets/logo.svg" height="64" width="64" />
12
6
  </a>
13
7
  </div>
14
8
  <!-- !BATI.has("tailwindcss") -->
15
- <div
16
- style="
17
- margin-top: 20px;
18
- margin-bottom: 10px;
19
- "
20
- >
9
+ <div style="margin-top: 20px; margin-bottom: 10px">
21
10
  <a href="/">
22
- <img
23
- src="../assets/logo.svg"
24
- height="64"
25
- width="64"
26
- >
11
+ <img src="../assets/logo.svg" height="64" width="64" />
27
12
  </a>
28
13
  </div>
29
14
  </template>
30
- <script setup lang="ts">
31
- </script>
15
+ <script setup lang="ts"></script>
@@ -1,9 +1,6 @@
1
1
  <template>
2
2
  <!-- BATI.has("tailwindcss") -->
3
- <div
4
- id="sidebar"
5
- class="p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200"
6
- >
3
+ <div id="sidebar" class="p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200">
7
4
  <slot />
8
5
  </div>
9
6
  <!-- !BATI.has("tailwindcss") -->
@@ -21,5 +18,4 @@
21
18
  <slot />
22
19
  </div>
23
20
  </template>
24
- <script setup lang="ts">
25
- </script>
21
+ <script setup lang="ts"></script>
@@ -4,12 +4,12 @@
4
4
  </template>
5
5
 
6
6
  <script lang="ts" setup>
7
- import { usePageContext } from 'vike-vue/usePageContext'
7
+ import { usePageContext } from "vike-vue/usePageContext";
8
8
 
9
- const ctx = usePageContext()
10
- let { is404, abortReason } = ctx
9
+ const ctx = usePageContext();
10
+ let { is404, abortReason } = ctx;
11
11
  if (!abortReason) {
12
- abortReason = is404 ? 'This page could not be found.' : 'Something went wrong.'
12
+ abortReason = is404 ? "This page could not be found." : "Something went wrong.";
13
13
  }
14
- const heading = is404 ? '404 Page Not Found' : '500 Internal Server Error'
14
+ const heading = is404 ? "404 Page Not Found" : "500 Internal Server Error";
15
15
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <ul>
3
- <li v-for="(item) in todoItems" :key="item.text">
3
+ <li v-for="item in todoItems" :key="item.text">
4
4
  {{ item.text }}
5
5
  </li>
6
6
  <li>
@@ -25,13 +25,7 @@ const newTodo = ref("");
25
25
  const submitNewTodo = async () => {
26
26
  // Optimistic UI update
27
27
  todoItems.value.push({ text: newTodo.value });
28
- if (
29
- BATI.has("express") ||
30
- BATI.has("fastify") ||
31
- BATI.has("h3") ||
32
- BATI.has("hattip") ||
33
- BATI.has("hono")
34
- ) {
28
+ if (BATI.has("express") || BATI.has("fastify") || BATI.has("h3") || BATI.has("hattip") || BATI.has("hono")) {
35
29
  try {
36
30
  if (BATI.has("telefunc")) {
37
31
  await onNewTodo({ text: newTodo.value });
@@ -1,51 +1,51 @@
1
1
  <template>
2
2
  <div id="firebaseui-auth-container"></div>
3
3
  <div v-if="error">
4
- <div style="color:red">There is an error occured : {{ error }}</div>
4
+ <div style="color: red">There is an error occured : {{ error }}</div>
5
5
  <button @click="clearError">Try Again</button>
6
6
  </div>
7
7
  </template>
8
8
 
9
9
  <script setup lang="ts">
10
- import "firebaseui/dist/firebaseui.css"
11
- import { ref, onMounted, onUpdated } from "vue";
12
- import * as firebaseui from "firebaseui"
13
- import { getAuth, type UserCredential } from 'firebase/auth'
14
- import { reload } from "vike/client/router"
15
- import { startFirebaseUI } from "@batijs/firebase-auth/libs/firebaseUI"
10
+ import "firebaseui/dist/firebaseui.css";
11
+ import { onMounted, onUpdated, ref } from "vue";
12
+ import * as firebaseui from "firebaseui";
13
+ import { getAuth, type UserCredential } from "firebase/auth";
14
+ import { reload } from "vike/client/router";
15
+ import { startFirebaseUI } from "@batijs/firebase-auth/libs/firebaseUI";
16
16
 
17
- const error = ref("")
18
- const clearError = () => error.value = ""
19
- const ui = firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.AuthUI(getAuth())
17
+ const error = ref("");
18
+ const clearError = () => (error.value = "");
19
+ const ui = firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.AuthUI(getAuth());
20
20
 
21
21
  async function sessionLogin(authResult: UserCredential) {
22
- const idToken = await authResult.user.getIdToken() || ""
23
- try {
24
- const response = await fetch("/api/sessionLogin", {
25
- method: "POST",
26
- body: JSON.stringify({ idToken }),
27
- headers: {
28
- "Content-Type": "application/json",
29
- },
30
- })
31
- if (response.ok) {
32
- await reload()
33
- } else {
34
- error.value = response.statusText
35
- }
36
- await getAuth().signOut()
37
- } catch (err) {
38
- console.log('error :', err)
22
+ const idToken = (await authResult.user.getIdToken()) || "";
23
+ try {
24
+ const response = await fetch("/api/sessionLogin", {
25
+ method: "POST",
26
+ body: JSON.stringify({ idToken }),
27
+ headers: {
28
+ "Content-Type": "application/json",
29
+ },
30
+ });
31
+ if (response.ok) {
32
+ await reload();
33
+ } else {
34
+ error.value = response.statusText;
39
35
  }
36
+ await getAuth().signOut();
37
+ } catch (err) {
38
+ console.log("error :", err);
39
+ }
40
40
  }
41
41
 
42
42
  onMounted(() => {
43
- startFirebaseUI(ui, sessionLogin)
44
- })
43
+ startFirebaseUI(ui, sessionLogin);
44
+ });
45
45
 
46
46
  onUpdated(() => {
47
- if (!error.value) {
48
- startFirebaseUI(ui, sessionLogin)
49
- }
50
- })
47
+ if (!error.value) {
48
+ startFirebaseUI(ui, sessionLogin);
49
+ }
50
+ });
51
51
  </script>
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import { fileURLToPath } from "url";
15
15
  import { existsSync } from "fs";
16
16
  import { mkdir, opendir, readFile as readFile2, writeFile } from "fs/promises";
17
17
  import path from "path";
18
- import { transformAndFormat as transformAndFormat2 } from "@batijs/core";
18
+ import { formatCode, transformAndFormat as transformAndFormat2 } from "@batijs/core";
19
19
  import { readFile } from "fs/promises";
20
20
  import { parseModule, transformAndFormat } from "@batijs/core";
21
21
  async function mergeDts({
@@ -85,7 +85,7 @@ async function* walk(dir) {
85
85
  } else if (d.isFile()) yield entry;
86
86
  }
87
87
  }
88
- function transformFileAfterExec(filepath, fileContent) {
88
+ async function transformFileAfterExec(filepath, fileContent) {
89
89
  if (fileContent === void 0 || fileContent === null) return null;
90
90
  const parsed = path.parse(filepath);
91
91
  const toTest = [parsed.base, parsed.ext, parsed.name].filter(Boolean);
@@ -95,6 +95,9 @@ function transformFileAfterExec(filepath, fileContent) {
95
95
  case ".js":
96
96
  case ".tsx":
97
97
  case ".jsx":
98
+ return formatCode(fileContent, {
99
+ filepath
100
+ });
98
101
  case ".env":
99
102
  case ".env.local":
100
103
  case ".env.development":
@@ -181,7 +184,7 @@ Please report this issue to https://github.com/vikejs/bati`
181
184
  const rf = () => {
182
185
  return readFile2(target, { encoding: "utf-8" });
183
186
  };
184
- const fileContent = transformFileAfterExec(
187
+ const fileContent = await transformFileAfterExec(
185
188
  target,
186
189
  await transformer({
187
190
  readfile: targets.has(target) ? rf : void 0,
@@ -1588,7 +1591,7 @@ var createDefaultQueryTester = function(query, options) {
1588
1591
  // package.json
1589
1592
  var package_default = {
1590
1593
  name: "@batijs/cli",
1591
- version: "0.0.234",
1594
+ version: "0.0.236",
1592
1595
  type: "module",
1593
1596
  scripts: {
1594
1597
  "check-types": "tsc --noEmit",
@@ -1960,7 +1963,7 @@ async function run() {
1960
1963
  meta
1961
1964
  );
1962
1965
  if (!args["skip-git"]) {
1963
- await gitInit(args.project);
1966
+ gitInit(args.project);
1964
1967
  }
1965
1968
  printOK(args.project, flags);
1966
1969
  for (const onafter of hooksMap.get("after") ?? []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.234",
3
+ "version": "0.0.236",
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",
@@ -20,12 +20,12 @@
20
20
  "typescript": "^5.5.3",
21
21
  "unplugin-purge-polyfills": "^0.0.4",
22
22
  "vite": "^5.3.4",
23
- "@batijs/compile": "0.0.234",
24
- "@batijs/build": "0.0.234"
23
+ "@batijs/build": "0.0.236",
24
+ "@batijs/compile": "0.0.236"
25
25
  },
26
26
  "dependencies": {
27
- "@batijs/features": "0.0.234",
28
- "@batijs/core": "0.0.234"
27
+ "@batijs/core": "0.0.236",
28
+ "@batijs/features": "0.0.236"
29
29
  },
30
30
  "bin": "./dist/index.js",
31
31
  "exports": {
@@ -1,17 +0,0 @@
1
- // files/$.eslintrc.json.ts
2
- import { loadAsJson } from "@batijs/core";
3
- async function getEslintConfig(props) {
4
- if (!props.meta.BATI.has("eslint")) return;
5
- const eslintConfig = await loadAsJson(props);
6
- eslintConfig.rules ??= {};
7
- eslintConfig.rules["react/no-unknown-property"] = [
8
- "error",
9
- {
10
- ignore: ["css"]
11
- }
12
- ];
13
- return eslintConfig;
14
- }
15
- export {
16
- getEslintConfig as default
17
- };
@@ -1,7 +0,0 @@
1
- # Build artifacts
2
- dist/**
3
-
4
- # JS files at the root of the project
5
- *.js
6
- *.cjs
7
- *.mjs
@@ -1,23 +0,0 @@
1
- {
2
- "root": true,
3
- "parser": "@typescript-eslint/parser",
4
- "extends": [
5
- "eslint:recommended",
6
- "plugin:@typescript-eslint/recommended"
7
- ],
8
- "plugins": [
9
- "@typescript-eslint"
10
- ],
11
- "parserOptions": {
12
- "sourceType": "module",
13
- "ecmaVersion": "latest"
14
- },
15
- "rules": {
16
- "@typescript-eslint/no-unused-vars": [
17
- 1,
18
- {
19
- "argsIgnorePattern": "^_"
20
- }
21
- ]
22
- }
23
- }
@@ -1,11 +0,0 @@
1
- // files/$.eslintrc.json.ts
2
- import { loadAsJson } from "@batijs/core";
3
- async function getEslintConfig(props) {
4
- if (!props.meta.BATI.has("eslint")) return;
5
- const eslintConfig = await loadAsJson(props);
6
- eslintConfig.extends.push("prettier");
7
- return eslintConfig;
8
- }
9
- export {
10
- getEslintConfig as default
11
- };
@@ -1,17 +0,0 @@
1
- // files/$.eslintrc.json.ts
2
- import { loadAsJson } from "@batijs/core";
3
- async function getEslintConfig(props) {
4
- if (!props.meta.BATI.has("eslint")) return;
5
- const eslintConfig = await loadAsJson(props);
6
- eslintConfig.extends.push("plugin:react/recommended");
7
- eslintConfig.plugins.push("react");
8
- eslintConfig.settings ??= {};
9
- eslintConfig.settings.react = { version: "detect" };
10
- eslintConfig.parserOptions ??= {};
11
- eslintConfig.parserOptions.ecmaFeatures ??= {};
12
- eslintConfig.parserOptions.ecmaFeatures.jsx = true;
13
- return eslintConfig;
14
- }
15
- export {
16
- getEslintConfig as default
17
- };
@@ -1,12 +0,0 @@
1
- // files/$.eslintrc.json.ts
2
- import { loadAsJson } from "@batijs/core";
3
- async function getEslintConfig(props) {
4
- if (!props.meta.BATI.has("eslint")) return;
5
- const eslintConfig = await loadAsJson(props);
6
- eslintConfig.extends.push("plugin:solid/typescript");
7
- eslintConfig.plugins.push("solid");
8
- return eslintConfig;
9
- }
10
- export {
11
- getEslintConfig as default
12
- };
@@ -1,18 +0,0 @@
1
- // files/$.eslintrc.json.ts
2
- import { loadAsJson } from "@batijs/core";
3
- async function getEslintConfig(props) {
4
- if (!props.meta.BATI.has("eslint")) return;
5
- const eslintConfig = await loadAsJson(props);
6
- eslintConfig.extends.push("plugin:vue/vue3-recommended");
7
- eslintConfig.parser = "vue-eslint-parser";
8
- eslintConfig.parserOptions.parser = "@typescript-eslint/parser";
9
- eslintConfig.rules ??= {};
10
- eslintConfig.rules["vue/multi-word-component-names"] = "off";
11
- eslintConfig.rules["vue/singleline-html-element-content-newline"] = "off";
12
- eslintConfig.rules["vue/max-attributes-per-line"] = "off";
13
- eslintConfig.rules["vue/html-self-closing"] = "off";
14
- return eslintConfig;
15
- }
16
- export {
17
- getEslintConfig as default
18
- };