@murumets-ee/create 0.1.7 → 0.1.9

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.
@@ -0,0 +1,11 @@
1
+ type AppMode = 'single' | 'multi';
2
+ interface ProjectOptions {
3
+ name: string;
4
+ mode: AppMode;
5
+ installDeps: boolean;
6
+ }
7
+
8
+ type ProgressCallback = (message: string) => void;
9
+ declare function scaffold(options: ProjectOptions, onProgress?: ProgressCallback): Promise<void>;
10
+
11
+ export { type AppMode, type ProgressCallback, type ProjectOptions, scaffold };
package/dist/index.js CHANGED
@@ -1,16 +1,35 @@
1
1
  import{a as e,b as c,c as u,d as l,e as y}from"./chunk-CUB6XFPE.js";import{join as v}from"path";import{join as s}from"path";async function w(t,n){await e(s(t,"lib/auth.ts"),`import { getToolkitApp } from './app'
2
2
  import { getAuth } from '@murumets-ee/auth'
3
3
 
4
- await getToolkitApp()
5
-
6
- export const auth = getAuth()
4
+ export async function getAuthInstance() {
5
+ await getToolkitApp()
6
+ return getAuth()
7
+ }
7
8
  `),await e(s(t,"lib/auth-client.ts"),`import { createClient } from '@murumets-ee/auth/client'
8
9
 
9
10
  export const authClient = createClient()
10
11
  `),await e(s(t,"app/api/auth/[...all]/route.ts"),`import { toNextJsHandler } from 'better-auth/next-js'
11
- import { auth } from '../../../../lib/auth'
12
+ import { getAuthInstance } from '../../../../lib/auth'
13
+
14
+ let _handler: ReturnType<typeof toNextJsHandler> | null = null
15
+
16
+ async function handler() {
17
+ if (!_handler) {
18
+ const auth = await getAuthInstance()
19
+ _handler = toNextJsHandler(auth)
20
+ }
21
+ return _handler
22
+ }
12
23
 
13
- export const { GET, POST } = toNextJsHandler(auth)
24
+ export async function GET(req: Request) {
25
+ const h = await handler()
26
+ return h.GET(req)
27
+ }
28
+
29
+ export async function POST(req: Request) {
30
+ const h = await handler()
31
+ return h.POST(req)
32
+ }
14
33
  `),await e(s(t,"app/[locale]/auth/layout.tsx"),`import { AuthProviders } from './providers'
15
34
  import type { ReactNode } from 'react'
16
35
 
@@ -564,6 +583,7 @@ volumes:
564
583
  `),await e(o(a,"toolkit.config.ts"),`import { auth } from '@murumets-ee/auth/plugin'
565
584
  import { content } from '@murumets-ee/content/plugin'
566
585
  import { defineConfig } from '@murumets-ee/core'
586
+ import { logging } from '@murumets-ee/logging/plugin'
567
587
  import { mail, ResendMailProvider } from '@murumets-ee/mail'
568
588
  import { media } from '@murumets-ee/media/plugin'
569
589
  import { queue } from '@murumets-ee/queue/plugin'
@@ -595,6 +615,7 @@ export default defineConfig({
595
615
  locales: [{ code: 'en', label: 'English' }],
596
616
  defaultLocale: 'en',
597
617
  }),
618
+ logging(),
598
619
  settings(),
599
620
  storage(),
600
621
  media(),
@@ -712,9 +733,10 @@ export async function getToolkitApp(): Promise<ToolkitApp> {
712
733
  `),await e(o(a,"lib/auth.ts"),`import { getToolkitApp } from './app'
713
734
  import { getAuth } from '@murumets-ee/auth'
714
735
 
715
- await getToolkitApp()
716
-
717
- export const auth = getAuth()
736
+ export async function getAuthInstance() {
737
+ await getToolkitApp()
738
+ return getAuth()
739
+ }
718
740
  `),await e(o(a,"lib/auth-client.ts"),`import { createClient } from '@murumets-ee/auth/client'
719
741
 
720
742
  export const authClient = createClient()
@@ -1143,9 +1165,25 @@ export default async function HomePage() {
1143
1165
  )
1144
1166
  }
1145
1167
  `),await e(o(a,"app/api/auth/[...all]/route.ts"),`import { toNextJsHandler } from 'better-auth/next-js'
1146
- import { auth } from '@${r}/config/auth'
1168
+ import { getAuthInstance } from '@${r}/config/auth'
1169
+
1170
+ let _handler: ReturnType<typeof toNextJsHandler> | null = null
1171
+
1172
+ async function handler() {
1173
+ if (!_handler) {
1174
+ const auth = await getAuthInstance()
1175
+ _handler = toNextJsHandler(auth)
1176
+ }
1177
+ return _handler
1178
+ }
1147
1179
 
1148
- export const { GET, POST } = toNextJsHandler(auth)
1180
+ export async function GET(req: Request) {
1181
+ return (await handler()).GET(req)
1182
+ }
1183
+
1184
+ export async function POST(req: Request) {
1185
+ return (await handler()).POST(req)
1186
+ }
1149
1187
  `),await e(o(a,"app/[locale]/auth/layout.tsx"),`import { AuthProviders } from './providers'
1150
1188
  import type { ReactNode } from 'react'
1151
1189
 
@@ -1961,6 +1999,7 @@ export function NavHeader() {
1961
1999
  `)}import{join as d}from"path";async function C(t,n){let{name:r}=n;await e(d(t,"toolkit.config.ts"),`import { auth } from '@murumets-ee/auth/plugin'
1962
2000
  import { content } from '@murumets-ee/content/plugin'
1963
2001
  import { defineConfig } from '@murumets-ee/core'
2002
+ import { logging } from '@murumets-ee/logging/plugin'
1964
2003
  import { mail, ResendMailProvider } from '@murumets-ee/mail'
1965
2004
  import { media } from '@murumets-ee/media/plugin'
1966
2005
  import { queue } from '@murumets-ee/queue/plugin'
@@ -1992,6 +2031,7 @@ export default defineConfig({
1992
2031
  locales: [{ code: 'en', label: 'English' }],
1993
2032
  defaultLocale: 'en',
1994
2033
  }),
2034
+ logging(),
1995
2035
  settings(),
1996
2036
  storage(),
1997
2037
  media(),
@@ -2059,4 +2099,4 @@ export const auth = betterAuth({
2059
2099
  `),await e(d(t,"generated/auth-schema.ts"),`// This file is generated by better-auth CLI.
2060
2100
  // Run: npx @better-auth/cli generate --config auth.config.ts -y
2061
2101
  export {}
2062
- `)}async function O(t,n){t.mode==="single"?await q(t,n):await U(t,n)}async function q(t,n){let r=v(process.cwd(),t.name);n?.("Creating Next.js app..."),l(`pnpm create next-app@${"16"} ${t.name} --typescript --tailwind --no-eslint --app --no-src-dir --turbopack --react-compiler --skip-install --import-alias "@/*"`),await u(r,["app/page.tsx","app/page.module.css","app/fonts","README.md"]),await c(v(r,"package.json"),{type:"module",dependencies:{"@murumets-ee/core":`^${i.myorgCore}`,"@murumets-ee/db":`^${i.myorgDb}`,"@murumets-ee/entity":`^${i.myorgEntity}`,"@murumets-ee/logging":`^${i.myorgLogging}`,"@murumets-ee/auth":`^${i.myorgAuth}`,"@murumets-ee/auth-ui":`^${i.myorgAuthUi}`,"@murumets-ee/admin-ui":`^${i.myorgAdminUi}`,"@murumets-ee/content":`^${i.myorgContent}`,"@murumets-ee/settings":`^${i.myorgSettings}`,"@murumets-ee/storage":`^${i.myorgStorage}`,"@murumets-ee/media":`^${i.myorgMedia}`,"@murumets-ee/taxonomy":`^${i.myorgTaxonomy}`,"@murumets-ee/queue":`^${i.myorgQueue}`,"@murumets-ee/mail":`^${i.myorgMail}`,"@murumets-ee/ticketing":`^${i.myorgTicketing}`,"@murumets-ee/ticketing-ui":`^${i.myorgTicketingUi}`,"@murumets-ee/tokens":`^${i.myorgTokens}`,"better-auth":`^${i.betterAuth}`,"drizzle-orm":`^${i.drizzleOrm}`,"next-intl":`^${i.nextIntl}`,"next-themes":`^${i.nextThemes}`,"lucide-react":`^${i.lucideReact}`,postgres:`^${i.postgres}`,"react-hook-form":`^${i.reactHookForm}`,"@hookform/resolvers":`^${i.hookformResolvers}`,zod:`^${i.zod}`},devDependencies:{"drizzle-kit":`^${i.drizzleKit}`,tsx:`^${i.tsx}`,"babel-plugin-react-compiler":i.babelReactCompiler},scripts:{"db:generate":"tsx --env-file=.env scripts/generate-schema.ts","db:migrate:generate":"drizzle-kit generate","db:migrate":"tsx --env-file=.env scripts/migrate.ts","db:reset":"tsx --env-file=.env scripts/reset-db.ts"}}),n?.("Adding toolkit files..."),await k(r,t),await A(r,t),await C(r,t),await w(r,t),await T(r,t),await P(r,t),await z(r,t),await R(r,t),t.installDeps&&(n?.("Installing dependencies..."),l("pnpm install",{cwd:r}))}async function U(t,n){let r=v(process.cwd(),t.name);n?.("Creating workspace..."),await E(r,t,n),t.installDeps&&(n?.("Installing dependencies..."),l("pnpm install",{cwd:r}))}export{O as scaffold};
2102
+ `)}async function O(t,n){t.mode==="single"?await q(t,n):await I(t,n)}async function q(t,n){let r=v(process.cwd(),t.name);n?.("Creating Next.js app..."),l(`pnpm create next-app@${"16"} ${t.name} --typescript --tailwind --no-eslint --app --no-src-dir --turbopack --react-compiler --skip-install --import-alias "@/*"`),await u(r,["app/page.tsx","app/page.module.css","app/fonts","README.md"]),await c(v(r,"package.json"),{type:"module",dependencies:{"@murumets-ee/core":`^${i.myorgCore}`,"@murumets-ee/db":`^${i.myorgDb}`,"@murumets-ee/entity":`^${i.myorgEntity}`,"@murumets-ee/logging":`^${i.myorgLogging}`,"@murumets-ee/auth":`^${i.myorgAuth}`,"@murumets-ee/auth-ui":`^${i.myorgAuthUi}`,"@murumets-ee/admin-ui":`^${i.myorgAdminUi}`,"@murumets-ee/content":`^${i.myorgContent}`,"@murumets-ee/settings":`^${i.myorgSettings}`,"@murumets-ee/storage":`^${i.myorgStorage}`,"@murumets-ee/media":`^${i.myorgMedia}`,"@murumets-ee/taxonomy":`^${i.myorgTaxonomy}`,"@murumets-ee/queue":`^${i.myorgQueue}`,"@murumets-ee/mail":`^${i.myorgMail}`,"@murumets-ee/ticketing":`^${i.myorgTicketing}`,"@murumets-ee/ticketing-ui":`^${i.myorgTicketingUi}`,"@murumets-ee/tokens":`^${i.myorgTokens}`,"better-auth":`^${i.betterAuth}`,"drizzle-orm":`^${i.drizzleOrm}`,"next-intl":`^${i.nextIntl}`,"next-themes":`^${i.nextThemes}`,"lucide-react":`^${i.lucideReact}`,postgres:`^${i.postgres}`,"react-hook-form":`^${i.reactHookForm}`,"@hookform/resolvers":`^${i.hookformResolvers}`,zod:`^${i.zod}`},devDependencies:{"drizzle-kit":`^${i.drizzleKit}`,tsx:`^${i.tsx}`,"babel-plugin-react-compiler":i.babelReactCompiler},scripts:{"db:generate":"tsx --env-file=.env scripts/generate-schema.ts","db:migrate:generate":"drizzle-kit generate","db:migrate":"tsx --env-file=.env scripts/migrate.ts","db:reset":"tsx --env-file=.env scripts/reset-db.ts"}}),n?.("Adding toolkit files..."),await k(r,t),await A(r,t),await C(r,t),await w(r,t),await T(r,t),await P(r,t),await z(r,t),await R(r,t),t.installDeps&&(n?.("Installing dependencies..."),l("pnpm install",{cwd:r}))}async function I(t,n){let r=v(process.cwd(),t.name);n?.("Creating workspace..."),await E(r,t,n),t.installDeps&&(n?.("Installing dependencies..."),l("pnpm install",{cwd:r}))}export{O as scaffold};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@murumets-ee/create",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,8 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js"
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
13
14
  }
14
15
  },
15
16
  "files": [