@batijs/cli 0.0.444 → 0.0.446

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 (148) hide show
  1. package/dist/boilerplates/@batijs/auth0/files/$.env.js +1 -1
  2. package/dist/boilerplates/@batijs/auth0/files/$README.md.js +1 -1
  3. package/dist/boilerplates/@batijs/authjs/files/$package.json.js +1 -1
  4. package/dist/boilerplates/@batijs/aws/files/$README.md.js +1 -1
  5. package/dist/boilerplates/@batijs/aws/files/$package.json.js +1 -1
  6. package/dist/boilerplates/@batijs/aws/files/$tsconfig.json.js +1 -1
  7. package/dist/boilerplates/@batijs/biome/files/$package.json.js +1 -1
  8. package/dist/boilerplates/@batijs/cloudflare/files/$package.json.js +1 -1
  9. package/dist/boilerplates/@batijs/cloudflare/files/$tsconfig.json.js +1 -1
  10. package/dist/boilerplates/@batijs/cloudflare/files/$vite.config.ts.js +1 -1
  11. package/dist/boilerplates/@batijs/compiled/files/$package.json.js +1 -1
  12. package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +1 -1
  13. package/dist/boilerplates/@batijs/d1/files/$README.md.js +1 -1
  14. package/dist/boilerplates/@batijs/d1/files/$package.json.js +1 -1
  15. package/dist/boilerplates/@batijs/d1/files/$tsconfig.json.js +1 -1
  16. package/dist/boilerplates/@batijs/d1/files/$wrangler.toml.js +1 -1
  17. package/dist/boilerplates/@batijs/d1-sqlite/files/$package.json.js +1 -7
  18. package/dist/boilerplates/@batijs/drizzle/files/$.env.js +1 -1
  19. package/dist/boilerplates/@batijs/drizzle/files/$README.md.js +1 -1
  20. package/dist/boilerplates/@batijs/drizzle/files/$package.json.js +1 -13
  21. package/dist/boilerplates/@batijs/eslint/files/$package.json.js +1 -1
  22. package/dist/boilerplates/@batijs/express/files/$package.json.js +1 -1
  23. package/dist/boilerplates/@batijs/express/files/express-entry.ts +0 -35
  24. package/dist/boilerplates/@batijs/fastify/files/$package.json.js +1 -1
  25. package/dist/boilerplates/@batijs/fastify/files/fastify-entry.ts +0 -35
  26. package/dist/boilerplates/@batijs/google-analytics/files/$.env.js +1 -1
  27. package/dist/boilerplates/@batijs/h3/files/$package.json.js +1 -1
  28. package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +0 -35
  29. package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
  30. package/dist/boilerplates/@batijs/hattip/files/hattip-entry.ts +0 -35
  31. package/dist/boilerplates/@batijs/hono/files/$package.json.js +1 -1
  32. package/dist/boilerplates/@batijs/hono/files/$vite.config.ts.js +1 -1
  33. package/dist/boilerplates/@batijs/hono/files/hono-entry.ts +0 -35
  34. package/dist/boilerplates/@batijs/mantine/files/$README.md.js +1 -1
  35. package/dist/boilerplates/@batijs/mantine/files/$package.json.js +1 -1
  36. package/dist/boilerplates/@batijs/panda-css/files/$package.json.js +1 -1
  37. package/dist/boilerplates/@batijs/pnpm/files/$pnpm-workspace.yaml.js +1 -1
  38. package/dist/boilerplates/@batijs/prettier/files/$package.json.js +1 -1
  39. package/dist/boilerplates/@batijs/prettier/files/.prettierignore +1 -4
  40. package/dist/boilerplates/@batijs/prisma/files/$.env.js +1 -1
  41. package/dist/boilerplates/@batijs/prisma/files/$README.md.js +1 -1
  42. package/dist/boilerplates/@batijs/prisma/files/$package.json.js +1 -1
  43. package/dist/boilerplates/@batijs/react/files/$README.md.js +1 -1
  44. package/dist/boilerplates/@batijs/react/files/$package.json.js +1 -1
  45. package/dist/boilerplates/@batijs/react/files/$tsconfig.json.js +1 -1
  46. package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +1 -1
  47. package/dist/boilerplates/@batijs/react/files/layouts/LayoutDefault.tsx +0 -1
  48. package/dist/boilerplates/@batijs/react/files/pages/+config.ts +1 -1
  49. package/dist/boilerplates/@batijs/react-sentry/files/$package.json.js +1 -1
  50. package/dist/boilerplates/@batijs/sentry/files/$.env.js +1 -1
  51. package/dist/boilerplates/@batijs/sentry/files/$README.md.js +1 -1
  52. package/dist/boilerplates/@batijs/sentry/files/$package.json.js +1 -1
  53. package/dist/boilerplates/@batijs/sentry/files/$vite.config.ts.js +1 -1
  54. package/dist/boilerplates/@batijs/sentry/files/pages/$+client.ts.js +1 -1
  55. package/dist/boilerplates/@batijs/shadcn-ui/files/$README.md.js +1 -1
  56. package/dist/boilerplates/@batijs/shadcn-ui/files/$package.json.js +1 -1
  57. package/dist/boilerplates/@batijs/shadcn-ui/files/$tsconfig.json.js +1 -1
  58. package/dist/boilerplates/@batijs/shadcn-ui/files/$vite.config.ts.js +1 -1
  59. package/dist/boilerplates/@batijs/shared/files/$README.md.js +1 -1
  60. package/dist/boilerplates/@batijs/shared/files/gitignore +1 -4
  61. package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +1 -1
  62. package/dist/boilerplates/@batijs/solid/files/$README.md.js +1 -1
  63. package/dist/boilerplates/@batijs/solid/files/$package.json.js +1 -1
  64. package/dist/boilerplates/@batijs/solid/files/$tsconfig.json.js +1 -1
  65. package/dist/boilerplates/@batijs/solid/files/$vite.config.ts.js +1 -1
  66. package/dist/boilerplates/@batijs/solid/files/layouts/LayoutDefault.tsx +0 -1
  67. package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +1 -1
  68. package/dist/boilerplates/@batijs/solid-sentry/files/$package.json.js +1 -1
  69. package/dist/boilerplates/@batijs/sqlite/files/$.env.js +1 -1
  70. package/dist/boilerplates/@batijs/sqlite/files/$README.md.js +1 -1
  71. package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +1 -13
  72. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/schema/all.ts +0 -2
  73. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/schema/all.d.ts +0 -1
  74. package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +1 -1
  75. package/dist/boilerplates/@batijs/tailwindcss/files/$vite.config.ts.js +1 -1
  76. package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +1 -1
  77. package/dist/boilerplates/@batijs/telefunc/files/$vite.config.ts.js +1 -1
  78. package/dist/boilerplates/@batijs/trpc/files/$package.json.js +1 -1
  79. package/dist/boilerplates/@batijs/trpc/types/trpc/client.d.ts +3 -3
  80. package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +1 -1
  81. package/dist/boilerplates/@batijs/vercel/files/$package.json.js +1 -1
  82. package/dist/boilerplates/@batijs/vercel/files/$tsconfig.json.js +1 -1
  83. package/dist/boilerplates/@batijs/vercel/files/$vite.config.ts.js +1 -1
  84. package/dist/boilerplates/@batijs/vercel/files/pages/$+config.ts.js +1 -1
  85. package/dist/boilerplates/@batijs/vue/files/$README.md.js +1 -1
  86. package/dist/boilerplates/@batijs/vue/files/$package.json.js +1 -1
  87. package/dist/boilerplates/@batijs/vue/files/$tsconfig.json.js +1 -1
  88. package/dist/boilerplates/@batijs/vue/files/$vite.config.ts.js +1 -1
  89. package/dist/boilerplates/@batijs/vue/files/layouts/LayoutDefault.vue +0 -2
  90. package/dist/boilerplates/@batijs/vue/files/pages/+config.ts +1 -1
  91. package/dist/boilerplates/@batijs/vue-sentry/files/$package.json.js +1 -1
  92. package/dist/boilerplates/boilerplates.json +0 -118
  93. package/dist/{chunk-HYBBK3CW.js → chunk-ZDDQD2BO.js} +9848 -9848
  94. package/dist/index.js +17 -64
  95. package/package.json +5 -5
  96. package/dist/boilerplates/@batijs/d1-sqlite/files/database/d1/queries/lucia-auth.ts +0 -29
  97. package/dist/boilerplates/@batijs/d1-sqlite/files/database/migrations/lucia-auth.sql +0 -20
  98. package/dist/boilerplates/@batijs/d1-sqlite/types/database/d1/queries/lucia-auth.d.ts +0 -5
  99. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/queries/lucia-auth.ts +0 -56
  100. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/schema/lucia-auth.ts +0 -41
  101. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/queries/lucia-auth.d.ts +0 -25
  102. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/schema/lucia-auth.d.ts +0 -190
  103. package/dist/boilerplates/@batijs/express/files/global.d.ts +0 -10
  104. package/dist/boilerplates/@batijs/fastify/files/global.d.ts +0 -10
  105. package/dist/boilerplates/@batijs/firebase-auth/files/$.env.js +0 -24
  106. package/dist/boilerplates/@batijs/firebase-auth/files/$README.md.js +0 -39
  107. package/dist/boilerplates/@batijs/firebase-auth/files/$package.json.js +0 -133
  108. package/dist/boilerplates/@batijs/firebase-auth/files/firebase/$service-account.json.js +0 -26
  109. package/dist/boilerplates/@batijs/firebase-auth/files/global.d.ts +0 -11
  110. package/dist/boilerplates/@batijs/firebase-auth/files/libs/firebaseAdmin.ts +0 -15
  111. package/dist/boilerplates/@batijs/firebase-auth/files/libs/firebaseUI.ts +0 -31
  112. package/dist/boilerplates/@batijs/firebase-auth/files/pages/+client.ts +0 -30
  113. package/dist/boilerplates/@batijs/firebase-auth/files/pages/login/+config.ts +0 -6
  114. package/dist/boilerplates/@batijs/firebase-auth/files/pages/login/+guard.ts +0 -11
  115. package/dist/boilerplates/@batijs/firebase-auth/files/server/firebase-auth-middleware.ts +0 -71
  116. package/dist/boilerplates/@batijs/firebase-auth/types/libs/firebaseAdmin.d.ts +0 -5
  117. package/dist/boilerplates/@batijs/firebase-auth/types/libs/firebaseUI.d.ts +0 -5
  118. package/dist/boilerplates/@batijs/firebase-auth/types/pages/+client.d.ts +0 -1
  119. package/dist/boilerplates/@batijs/firebase-auth/types/pages/login/+config.d.ts +0 -4
  120. package/dist/boilerplates/@batijs/firebase-auth/types/pages/login/+guard.d.ts +0 -3
  121. package/dist/boilerplates/@batijs/firebase-auth/types/server/firebase-auth-middleware.d.ts +0 -4
  122. package/dist/boilerplates/@batijs/h3/files/global.d.ts +0 -10
  123. package/dist/boilerplates/@batijs/hono/files/global.d.ts +0 -10
  124. package/dist/boilerplates/@batijs/lucia-auth/files/$.env.js +0 -32
  125. package/dist/boilerplates/@batijs/lucia-auth/files/$README.md.js +0 -38
  126. package/dist/boilerplates/@batijs/lucia-auth/files/$package.json.js +0 -113
  127. package/dist/boilerplates/@batijs/lucia-auth/files/global.d.ts +0 -11
  128. package/dist/boilerplates/@batijs/lucia-auth/files/lib/lucia-auth.ts +0 -136
  129. package/dist/boilerplates/@batijs/lucia-auth/files/pages/login/+guard.ts +0 -11
  130. package/dist/boilerplates/@batijs/lucia-auth/files/pages/login/style.css +0 -94
  131. package/dist/boilerplates/@batijs/lucia-auth/files/server/lucia-auth-handlers.ts +0 -401
  132. package/dist/boilerplates/@batijs/lucia-auth/types/lib/lucia-auth.d.ts +0 -63
  133. package/dist/boilerplates/@batijs/lucia-auth/types/pages/login/+guard.d.ts +0 -3
  134. package/dist/boilerplates/@batijs/lucia-auth/types/server/lucia-auth-handlers.d.ts +0 -65
  135. package/dist/boilerplates/@batijs/react-firebase-auth/files/pages/login/+Page.tsx +0 -52
  136. package/dist/boilerplates/@batijs/react-firebase-auth/types/pages/login/+Page.d.ts +0 -3
  137. package/dist/boilerplates/@batijs/react-lucia-auth/files/pages/login/+Page.tsx +0 -97
  138. package/dist/boilerplates/@batijs/react-lucia-auth/types/pages/login/+Page.d.ts +0 -2
  139. package/dist/boilerplates/@batijs/solid-firebase-auth/files/pages/login/+Page.tsx +0 -52
  140. package/dist/boilerplates/@batijs/solid-firebase-auth/types/pages/login/+Page.d.ts +0 -3
  141. package/dist/boilerplates/@batijs/solid-lucia-auth/files/pages/login/+Page.tsx +0 -97
  142. package/dist/boilerplates/@batijs/solid-lucia-auth/types/pages/login/+Page.d.ts +0 -2
  143. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/queries/lucia-auth.ts +0 -27
  144. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/schema/lucia-auth.ts +0 -32
  145. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/queries/lucia-auth.d.ts +0 -5
  146. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/schema/lucia-auth.d.ts +0 -1
  147. package/dist/boilerplates/@batijs/vue-firebase-auth/files/pages/login/+Page.vue +0 -51
  148. package/dist/boilerplates/@batijs/vue-lucia-auth/files/pages/login/+Page.vue +0 -88
@@ -1,133 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as createRequire_BATI_CLI } from 'module';
3
- const require = createRequire_BATI_CLI(import.meta.url);
4
-
5
- import {
6
- ata
7
- } from "../../../../chunk-HYBBK3CW.js";
8
- import "../../../../chunk-V7W2TXCE.js";
9
- import "../../../../chunk-DHZ7AZKP.js";
10
-
11
- // ../../boilerplates/firebase-auth/dist/files/$package.json.js
12
- var __create = Object.create;
13
- var __defProp = Object.defineProperty;
14
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
- var __getOwnPropNames = Object.getOwnPropertyNames;
16
- var __getProtoOf = Object.getPrototypeOf;
17
- var __hasOwnProp = Object.prototype.hasOwnProperty;
18
- var __commonJS = (cb, mod) => function __require() {
19
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (let key of __getOwnPropNames(from))
24
- if (!__hasOwnProp.call(to, key) && key !== except)
25
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var require_package = __commonJS({
38
- "package.json"(exports, module) {
39
- module.exports = {
40
- name: "@batijs/firebase-auth",
41
- private: true,
42
- version: "0.0.1",
43
- description: "",
44
- type: "module",
45
- scripts: {
46
- "check-types": "tsc --noEmit",
47
- build: "bati-compile-boilerplate"
48
- },
49
- keywords: [],
50
- author: "",
51
- license: "MIT",
52
- devDependencies: {
53
- "@batijs/compile": "workspace:*",
54
- "@types/node": "^18.19.111",
55
- "@universal-middleware/core": "^0.4.8",
56
- cookie: "^1.0.2",
57
- dotenv: "^16.5.0",
58
- firebase: "^11.9.1",
59
- "firebase-admin": "^12.7.0",
60
- firebaseui: "^6.1.0",
61
- vike: "^0.4.231",
62
- vite: "^6.3.5"
63
- },
64
- dependencies: {
65
- "@batijs/core": "workspace:*"
66
- },
67
- files: [
68
- "dist/"
69
- ],
70
- bati: {
71
- if: {
72
- flag: "firebase-auth"
73
- }
74
- },
75
- exports: {
76
- "./libs/firebaseAdmin": {
77
- types: "./dist/types/libs/firebaseAdmin.d.ts"
78
- },
79
- "./libs/firebaseUI": {
80
- types: "./dist/types/libs/firebaseUI.d.ts"
81
- },
82
- "./pages/+client": {
83
- types: "./dist/types/pages/+client.d.ts"
84
- },
85
- "./pages/login/+config": {
86
- types: "./dist/types/pages/login/+config.d.ts"
87
- },
88
- "./pages/login/+guard": {
89
- types: "./dist/types/pages/login/+guard.d.ts"
90
- },
91
- "./server/firebase-auth-middleware": {
92
- types: "./dist/types/server/firebase-auth-middleware.d.ts"
93
- }
94
- },
95
- typesVersions: {
96
- "*": {
97
- "libs/firebaseAdmin": [
98
- "./dist/types/libs/firebaseAdmin.d.ts"
99
- ],
100
- "libs/firebaseUI": [
101
- "./dist/types/libs/firebaseUI.d.ts"
102
- ],
103
- "pages/+client": [
104
- "./dist/types/pages/+client.d.ts"
105
- ],
106
- "pages/login/+config": [
107
- "./dist/types/pages/login/+config.d.ts"
108
- ],
109
- "pages/login/+guard": [
110
- "./dist/types/pages/login/+guard.d.ts"
111
- ],
112
- "server/firebase-auth-middleware": [
113
- "./dist/types/server/firebase-auth-middleware.d.ts"
114
- ]
115
- }
116
- }
117
- };
118
- }
119
- });
120
- async function getPackageJson(props) {
121
- const packageJson = await ata(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
122
- return packageJson.addDependencies([
123
- "firebase",
124
- "firebase-admin",
125
- "firebaseui",
126
- "cookie",
127
- "@universal-middleware/core",
128
- "dotenv"
129
- ]);
130
- }
131
- export {
132
- getPackageJson as default
133
- };
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as createRequire_BATI_CLI } from 'module';
3
- const require = createRequire_BATI_CLI(import.meta.url);
4
-
5
- import "../../../../../chunk-DHZ7AZKP.js";
6
-
7
- // ../../boilerplates/firebase-auth/dist/files/firebase/$service-account.json.js
8
- async function getPackageJson() {
9
- const firebaseAccountStringified = process.env.TEST_FIREBASE_ACCOUNT;
10
- return firebaseAccountStringified ? JSON.parse(firebaseAccountStringified) : {
11
- type: "",
12
- project_id: "",
13
- private_key_id: "",
14
- private_key: "",
15
- client_email: "",
16
- client_id: "",
17
- auth_uri: "",
18
- token_uri: "",
19
- auth_provider_x509_cert_url: "",
20
- client_x509_cert_url: "",
21
- universe_domain: ""
22
- };
23
- }
24
- export {
25
- getPackageJson as default
26
- };
@@ -1,11 +0,0 @@
1
- import type { UserRecord } from "firebase-admin/auth";
2
-
3
- declare global {
4
- namespace Vike {
5
- interface PageContext {
6
- user?: UserRecord | null;
7
- }
8
- }
9
- }
10
-
11
- export {};
@@ -1,15 +0,0 @@
1
- import "dotenv/config";
2
- import { applicationDefault, getApp, getApps, initializeApp, type App } from "firebase-admin/app";
3
- import { getAuth } from "firebase-admin/auth";
4
-
5
- let firebaseAdmin: App | undefined;
6
-
7
- if (!getApps().length) {
8
- firebaseAdmin = initializeApp({
9
- credential: applicationDefault(),
10
- });
11
- } else {
12
- firebaseAdmin = getApp();
13
- }
14
-
15
- export { firebaseAdmin, getAuth };
@@ -1,31 +0,0 @@
1
- import type { UserCredential } from "firebase/auth";
2
- import firebase from "firebase/compat/app";
3
- import * as firebaseui from "firebaseui";
4
-
5
- type SessionLogin = (authResult: UserCredential) => Promise<void>;
6
-
7
- function startFirebaseUI(ui: firebaseui.auth.AuthUI, sessionLogin?: SessionLogin) {
8
- // Please read firebaseui docs at https://github.com/firebase/firebaseui-web
9
- const uiCOnfig = {
10
- callbacks: {
11
- signInSuccessWithAuthResult(authResult: UserCredential) {
12
- if (sessionLogin) {
13
- sessionLogin(authResult);
14
- // Don't redirect after firebase client successfully sign-in, let vike handle the rest.
15
- return false;
16
- }
17
- return true;
18
- },
19
- },
20
- signInFlow: "popup",
21
- signInOptions: [
22
- // Disable "Email enumeration protection" to be able to login with registered email address
23
- // https://console.firebase.google.com/u/1/project/{project-id}/authentication/settings
24
- firebase.auth.EmailAuthProvider.PROVIDER_ID,
25
- firebase.auth.GoogleAuthProvider.PROVIDER_ID,
26
- ],
27
- };
28
- return ui.start("#firebaseui-auth-container", uiCOnfig);
29
- }
30
-
31
- export { startFirebaseUI };
@@ -1,30 +0,0 @@
1
- // Import the functions you need from the SDKs you need
2
- import { deleteApp, getApp, getApps, initializeApp, type FirebaseApp } from "firebase/app";
3
- import { getAuth, inMemoryPersistence } from "firebase/auth";
4
-
5
- // TODO: Fill your web app's Firebase configuration
6
- // See https://firebase.google.com/docs/web/learn-more?hl=fr#config-object
7
- const firebaseConfig = {
8
- apiKey: "",
9
- authDomain: "",
10
- projectId: "",
11
- storageBucket: "",
12
- messagingSenderId: "",
13
- appId: "",
14
- };
15
-
16
- let firebaseApp: FirebaseApp | undefined;
17
- // create a singleton client side firebaseApp
18
- if (!getApps().length) {
19
- firebaseApp = initializeApp(firebaseConfig);
20
- } else {
21
- firebaseApp = getApp();
22
- deleteApp(firebaseApp);
23
- firebaseApp = initializeApp(firebaseConfig);
24
- }
25
-
26
- const auth = getAuth(firebaseApp);
27
-
28
- // As httpOnly cookies are to be used, do not persist any state client side.
29
- // `inMemoryPersistence` is an implementation of Persistence of type 'NONE'.
30
- auth.setPersistence(inMemoryPersistence);
@@ -1,6 +0,0 @@
1
- const config = {
2
- // firebase-ui only supports client-side rendering
3
- ssr: false,
4
- };
5
-
6
- export default config;
@@ -1,11 +0,0 @@
1
- // https://vike.dev/guard
2
- import { redirect } from "vike/abort";
3
- import type { GuardAsync } from "vike/types";
4
-
5
- const guard: GuardAsync = async (pageContext): ReturnType<GuardAsync> => {
6
- if (pageContext.user) {
7
- throw redirect("/");
8
- }
9
- };
10
-
11
- export { guard };
@@ -1,71 +0,0 @@
1
- import { parse, serialize } from "cookie";
2
- import { getAuth } from "firebase-admin/auth";
3
- import { firebaseAdmin } from "../libs/firebaseAdmin";
4
- // TODO: stop using universal-middleware and directly integrate server middlewares instead and/or use vike-server https://vike.dev/server. (Bati generates boilerplates that use universal-middleware https://github.com/magne4000/universal-middleware to make Bati's internal logic easier. This is temporary and will be removed soon.)
5
- import type { Get, UniversalHandler, UniversalMiddleware } from "@universal-middleware/core";
6
-
7
- export const firebaseAuthMiddleware: Get<[], UniversalMiddleware> = () => async (request, context) => {
8
- if (!request.headers.has("cookie")) return;
9
-
10
- const cookies = parse(request.headers.get("cookie")!);
11
- const sessionCookie: string = cookies.__session || "";
12
-
13
- try {
14
- const auth = getAuth(firebaseAdmin);
15
- const decodedIdToken = await auth.verifySessionCookie(sessionCookie, true);
16
- const user = await auth.getUser(decodedIdToken.sub);
17
- return {
18
- ...context,
19
- user,
20
- };
21
- } catch (error) {
22
- console.debug("verifySessionCookie:", error);
23
- return {
24
- ...context,
25
- user: null,
26
- };
27
- }
28
- };
29
-
30
- export const firebaseAuthLoginHandler: Get<[], UniversalHandler> = () => async (request) => {
31
- const body = await request.json();
32
- const idToken: string = (body as { idToken?: string }).idToken || "";
33
-
34
- const expiresIn = 60 * 60 * 24 * 5 * 1000; // 5 days
35
-
36
- try {
37
- const sessionCookie = await getAuth(firebaseAdmin).createSessionCookie(idToken, { expiresIn });
38
-
39
- const options = { maxAge: expiresIn / 1000, httpOnly: true, secure: true, path: "/" };
40
-
41
- return new Response(JSON.stringify({ status: "success" }), {
42
- status: 200,
43
- headers: {
44
- "content-type": "application/json",
45
- "set-cookie": serialize("__session", sessionCookie, options),
46
- },
47
- });
48
- } catch (error) {
49
- console.error("createSessionCookie:", error);
50
-
51
- return new Response("Unauthorized Request", {
52
- status: 401,
53
- });
54
- }
55
- };
56
-
57
- export const firebaseAuthLogoutHandler: Get<[], UniversalHandler> = () => async () => {
58
- return new Response(JSON.stringify({ status: "success" }), {
59
- status: 200,
60
- headers: {
61
- "content-type": "application/json",
62
- "set-cookie": serialize("__session", "", {
63
- maxAge: 0,
64
- httpOnly: true,
65
- secure: true,
66
- expires: new Date(1),
67
- path: "/",
68
- }),
69
- },
70
- });
71
- };
@@ -1,5 +0,0 @@
1
- import "dotenv/config";
2
- import { type App } from "firebase-admin/app";
3
- import { getAuth } from "firebase-admin/auth";
4
- declare let firebaseAdmin: App | undefined;
5
- export { firebaseAdmin, getAuth };
@@ -1,5 +0,0 @@
1
- import type { UserCredential } from "firebase/auth";
2
- import * as firebaseui from "firebaseui";
3
- type SessionLogin = (authResult: UserCredential) => Promise<void>;
4
- declare function startFirebaseUI(ui: firebaseui.auth.AuthUI, sessionLogin?: SessionLogin): void;
5
- export { startFirebaseUI };
@@ -1,4 +0,0 @@
1
- declare const config: {
2
- ssr: boolean;
3
- };
4
- export default config;
@@ -1,3 +0,0 @@
1
- import type { GuardAsync } from "vike/types";
2
- declare const guard: GuardAsync;
3
- export { guard };
@@ -1,4 +0,0 @@
1
- import type { Get, UniversalHandler, UniversalMiddleware } from "@universal-middleware/core";
2
- export declare const firebaseAuthMiddleware: Get<[], UniversalMiddleware>;
3
- export declare const firebaseAuthLoginHandler: Get<[], UniversalHandler>;
4
- export declare const firebaseAuthLogoutHandler: Get<[], UniversalHandler>;
@@ -1,10 +0,0 @@
1
- import type { UserRecord } from "firebase-admin/auth";
2
-
3
- //# BATI.has("firebase-auth")
4
- declare module "h3" {
5
- interface H3EventContext {
6
- user: UserRecord | null;
7
- }
8
- }
9
-
10
- export {};
@@ -1,10 +0,0 @@
1
- import type { UserRecord } from "firebase-admin/auth";
2
-
3
- //# BATI.has("firebase-auth")
4
- declare module "hono" {
5
- interface ContextVariableMap {
6
- user?: UserRecord | null;
7
- }
8
- }
9
-
10
- export {};
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as createRequire_BATI_CLI } from 'module';
3
- const require = createRequire_BATI_CLI(import.meta.url);
4
-
5
- import {
6
- bta
7
- } from "../../../../chunk-HYBBK3CW.js";
8
- import "../../../../chunk-V7W2TXCE.js";
9
- import "../../../../chunk-DHZ7AZKP.js";
10
-
11
- // ../../boilerplates/lucia-auth/dist/files/$.env.js
12
- async function getEnv(props) {
13
- const githubClientId = process.env.TEST_GITHUB_CLIENT_ID;
14
- const githubClientSecret = process.env.TEST_GITHUB_CLIENT_SECRET;
15
- let envContent = await props.readfile?.();
16
- envContent = bta(
17
- envContent,
18
- "GITHUB_CLIENT_ID",
19
- githubClientId ?? "",
20
- "GitHub Client ID. Used for authentication"
21
- );
22
- envContent = bta(
23
- envContent,
24
- "GITHUB_CLIENT_SECRET",
25
- githubClientSecret ?? "",
26
- "GitHub Client Secret. Used for authentication"
27
- );
28
- return envContent;
29
- }
30
- export {
31
- getEnv as default
32
- };
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as createRequire_BATI_CLI } from 'module';
3
- const require = createRequire_BATI_CLI(import.meta.url);
4
-
5
- import {
6
- ita
7
- } from "../../../../chunk-HYBBK3CW.js";
8
- import "../../../../chunk-V7W2TXCE.js";
9
- import "../../../../chunk-DHZ7AZKP.js";
10
-
11
- // ../../boilerplates/lucia-auth/dist/files/$README.md.js
12
- async function getReadme(props) {
13
- const content = await ita(props);
14
- const todo = `
15
- ## *Example: Lucia Auth with GitHub OAuth*
16
- - Create a [GitHub OAuth app](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app). Set the Authorization callback URL to \`http://localhost:3000/api/login/github/callback\`.
17
- - Copy your \`Client ID\` and \`Client Secret\` then paste it in \`.env\` file like this:
18
-
19
- \`\`\`env
20
- // .env
21
- GITHUB_CLIENT_ID=<Client ID>
22
- GITHUB_CLIENT_SECRET=<Client Secret>
23
- \`\`\`
24
-
25
- - Read more [Lucia Auth: OAuth](https://lucia-auth.com/guides/oauth/)
26
-
27
- > [!NOTE]
28
- > Username & Password signup route : \`http://localhost:3000/api/signup\`.
29
- > Username & Password login route : \`http://localhost:3000/api/login\`.
30
- > GitHub login route : \`http://localhost:3000/api/login/github\`.
31
- > Logout route : \`http://localhost:3000/api/auth/logout\`.
32
- `;
33
- content.addMarkdownFeature(todo, "lucia-auth");
34
- return content;
35
- }
36
- export {
37
- getReadme as default
38
- };
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as createRequire_BATI_CLI } from 'module';
3
- const require = createRequire_BATI_CLI(import.meta.url);
4
-
5
- import {
6
- ata
7
- } from "../../../../chunk-HYBBK3CW.js";
8
- import "../../../../chunk-V7W2TXCE.js";
9
- import "../../../../chunk-DHZ7AZKP.js";
10
-
11
- // ../../boilerplates/lucia-auth/dist/files/$package.json.js
12
- var __create = Object.create;
13
- var __defProp = Object.defineProperty;
14
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
- var __getOwnPropNames = Object.getOwnPropertyNames;
16
- var __getProtoOf = Object.getPrototypeOf;
17
- var __hasOwnProp = Object.prototype.hasOwnProperty;
18
- var __commonJS = (cb, mod) => function __require() {
19
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (let key of __getOwnPropNames(from))
24
- if (!__hasOwnProp.call(to, key) && key !== except)
25
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var require_package = __commonJS({
38
- "package.json"(exports, module) {
39
- module.exports = {
40
- name: "@batijs/lucia-auth",
41
- private: true,
42
- version: "0.0.1",
43
- description: "",
44
- type: "module",
45
- scripts: {
46
- "check-types": "tsc --noEmit",
47
- build: "bati-compile-boilerplate"
48
- },
49
- keywords: [],
50
- author: "",
51
- license: "MIT",
52
- devDependencies: {
53
- "@batijs/compile": "workspace:*",
54
- "@cloudflare/workers-types": "^4.20250614.0",
55
- "@lucia-auth/adapter-drizzle": "^1.1.0",
56
- "@lucia-auth/adapter-sqlite": "^3.0.2",
57
- "@types/better-sqlite3": "^7.6.13",
58
- "@types/node": "^18.19.111",
59
- "@universal-middleware/core": "^0.4.8",
60
- arctic: "^3.7.0",
61
- "better-sqlite3": "^11.10.0",
62
- cookie: "^1.0.2",
63
- dotenv: "^16.5.0",
64
- "drizzle-orm": "^0.44.2",
65
- lucia: "^3.2.2",
66
- vike: "^0.4.231",
67
- vite: "^6.3.5"
68
- },
69
- dependencies: {
70
- "@batijs/core": "workspace:*"
71
- },
72
- files: [
73
- "dist/"
74
- ],
75
- bati: {
76
- if: {
77
- flag: "lucia-auth"
78
- }
79
- },
80
- exports: {
81
- "./lib/lucia-auth": {
82
- types: "./dist/types/lib/lucia-auth.d.ts"
83
- },
84
- "./pages/login/+guard": {
85
- types: "./dist/types/pages/login/+guard.d.ts"
86
- },
87
- "./server/lucia-auth-handlers": {
88
- types: "./dist/types/server/lucia-auth-handlers.d.ts"
89
- }
90
- },
91
- typesVersions: {
92
- "*": {
93
- "lib/lucia-auth": [
94
- "./dist/types/lib/lucia-auth.d.ts"
95
- ],
96
- "pages/login/+guard": [
97
- "./dist/types/pages/login/+guard.d.ts"
98
- ],
99
- "server/lucia-auth-handlers": [
100
- "./dist/types/server/lucia-auth-handlers.d.ts"
101
- ]
102
- }
103
- }
104
- };
105
- }
106
- });
107
- async function getPackageJson(props) {
108
- const packageJson = await ata(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
109
- return packageJson.addDependencies(["arctic", "cookie", "lucia", "@universal-middleware/core", "dotenv"]).addDependencies(["@lucia-auth/adapter-drizzle"], props.meta.BATI.has("drizzle")).addDependencies(["@lucia-auth/adapter-sqlite"], !props.meta.BATI.has("drizzle")).addDevDependencies(["@types/better-sqlite3"], !props.meta.BATI.hasD1).addDependencies(["better-sqlite3"], !props.meta.BATI.hasD1);
110
- }
111
- export {
112
- getPackageJson as default
113
- };
@@ -1,11 +0,0 @@
1
- import type { User } from "lucia";
2
-
3
- declare global {
4
- namespace Vike {
5
- interface PageContext {
6
- user?: User;
7
- }
8
- }
9
- }
10
-
11
- export {};