create-rudder 1.4.1 → 1.5.0
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.
- package/README.md +23 -5
- package/dist/agent-detect.d.ts +21 -0
- package/dist/agent-detect.d.ts.map +1 -0
- package/dist/agent-detect.js +36 -0
- package/dist/agent-detect.js.map +1 -0
- package/dist/cli-flags.d.ts +60 -0
- package/dist/cli-flags.d.ts.map +1 -0
- package/dist/cli-flags.js +251 -0
- package/dist/cli-flags.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +642 -0
- package/dist/index.js.map +1 -0
- package/dist/logo.d.ts +6 -0
- package/dist/logo.d.ts.map +1 -0
- package/dist/logo.js +52 -0
- package/dist/logo.js.map +1 -0
- package/dist/templates/app/auth-controller.d.ts +2 -0
- package/dist/templates/app/auth-controller.d.ts.map +1 -0
- package/dist/templates/app/auth-controller.js +53 -0
- package/dist/templates/app/auth-controller.js.map +1 -0
- package/dist/templates/app/mcp-echo-server.d.ts +2 -0
- package/dist/templates/app/mcp-echo-server.d.ts.map +1 -0
- package/dist/templates/app/mcp-echo-server.js +13 -0
- package/dist/templates/app/mcp-echo-server.js.map +1 -0
- package/dist/templates/app/mcp-echo-tool.d.ts +2 -0
- package/dist/templates/app/mcp-echo-tool.d.ts.map +1 -0
- package/dist/templates/app/mcp-echo-tool.js +20 -0
- package/dist/templates/app/mcp-echo-tool.js.map +1 -0
- package/dist/templates/app/service-provider.d.ts +3 -0
- package/dist/templates/app/service-provider.d.ts.map +1 -0
- package/dist/templates/app/service-provider.js +33 -0
- package/dist/templates/app/service-provider.js.map +1 -0
- package/dist/templates/app/terminal-dashboard.d.ts +2 -0
- package/dist/templates/app/terminal-dashboard.d.ts.map +1 -0
- package/dist/templates/app/terminal-dashboard.js +22 -0
- package/dist/templates/app/terminal-dashboard.js.map +1 -0
- package/dist/templates/app/user-model.d.ts +2 -0
- package/dist/templates/app/user-model.d.ts.map +1 -0
- package/dist/templates/app/user-model.js +19 -0
- package/dist/templates/app/user-model.js.map +1 -0
- package/dist/templates/bootstrap/app.d.ts +3 -0
- package/dist/templates/bootstrap/app.d.ts.map +1 -0
- package/dist/templates/bootstrap/app.js +41 -0
- package/dist/templates/bootstrap/app.js.map +1 -0
- package/dist/templates/bootstrap/providers.d.ts +3 -0
- package/dist/templates/bootstrap/providers.d.ts.map +1 -0
- package/dist/templates/bootstrap/providers.js +27 -0
- package/dist/templates/bootstrap/providers.js.map +1 -0
- package/dist/templates/components/site-header.d.ts +4 -0
- package/dist/templates/components/site-header.d.ts.map +1 -0
- package/dist/templates/components/site-header.js +233 -0
- package/dist/templates/components/site-header.js.map +1 -0
- package/dist/templates/configs/ai.d.ts +2 -0
- package/dist/templates/configs/ai.d.ts.map +1 -0
- package/dist/templates/configs/ai.js +32 -0
- package/dist/templates/configs/ai.js.map +1 -0
- package/dist/templates/configs/app.d.ts +2 -0
- package/dist/templates/configs/app.d.ts.map +1 -0
- package/dist/templates/configs/app.js +12 -0
- package/dist/templates/configs/app.js.map +1 -0
- package/dist/templates/configs/auth.d.ts +3 -0
- package/dist/templates/configs/auth.d.ts.map +1 -0
- package/dist/templates/configs/auth.js +16 -0
- package/dist/templates/configs/auth.js.map +1 -0
- package/dist/templates/configs/cache.d.ts +2 -0
- package/dist/templates/configs/cache.d.ts.map +1 -0
- package/dist/templates/configs/cache.js +28 -0
- package/dist/templates/configs/cache.js.map +1 -0
- package/dist/templates/configs/crypt.d.ts +2 -0
- package/dist/templates/configs/crypt.d.ts.map +1 -0
- package/dist/templates/configs/crypt.js +16 -0
- package/dist/templates/configs/crypt.js.map +1 -0
- package/dist/templates/configs/database.d.ts +3 -0
- package/dist/templates/configs/database.d.ts.map +1 -0
- package/dist/templates/configs/database.js +28 -0
- package/dist/templates/configs/database.js.map +1 -0
- package/dist/templates/configs/hash.d.ts +2 -0
- package/dist/templates/configs/hash.d.ts.map +1 -0
- package/dist/templates/configs/hash.js +12 -0
- package/dist/templates/configs/hash.js.map +1 -0
- package/dist/templates/configs/horizon.d.ts +2 -0
- package/dist/templates/configs/horizon.d.ts.map +1 -0
- package/dist/templates/configs/horizon.js +30 -0
- package/dist/templates/configs/horizon.js.map +1 -0
- package/dist/templates/configs/index.d.ts +3 -0
- package/dist/templates/configs/index.d.ts.map +1 -0
- package/dist/templates/configs/index.js +92 -0
- package/dist/templates/configs/index.js.map +1 -0
- package/dist/templates/configs/localization.d.ts +2 -0
- package/dist/templates/configs/localization.d.ts.map +1 -0
- package/dist/templates/configs/localization.js +13 -0
- package/dist/templates/configs/localization.js.map +1 -0
- package/dist/templates/configs/log.d.ts +2 -0
- package/dist/templates/configs/log.d.ts.map +1 -0
- package/dist/templates/configs/log.js +40 -0
- package/dist/templates/configs/log.js.map +1 -0
- package/dist/templates/configs/mail.d.ts +2 -0
- package/dist/templates/configs/mail.d.ts.map +1 -0
- package/dist/templates/configs/mail.js +33 -0
- package/dist/templates/configs/mail.js.map +1 -0
- package/dist/templates/configs/passport.d.ts +2 -0
- package/dist/templates/configs/passport.d.ts.map +1 -0
- package/dist/templates/configs/passport.js +22 -0
- package/dist/templates/configs/passport.js.map +1 -0
- package/dist/templates/configs/pennant.d.ts +2 -0
- package/dist/templates/configs/pennant.d.ts.map +1 -0
- package/dist/templates/configs/pennant.js +16 -0
- package/dist/templates/configs/pennant.js.map +1 -0
- package/dist/templates/configs/pulse.d.ts +2 -0
- package/dist/templates/configs/pulse.d.ts.map +1 -0
- package/dist/templates/configs/pulse.js +21 -0
- package/dist/templates/configs/pulse.js.map +1 -0
- package/dist/templates/configs/queue.d.ts +2 -0
- package/dist/templates/configs/queue.d.ts.map +1 -0
- package/dist/templates/configs/queue.js +28 -0
- package/dist/templates/configs/queue.js.map +1 -0
- package/dist/templates/configs/sanctum.d.ts +2 -0
- package/dist/templates/configs/sanctum.d.ts.map +1 -0
- package/dist/templates/configs/sanctum.js +19 -0
- package/dist/templates/configs/sanctum.js.map +1 -0
- package/dist/templates/configs/server.d.ts +2 -0
- package/dist/templates/configs/server.d.ts.map +1 -0
- package/dist/templates/configs/server.js +15 -0
- package/dist/templates/configs/server.js.map +1 -0
- package/dist/templates/configs/session.d.ts +2 -0
- package/dist/templates/configs/session.d.ts.map +1 -0
- package/dist/templates/configs/session.js +26 -0
- package/dist/templates/configs/session.js.map +1 -0
- package/dist/templates/configs/socialite.d.ts +2 -0
- package/dist/templates/configs/socialite.d.ts.map +1 -0
- package/dist/templates/configs/socialite.js +27 -0
- package/dist/templates/configs/socialite.js.map +1 -0
- package/dist/templates/configs/storage.d.ts +2 -0
- package/dist/templates/configs/storage.d.ts.map +1 -0
- package/dist/templates/configs/storage.js +35 -0
- package/dist/templates/configs/storage.js.map +1 -0
- package/dist/templates/configs/sync.d.ts +3 -0
- package/dist/templates/configs/sync.d.ts.map +1 -0
- package/dist/templates/configs/sync.js +17 -0
- package/dist/templates/configs/sync.js.map +1 -0
- package/dist/templates/configs/telescope.d.ts +2 -0
- package/dist/templates/configs/telescope.d.ts.map +1 -0
- package/dist/templates/configs/telescope.js +25 -0
- package/dist/templates/configs/telescope.js.map +1 -0
- package/dist/templates/css/index.d.ts +3 -0
- package/dist/templates/css/index.d.ts.map +1 -0
- package/dist/templates/css/index.js +140 -0
- package/dist/templates/css/index.js.map +1 -0
- package/dist/templates/css/plain.d.ts +2 -0
- package/dist/templates/css/plain.d.ts.map +1 -0
- package/dist/templates/css/plain.js +373 -0
- package/dist/templates/css/plain.js.map +1 -0
- package/dist/templates/css/tailwind.d.ts +2 -0
- package/dist/templates/css/tailwind.d.ts.map +1 -0
- package/dist/templates/css/tailwind.js +176 -0
- package/dist/templates/css/tailwind.js.map +1 -0
- package/dist/templates/env.d.ts +7 -0
- package/dist/templates/env.d.ts.map +1 -0
- package/dist/templates/env.js +113 -0
- package/dist/templates/env.js.map +1 -0
- package/dist/templates/package-json.d.ts +3 -0
- package/dist/templates/package-json.d.ts.map +1 -0
- package/dist/templates/package-json.js +204 -0
- package/dist/templates/package-json.js.map +1 -0
- package/dist/templates/package-managers.d.ts +14 -0
- package/dist/templates/package-managers.d.ts.map +1 -0
- package/dist/templates/package-managers.js +49 -0
- package/dist/templates/package-managers.js.map +1 -0
- package/dist/templates/pages/ai-chat.d.ts +7 -0
- package/dist/templates/pages/ai-chat.d.ts.map +1 -0
- package/dist/templates/pages/ai-chat.js +285 -0
- package/dist/templates/pages/ai-chat.js.map +1 -0
- package/dist/templates/pages/demo.d.ts +4 -0
- package/dist/templates/pages/demo.d.ts.map +1 -0
- package/dist/templates/pages/demo.js +71 -0
- package/dist/templates/pages/demo.js.map +1 -0
- package/dist/templates/pages/error.d.ts +7 -0
- package/dist/templates/pages/error.d.ts.map +1 -0
- package/dist/templates/pages/error.js +148 -0
- package/dist/templates/pages/error.js.map +1 -0
- package/dist/templates/pages/index.d.ts +22 -0
- package/dist/templates/pages/index.d.ts.map +1 -0
- package/dist/templates/pages/index.js +374 -0
- package/dist/templates/pages/index.js.map +1 -0
- package/dist/templates/prisma/auth.d.ts +2 -0
- package/dist/templates/prisma/auth.d.ts.map +1 -0
- package/dist/templates/prisma/auth.js +22 -0
- package/dist/templates/prisma/auth.js.map +1 -0
- package/dist/templates/prisma/base.d.ts +3 -0
- package/dist/templates/prisma/base.d.ts.map +1 -0
- package/dist/templates/prisma/base.js +14 -0
- package/dist/templates/prisma/base.js.map +1 -0
- package/dist/templates/prisma/config.d.ts +3 -0
- package/dist/templates/prisma/config.d.ts.map +1 -0
- package/dist/templates/prisma/config.js +15 -0
- package/dist/templates/prisma/config.js.map +1 -0
- package/dist/templates/prisma/notification.d.ts +2 -0
- package/dist/templates/prisma/notification.d.ts.map +1 -0
- package/dist/templates/prisma/notification.js +16 -0
- package/dist/templates/prisma/notification.js.map +1 -0
- package/dist/templates/prisma/passport.d.ts +2 -0
- package/dist/templates/prisma/passport.d.ts.map +1 -0
- package/dist/templates/prisma/passport.js +69 -0
- package/dist/templates/prisma/passport.js.map +1 -0
- package/dist/templates/routes/api.d.ts +3 -0
- package/dist/templates/routes/api.d.ts.map +1 -0
- package/dist/templates/routes/api.js +76 -0
- package/dist/templates/routes/api.js.map +1 -0
- package/dist/templates/routes/console.d.ts +3 -0
- package/dist/templates/routes/console.d.ts.map +1 -0
- package/dist/templates/routes/console.js +29 -0
- package/dist/templates/routes/console.js.map +1 -0
- package/dist/templates/routes/web.d.ts +4 -0
- package/dist/templates/routes/web.d.ts.map +1 -0
- package/dist/templates/routes/web.js +77 -0
- package/dist/templates/routes/web.js.map +1 -0
- package/dist/templates/routes-manifest.d.ts +28 -0
- package/dist/templates/routes-manifest.d.ts.map +1 -0
- package/dist/templates/routes-manifest.js +48 -0
- package/dist/templates/routes-manifest.js.map +1 -0
- package/dist/templates/server.d.ts +2 -0
- package/dist/templates/server.d.ts.map +1 -0
- package/dist/templates/server.js +10 -0
- package/dist/templates/server.js.map +1 -0
- package/dist/templates/tsconfig.d.ts +3 -0
- package/dist/templates/tsconfig.d.ts.map +1 -0
- package/dist/templates/tsconfig.js +33 -0
- package/dist/templates/tsconfig.js.map +1 -0
- package/dist/templates/views/welcome.d.ts +19 -0
- package/dist/templates/views/welcome.d.ts.map +1 -0
- package/dist/templates/views/welcome.js +338 -0
- package/dist/templates/views/welcome.js.map +1 -0
- package/dist/templates/vite.d.ts +3 -0
- package/dist/templates/vite.d.ts.map +1 -0
- package/dist/templates/vite.js +66 -0
- package/dist/templates/vite.js.map +1 -0
- package/dist/templates.d.ts +45 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +202 -0
- package/dist/templates.js.map +1 -0
- package/package.json +27 -7
- package/bin/index.mjs +0 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/templates/prisma/auth.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU;IACxB,OAAO;;;;;;;;;;;;;;;;;;CAkBR,CAAA;AACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/templates/prisma/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,wBAAgB,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAavD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function prismaBase(ctx) {
|
|
2
|
+
const provider = ctx.db === 'sqlite' ? 'sqlite'
|
|
3
|
+
: ctx.db === 'postgresql' ? 'postgresql'
|
|
4
|
+
: 'mysql';
|
|
5
|
+
return `generator client {
|
|
6
|
+
provider = "prisma-client-js"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
datasource db {
|
|
10
|
+
provider = "${provider}"
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/templates/prisma/base.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAAC,GAAoB;IAC7C,MAAM,QAAQ,GAAG,GAAG,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ;QAC7C,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY;YACxC,CAAC,CAAC,OAAO,CAAA;IAEX,OAAO;;;;;gBAKO,QAAQ;;CAEvB,CAAA;AACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/templates/prisma/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,wBAAgB,YAAY,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAczD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function prismaConfig(ctx) {
|
|
2
|
+
const dbUrl = ctx.db === 'sqlite'
|
|
3
|
+
? "process.env['DATABASE_URL'] ?? 'file:./dev.db'"
|
|
4
|
+
: "process.env['DATABASE_URL']!";
|
|
5
|
+
return `import { defineConfig } from 'prisma/config'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
schema: 'prisma/schema',
|
|
9
|
+
datasource: {
|
|
10
|
+
url: ${dbUrl},
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/templates/prisma/config.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,GAAoB;IAC/C,MAAM,KAAK,GAAG,GAAG,CAAC,EAAE,KAAK,QAAQ;QAC/B,CAAC,CAAC,gDAAgD;QAClD,CAAC,CAAC,8BAA8B,CAAA;IAElC,OAAO;;;;;WAKE,KAAK;;;CAGf,CAAA;AACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/templates/prisma/notification.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,IAAI,MAAM,CAc3C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function prismaNotification() {
|
|
2
|
+
return `model Notification {
|
|
3
|
+
id String @id @default(cuid())
|
|
4
|
+
notifiable_id String
|
|
5
|
+
notifiable_type String
|
|
6
|
+
type String
|
|
7
|
+
data String
|
|
8
|
+
read_at String?
|
|
9
|
+
created_at String
|
|
10
|
+
updated_at String
|
|
11
|
+
|
|
12
|
+
@@index([notifiable_type, notifiable_id])
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/templates/prisma/notification.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB;IAChC,OAAO;;;;;;;;;;;;CAYR,CAAA;AACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passport.d.ts","sourceRoot":"","sources":["../../../src/templates/prisma/passport.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,IAAI,MAAM,CAmEvC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export function prismaPassport() {
|
|
2
|
+
return `model OAuthClient {
|
|
3
|
+
id String @id @default(cuid())
|
|
4
|
+
name String
|
|
5
|
+
secret String?
|
|
6
|
+
redirectUris String @default("[]")
|
|
7
|
+
grantTypes String @default("[\\"authorization_code\\"]")
|
|
8
|
+
scopes String @default("[]")
|
|
9
|
+
confidential Boolean @default(true)
|
|
10
|
+
revoked Boolean @default(false)
|
|
11
|
+
createdAt DateTime @default(now())
|
|
12
|
+
updatedAt DateTime @updatedAt
|
|
13
|
+
|
|
14
|
+
@@map("oauth_clients")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
model OAuthAccessToken {
|
|
18
|
+
id String @id @default(cuid())
|
|
19
|
+
userId String?
|
|
20
|
+
clientId String
|
|
21
|
+
name String?
|
|
22
|
+
scopes String @default("[]")
|
|
23
|
+
revoked Boolean @default(false)
|
|
24
|
+
expiresAt DateTime
|
|
25
|
+
createdAt DateTime @default(now())
|
|
26
|
+
|
|
27
|
+
@@index([userId])
|
|
28
|
+
@@map("oauth_access_tokens")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
model OAuthRefreshToken {
|
|
32
|
+
id String @id @default(cuid())
|
|
33
|
+
accessTokenId String @unique
|
|
34
|
+
revoked Boolean @default(false)
|
|
35
|
+
expiresAt DateTime
|
|
36
|
+
|
|
37
|
+
@@map("oauth_refresh_tokens")
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
model OAuthAuthCode {
|
|
41
|
+
id String @id @default(cuid())
|
|
42
|
+
userId String
|
|
43
|
+
clientId String
|
|
44
|
+
scopes String @default("[]")
|
|
45
|
+
revoked Boolean @default(false)
|
|
46
|
+
expiresAt DateTime
|
|
47
|
+
codeChallenge String?
|
|
48
|
+
codeChallengeMethod String?
|
|
49
|
+
|
|
50
|
+
@@map("oauth_auth_codes")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
model OAuthDeviceCode {
|
|
54
|
+
id String @id @default(cuid())
|
|
55
|
+
clientId String
|
|
56
|
+
userCode String @unique
|
|
57
|
+
deviceCode String @unique
|
|
58
|
+
scopes String @default("[]")
|
|
59
|
+
userId String?
|
|
60
|
+
approved Boolean?
|
|
61
|
+
expiresAt DateTime
|
|
62
|
+
lastPolledAt DateTime?
|
|
63
|
+
createdAt DateTime @default(now())
|
|
64
|
+
|
|
65
|
+
@@map("oauth_device_codes")
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=passport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passport.js","sourceRoot":"","sources":["../../../src/templates/prisma/passport.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc;IAC5B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiER,CAAA;AACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/templates/routes/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,wBAAgB,SAAS,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAiFtD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export function routesApi(ctx) {
|
|
2
|
+
const imports = [
|
|
3
|
+
"import { router } from '@rudderjs/router'",
|
|
4
|
+
];
|
|
5
|
+
const lines = [];
|
|
6
|
+
if (ctx.packages.auth || ctx.packages.ai) {
|
|
7
|
+
imports.push("import { app } from '@rudderjs/core'");
|
|
8
|
+
}
|
|
9
|
+
if (ctx.packages.auth) {
|
|
10
|
+
imports.push("import { Auth, AuthManager, runWithAuth } from '@rudderjs/auth'");
|
|
11
|
+
imports.push("import { SessionMiddleware } from '@rudderjs/session'");
|
|
12
|
+
}
|
|
13
|
+
if (ctx.packages.ai) {
|
|
14
|
+
imports.push("import { AI } from '@rudderjs/ai'");
|
|
15
|
+
}
|
|
16
|
+
lines.push('');
|
|
17
|
+
lines.push("router.get('/api/health', (_req, res) => res.json({ status: 'ok' }))");
|
|
18
|
+
if (ctx.packages.auth) {
|
|
19
|
+
lines.push('');
|
|
20
|
+
lines.push(`// GET /api/me — returns current user or null (Laravel Sanctum SPA-style).
|
|
21
|
+
// Api routes are stateless by default, so session is opted in per-route.
|
|
22
|
+
// Session-mutating handlers (sign-in, sign-up, sign-out, password reset)
|
|
23
|
+
// live in routes/web.ts so they inherit SessionMiddleware from the web group.
|
|
24
|
+
router.get('/api/me', async (req, res) => {
|
|
25
|
+
const manager = app().make<AuthManager>('auth.manager')
|
|
26
|
+
let user: Record<string, unknown> | null = null
|
|
27
|
+
await runWithAuth(manager, async () => {
|
|
28
|
+
const authUser = await Auth.user()
|
|
29
|
+
if (authUser) {
|
|
30
|
+
user = { id: authUser.getAuthIdentifier() }
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
res.json({ user })
|
|
34
|
+
}, [SessionMiddleware()])`);
|
|
35
|
+
}
|
|
36
|
+
if (ctx.packages.ai) {
|
|
37
|
+
lines.push('');
|
|
38
|
+
lines.push(`// POST /api/ai/chat — simple AI chat endpoint
|
|
39
|
+
router.post('/api/ai/chat', async (req, res) => {
|
|
40
|
+
const { messages } = req.body as { messages: { role: string; content: string }[] }
|
|
41
|
+
const lastMessage = messages.at(-1)?.content ?? ''
|
|
42
|
+
const response = await AI.agent('You are a helpful assistant.').prompt(lastMessage)
|
|
43
|
+
res.json({ message: response.text })
|
|
44
|
+
})`);
|
|
45
|
+
}
|
|
46
|
+
if (ctx.packages.passport) {
|
|
47
|
+
imports.push("import { registerPassportRoutes, RequireBearer, scope } from '@rudderjs/passport'");
|
|
48
|
+
lines.push('');
|
|
49
|
+
lines.push(`// ── Passport OAuth 2 routes ──────────────────────────────
|
|
50
|
+
//
|
|
51
|
+
// Registers /oauth/authorize, /oauth/token, /oauth/tokens/:id,
|
|
52
|
+
// /oauth/scopes, /oauth/device/code, /oauth/device/approve.
|
|
53
|
+
//
|
|
54
|
+
// Requires: RSA keys via \`pnpm rudder passport:keys\` and an OAuth client
|
|
55
|
+
// via \`pnpm rudder passport:client <name>\`.
|
|
56
|
+
const passportRouter = {
|
|
57
|
+
get: (path: string, handler: any) => router.get(path, handler),
|
|
58
|
+
post: (path: string, handler: any) => router.post(path, handler),
|
|
59
|
+
delete: (path: string, handler: any) => router.delete(path, handler),
|
|
60
|
+
}
|
|
61
|
+
registerPassportRoutes(passportRouter as any)
|
|
62
|
+
|
|
63
|
+
// Example: protected route requiring a Bearer token with 'read' scope
|
|
64
|
+
router.get('/api/passport/me', async (req, res) => {
|
|
65
|
+
res.json({
|
|
66
|
+
user: req.user ?? null,
|
|
67
|
+
scopes: (req.raw as any)?.__passport_scopes ?? [],
|
|
68
|
+
})
|
|
69
|
+
}, [RequireBearer(), scope('read')])`);
|
|
70
|
+
}
|
|
71
|
+
lines.push('');
|
|
72
|
+
lines.push("// Catch-all: any unmatched /api/* route returns 404");
|
|
73
|
+
lines.push("router.all('/api/*', (_req, res) => res.status(404).json({ message: 'Route not found.' }))");
|
|
74
|
+
return imports.join('\n') + '\n' + lines.join('\n') + '\n';
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/templates/routes/api.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,GAAoB;IAC5C,MAAM,OAAO,GAAa;QACxB,2CAA2C;KAC5C,CAAA;IACD,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;IACtD,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAA;QAC/E,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAA;IACvE,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAA;IACnD,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAA;IAElF,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACd,KAAK,CAAC,IAAI,CAAC;;;;;;;;;;;;;;0BAcW,CAAC,CAAA;IACzB,CAAC;IAED,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACpB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACd,KAAK,CAAC,IAAI,CAAC;;;;;;GAMZ,CAAC,CAAA;IACF,CAAC;IAED,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC,mFAAmF,CAAC,CAAA;QACjG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACd,KAAK,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;qCAoBsB,CAAC,CAAA;IACpC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAA;IAClE,KAAK,CAAC,IAAI,CAAC,4FAA4F,CAAC,CAAA;IAExG,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../src/templates/routes/console.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,wBAAgB,aAAa,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA2B1D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function routesConsole(ctx) {
|
|
2
|
+
return [
|
|
3
|
+
`import { rudder } from '@rudderjs/console'`,
|
|
4
|
+
...(ctx.packages.terminal ? [`import { terminal } from '@rudderjs/terminal'`] : []),
|
|
5
|
+
``,
|
|
6
|
+
`rudder.command('inspire', () => {`,
|
|
7
|
+
` const quotes = [`,
|
|
8
|
+
` 'The best way to predict the future is to create it.',`,
|
|
9
|
+
` 'Build something people want.',`,
|
|
10
|
+
` 'Stay hungry, stay foolish.',`,
|
|
11
|
+
` 'Code is poetry.',`,
|
|
12
|
+
` 'Simplicity is the soul of efficiency.',`,
|
|
13
|
+
` ]`,
|
|
14
|
+
` const quote = quotes[Math.floor(Math.random() * quotes.length)]!`,
|
|
15
|
+
` console.log(\`\\n "\${quote}"\\n\`)`,
|
|
16
|
+
`}).description('Display an inspiring quote')`,
|
|
17
|
+
``,
|
|
18
|
+
`// db:seed is provided by @rudderjs/orm. To add seed data, create`,
|
|
19
|
+
`// database/seeders/DatabaseSeeder.ts with a default-exported Seeder`,
|
|
20
|
+
`// subclass (or async function). Then \`pnpm rudder db:seed\` runs it.`,
|
|
21
|
+
...(ctx.packages.terminal ? [
|
|
22
|
+
``,
|
|
23
|
+
`rudder.command('dashboard', async () => {`,
|
|
24
|
+
` await terminal('dashboard')`,
|
|
25
|
+
`}).description('Render the Dashboard view in the terminal')`,
|
|
26
|
+
] : []),
|
|
27
|
+
].join('\n') + '\n';
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=console.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../../src/templates/routes/console.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,GAAoB;IAChD,OAAO;QACL,4CAA4C;QAC5C,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,+CAA+C,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,EAAE;QACF,mCAAmC;QACnC,oBAAoB;QACpB,4DAA4D;QAC5D,qCAAqC;QACrC,mCAAmC;QACnC,wBAAwB;QACxB,8CAA8C;QAC9C,KAAK;QACL,oEAAoE;QACpE,wCAAwC;QACxC,8CAA8C;QAC9C,EAAE;QACF,mEAAmE;QACnE,sEAAsE;QACtE,wEAAwE;QACxE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC1B,EAAE;YACF,2CAA2C;YAC3C,+BAA+B;YAC/B,6DAA6D;SAC9D,CAAC,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../../src/templates/routes/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,wBAAgB,SAAS,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA6EtD;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAEhE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export function routesWeb(ctx) {
|
|
2
|
+
const hasAuth = ctx.packages.auth;
|
|
3
|
+
// Welcome route fires for single-framework AND no-frontend (vanilla welcome
|
|
4
|
+
// built with @rudderjs/view's html`` tag — see `welcomeViewVanilla` in
|
|
5
|
+
// templates/views/welcome.ts). Multi-framework projects use the file-based
|
|
6
|
+
// pages/index/+Page.* page instead.
|
|
7
|
+
const hasWelcome = ctx.frameworks.length <= 1;
|
|
8
|
+
// ── imports ─────────────────────────────────────────────
|
|
9
|
+
const imports = [`import { Route } from '@rudderjs/router'`];
|
|
10
|
+
if (hasWelcome) {
|
|
11
|
+
imports.push(`import { createRequire } from 'node:module'`);
|
|
12
|
+
imports.push(`import { view } from '@rudderjs/view'`);
|
|
13
|
+
imports.push(`import { config } from '@rudderjs/core'`);
|
|
14
|
+
}
|
|
15
|
+
if (hasAuth) {
|
|
16
|
+
imports.push(`import { CsrfMiddleware } from '@rudderjs/middleware'`);
|
|
17
|
+
imports.push(`import { registerAuthRoutes } from '@rudderjs/auth/routes'`);
|
|
18
|
+
imports.push(`import { AuthController } from '../app/Http/Controllers/AuthController.ts'`);
|
|
19
|
+
}
|
|
20
|
+
// ── middleware chain shared with auth routes + welcome ─
|
|
21
|
+
// SessionMiddleware + AuthMiddleware are auto-installed on the web group by
|
|
22
|
+
// their providers. Only CSRF stays per-route so specific endpoints (webhooks,
|
|
23
|
+
// server-to-server callbacks) can opt out.
|
|
24
|
+
const webMwBlock = hasAuth
|
|
25
|
+
? `
|
|
26
|
+
// Per-route web middleware — session + auth are auto-applied on the web group.
|
|
27
|
+
const webMw = [CsrfMiddleware()]
|
|
28
|
+
`
|
|
29
|
+
: '';
|
|
30
|
+
// ── auth UI wiring ──────────────────────────────────────
|
|
31
|
+
// GET view pages come from `registerAuthRoutes`; the POST submit handlers
|
|
32
|
+
// come from `AuthController` (extends @rudderjs/auth's BaseAuthController).
|
|
33
|
+
// Both live in routes/web.ts so they inherit SessionMiddleware + AuthMiddleware
|
|
34
|
+
// from the web group. Customize the flow by editing app/Http/Controllers/AuthController.ts.
|
|
35
|
+
const authBlock = hasAuth
|
|
36
|
+
? `
|
|
37
|
+
// GET pages — login/register/forgot-password/reset-password
|
|
38
|
+
// Views live in app/Views/Auth/ (vendored from @rudderjs/auth/views/${ctx.primary}/)
|
|
39
|
+
registerAuthRoutes(Route, { middleware: webMw })
|
|
40
|
+
|
|
41
|
+
// POST handlers — sign-in/email, sign-up/email, sign-out, password reset.
|
|
42
|
+
// Edit app/Http/Controllers/AuthController.ts to customize.
|
|
43
|
+
Route.registerController(AuthController)
|
|
44
|
+
`
|
|
45
|
+
: '';
|
|
46
|
+
// ── welcome page wiring ─────────────────────────────────
|
|
47
|
+
// SiteHeader reads `user` from pageContext (set by @rudderjs/auth's enhancer),
|
|
48
|
+
// so the welcome controller no longer needs to pass it as a prop.
|
|
49
|
+
const welcomeFile = ctx.frameworks.length === 0
|
|
50
|
+
? 'app/Views/Welcome.ts'
|
|
51
|
+
: `app/Views/Welcome.${welcomeExt(ctx.primary)}`;
|
|
52
|
+
const welcomeBlock = hasWelcome
|
|
53
|
+
? `
|
|
54
|
+
// Read RudderJS version from @rudderjs/core's package.json at boot time.
|
|
55
|
+
const _require = createRequire(import.meta.url)
|
|
56
|
+
const rudderCorePkg = _require('@rudderjs/core/package.json') as { version: string }
|
|
57
|
+
|
|
58
|
+
// Welcome page — delete this route and ${welcomeFile} to replace it.
|
|
59
|
+
Route.get('/', async () => view('welcome', {
|
|
60
|
+
appName: config<string>('app.name', 'RudderJS'),
|
|
61
|
+
rudderVersion: rudderCorePkg.version,
|
|
62
|
+
nodeVersion: process.version.replace(/^v/, ''),
|
|
63
|
+
env: config<string>('app.env', 'development'),
|
|
64
|
+
})${hasAuth ? ', webMw' : ''})
|
|
65
|
+
`
|
|
66
|
+
: '';
|
|
67
|
+
return `${imports.join('\n')}
|
|
68
|
+
${webMwBlock}${authBlock}${welcomeBlock}
|
|
69
|
+
// Web routes — HTML redirects, guards, and non-API server responses
|
|
70
|
+
// These run before Vike's file-based page routing
|
|
71
|
+
// Use this file for: redirects, server-side auth guards, download routes, sitemaps, etc.
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
export function welcomeExt(fw) {
|
|
75
|
+
return fw === 'vue' ? 'vue' : 'tsx';
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../../src/templates/routes/web.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,GAAoB;IAC5C,MAAM,OAAO,GAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAA;IACrC,4EAA4E;IAC5E,uEAAuE;IACvE,2EAA2E;IAC3E,oCAAoC;IACpC,MAAM,UAAU,GAAI,GAAG,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAA;IAE9C,2DAA2D;IAC3D,MAAM,OAAO,GAAa,CAAC,0CAA0C,CAAC,CAAA;IACtE,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAA;QAC3D,OAAO,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAA;QACrD,OAAO,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAA;IACzD,CAAC;IACD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAA;QACrE,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAA;QAC1E,OAAO,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAA;IAC5F,CAAC;IAED,0DAA0D;IAC1D,4EAA4E;IAC5E,8EAA8E;IAC9E,2CAA2C;IAC3C,MAAM,UAAU,GAAG,OAAO;QACxB,CAAC,CAAC;;;CAGL;QACG,CAAC,CAAC,EAAE,CAAA;IAEN,2DAA2D;IAC3D,0EAA0E;IAC1E,4EAA4E;IAC5E,gFAAgF;IAChF,4FAA4F;IAC5F,MAAM,SAAS,GAAG,OAAO;QACvB,CAAC,CAAC;;uEAEiE,GAAG,CAAC,OAAO;;;;;;CAMjF;QACG,CAAC,CAAC,EAAE,CAAA;IAEN,2DAA2D;IAC3D,+EAA+E;IAC/E,kEAAkE;IAClE,MAAM,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QAC7C,CAAC,CAAC,sBAAsB;QACxB,CAAC,CAAC,qBAAqB,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAA;IAClD,MAAM,YAAY,GAAG,UAAU;QAC7B,CAAC,CAAC;;;;;0CAKoC,WAAW;;;;;;IAMjD,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;CAC3B;QACG,CAAC,CAAC,EAAE,CAAA;IAEN,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;EAC5B,UAAU,GAAG,SAAS,GAAG,YAAY;;;;CAItC,CAAA;AACD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EAA6B;IACtD,OAAO,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TemplateContext } from '../templates.js';
|
|
2
|
+
/**
|
|
3
|
+
* One URL the render smoke should hit. Generated from the scaffolder profile
|
|
4
|
+
* via {@link getProfileRoutes} — each contributor (welcome, auth, an admin
|
|
5
|
+
* dashboard) lists its routes here so a Playwright pass can iterate them
|
|
6
|
+
* without a per-profile hand table.
|
|
7
|
+
*/
|
|
8
|
+
export interface RouteSpec {
|
|
9
|
+
/** URL path the server is expected to serve. */
|
|
10
|
+
path: string;
|
|
11
|
+
/**
|
|
12
|
+
* Symbolic source — used in failure messages to attribute the broken route
|
|
13
|
+
* to the package or template fragment that contributed it.
|
|
14
|
+
*/
|
|
15
|
+
contributedBy: string;
|
|
16
|
+
/** Substring asserted in the response HTML. Skipped when omitted. */
|
|
17
|
+
ssrMarker?: string;
|
|
18
|
+
/** Expected HTTP status. Defaults to 200. */
|
|
19
|
+
expectedStatus?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Map a scaffolder profile (TemplateContext) → the set of URLs that should
|
|
23
|
+
* render in the booted app. Stays in lockstep with {@link routesWeb} and the
|
|
24
|
+
* per-package route registrations so adding a new package + its route shows up
|
|
25
|
+
* here and in the render-check.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getProfileRoutes(ctx: TemplateContext): RouteSpec[];
|
|
28
|
+
//# sourceMappingURL=routes-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-manifest.d.ts","sourceRoot":"","sources":["../../src/templates/routes-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,gDAAgD;IAChD,IAAI,EAAa,MAAM,CAAA;IACvB;;;OAGG;IACH,aAAa,EAAI,MAAM,CAAA;IACvB,qEAAqE;IACrE,SAAS,CAAC,EAAO,MAAM,CAAA;IACvB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,GAAG,SAAS,EAAE,CA6ClE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map a scaffolder profile (TemplateContext) → the set of URLs that should
|
|
3
|
+
* render in the booted app. Stays in lockstep with {@link routesWeb} and the
|
|
4
|
+
* per-package route registrations so adding a new package + its route shows up
|
|
5
|
+
* here and in the render-check.
|
|
6
|
+
*/
|
|
7
|
+
export function getProfileRoutes(ctx) {
|
|
8
|
+
const routes = [];
|
|
9
|
+
const hasFrontend = ctx.frameworks.length >= 1;
|
|
10
|
+
const isApiOnly = ctx.frameworks.length === 0;
|
|
11
|
+
// Welcome page exists for both single-framework (routes/web.ts) and
|
|
12
|
+
// no-frontend (vanilla welcome via @rudderjs/view's html``). Multi-framework
|
|
13
|
+
// scaffolds use pages/index/+Page.* instead — same URL, different shape.
|
|
14
|
+
if (ctx.frameworks.length === 1 || isApiOnly) {
|
|
15
|
+
routes.push({ path: '/', contributedBy: 'welcome', ssrMarker: 'Built with RudderJS' });
|
|
16
|
+
}
|
|
17
|
+
else if (ctx.frameworks.length > 1) {
|
|
18
|
+
routes.push({ path: '/', contributedBy: 'welcome' });
|
|
19
|
+
}
|
|
20
|
+
// No-frontend cells additionally hit /api/health — the always-scaffolded
|
|
21
|
+
// JSON probe — so the smoke exercises the api route stack end-to-end.
|
|
22
|
+
if (isApiOnly) {
|
|
23
|
+
routes.push({ path: '/api/health', contributedBy: 'api.health', ssrMarker: '"status":"ok"' });
|
|
24
|
+
}
|
|
25
|
+
// Auth UI — login/register/forgot-password. RequireGuest middleware lets the
|
|
26
|
+
// pages through for an unauthenticated session (which is what the smoke has).
|
|
27
|
+
// Markers come from packages/auth/views/<framework>/. Only react has vendored
|
|
28
|
+
// views today; vue/solid scaffolds resolve to a missing view at boot. The
|
|
29
|
+
// smoke's auth-view copy step (mirrors index.ts) only fires for react, so we
|
|
30
|
+
// gate the manifest the same way to avoid asserting on routes whose template
|
|
31
|
+
// never reached the project. Skipped on API-only profiles (no frontend → no
|
|
32
|
+
// auth pages even when the package is selected for POST endpoints only).
|
|
33
|
+
if (hasFrontend && ctx.packages.auth && ctx.primary === 'react') {
|
|
34
|
+
routes.push({ path: '/login', contributedBy: 'auth', ssrMarker: 'Welcome back' }, { path: '/register', contributedBy: 'auth', ssrMarker: 'Create an account' }, { path: '/forgot-password', contributedBy: 'auth', ssrMarker: 'Forgot password' });
|
|
35
|
+
}
|
|
36
|
+
// Admin dashboards — scaffolder configs leave them publicly mounted (no
|
|
37
|
+
// auth middleware), so an unauthenticated session can reach them. The title
|
|
38
|
+
// bar substring is a cheap SSR marker that won't false-fire on the welcome
|
|
39
|
+
// page or a 404.
|
|
40
|
+
if (ctx.packages.telescope)
|
|
41
|
+
routes.push({ path: '/telescope', contributedBy: 'telescope', ssrMarker: 'Telescope' });
|
|
42
|
+
if (ctx.packages.pulse)
|
|
43
|
+
routes.push({ path: '/pulse', contributedBy: 'pulse', ssrMarker: 'Pulse' });
|
|
44
|
+
if (ctx.packages.horizon)
|
|
45
|
+
routes.push({ path: '/horizon', contributedBy: 'horizon', ssrMarker: 'Horizon' });
|
|
46
|
+
return routes;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=routes-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-manifest.js","sourceRoot":"","sources":["../../src/templates/routes-manifest.ts"],"names":[],"mappings":"AAsBA;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAoB;IACnD,MAAM,MAAM,GAAgB,EAAE,CAAA;IAC9B,MAAM,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAA;IAC9C,MAAM,SAAS,GAAK,GAAG,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,CAAA;IAE/C,oEAAoE;IACpE,6EAA6E;IAC7E,yEAAyE;IACzE,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,CAAA;IACxF,CAAC;SAAM,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAA;IACtD,CAAC;IAED,yEAAyE;IACzE,sEAAsE;IACtE,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAA;IAC/F,CAAC;IAED,6EAA6E;IAC7E,8EAA8E;IAC9E,8EAA8E;IAC9E,0EAA0E;IAC1E,6EAA6E;IAC7E,6EAA6E;IAC7E,4EAA4E;IAC5E,yEAAyE;IACzE,IAAI,WAAW,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAChE,MAAM,CAAC,IAAI,CACT,EAAE,IAAI,EAAE,QAAQ,EAAY,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,EAC9E,EAAE,IAAI,EAAE,WAAW,EAAS,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,EACnF,EAAE,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAClF,CAAA;IACH,CAAC;IAED,wEAAwE;IACxE,4EAA4E;IAC5E,2EAA2E;IAC3E,iBAAiB;IACjB,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS;QAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAA;IACnH,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK;QAAM,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAM,aAAa,EAAE,OAAO,EAAM,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;IAC/G,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO;QAAI,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAI,aAAa,EAAE,SAAS,EAAI,SAAS,EAAE,SAAS,EAAE,CAAC,CAAA;IAEjH,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/templates/server.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,IAAI,MAAM,CAQjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/templates/server.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ;IACtB,OAAO;;;;;;CAMR,CAAA;AACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.d.ts","sourceRoot":"","sources":["../../src/templates/tsconfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,wBAAgB,YAAY,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAiCzD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function tsconfigJson(ctx) {
|
|
2
|
+
const hasReact = ctx.frameworks.includes('react');
|
|
3
|
+
const hasSolid = ctx.frameworks.includes('solid');
|
|
4
|
+
const compilerOptions = {
|
|
5
|
+
target: 'ES2022',
|
|
6
|
+
module: 'ESNext',
|
|
7
|
+
moduleResolution: 'bundler',
|
|
8
|
+
lib: ['ES2022', 'DOM', 'DOM.Iterable'],
|
|
9
|
+
strict: true,
|
|
10
|
+
exactOptionalPropertyTypes: true,
|
|
11
|
+
noUncheckedIndexedAccess: true,
|
|
12
|
+
experimentalDecorators: true,
|
|
13
|
+
emitDecoratorMetadata: true,
|
|
14
|
+
skipLibCheck: true,
|
|
15
|
+
noEmit: true,
|
|
16
|
+
baseUrl: '.',
|
|
17
|
+
paths: { '@/*': ['./src/*'], 'App/*': ['./app/*'] },
|
|
18
|
+
allowImportingTsExtensions: true,
|
|
19
|
+
};
|
|
20
|
+
if (hasReact) {
|
|
21
|
+
compilerOptions['jsx'] = 'react-jsx';
|
|
22
|
+
}
|
|
23
|
+
else if (hasSolid) {
|
|
24
|
+
compilerOptions['jsx'] = 'preserve';
|
|
25
|
+
compilerOptions['jsxImportSource'] = 'solid-js';
|
|
26
|
+
}
|
|
27
|
+
// Vue only — no jsx field needed
|
|
28
|
+
return JSON.stringify({
|
|
29
|
+
compilerOptions,
|
|
30
|
+
include: ['src/**/*', 'pages/**/*', 'app/**/*', 'bootstrap/**/*', 'routes/**/*', 'config/**/*', '*.ts', '*.tsx'],
|
|
31
|
+
}, null, 2) + '\n';
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=tsconfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../src/templates/tsconfig.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,GAAoB;IAC/C,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IACjD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAEjD,MAAM,eAAe,GAA4B;QAC/C,MAAM,EAAsB,QAAQ;QACpC,MAAM,EAAsB,QAAQ;QACpC,gBAAgB,EAAY,SAAS;QACrC,GAAG,EAAyB,CAAC,QAAQ,EAAE,KAAK,EAAE,cAAc,CAAC;QAC7D,MAAM,EAAsB,IAAI;QAChC,0BAA0B,EAAE,IAAI;QAChC,wBAAwB,EAAI,IAAI;QAChC,sBAAsB,EAAM,IAAI;QAChC,qBAAqB,EAAO,IAAI;QAChC,YAAY,EAAgB,IAAI;QAChC,MAAM,EAAsB,IAAI;QAChC,OAAO,EAAqB,GAAG;QAC/B,KAAK,EAAuB,EAAE,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE;QACxE,0BAA0B,EAAE,IAAI;KACjC,CAAA;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,eAAe,CAAC,KAAK,CAAC,GAAG,WAAW,CAAA;IACtC,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,eAAe,CAAC,KAAK,CAAC,GAAe,UAAU,CAAA;QAC/C,eAAe,CAAC,iBAAiB,CAAC,GAAG,UAAU,CAAA;IACjD,CAAC;IACD,iCAAiC;IAEjC,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,eAAe;QACf,OAAO,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC;KACjH,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TemplateContext } from '../../templates.js';
|
|
2
|
+
export declare function welcomeView(ctx: TemplateContext): string;
|
|
3
|
+
/**
|
|
4
|
+
* Vanilla welcome view for no-frontend recipes (api-service, minimal).
|
|
5
|
+
*
|
|
6
|
+
* Returns a SafeString built with @rudderjs/view's html`` tagged template
|
|
7
|
+
* (zero-client-JS, server-rendered HTML). No React/Vue/Solid imports → no
|
|
8
|
+
* vike-* renderer required. The @rudderjs/vite view scanner detects the
|
|
9
|
+
* .ts extension + no installed vike-renderer and generates the matching
|
|
10
|
+
* `pages/__view/welcome/+Page.ts` stub that returns the Page as a string.
|
|
11
|
+
*
|
|
12
|
+
* `pages/+config.ts` wraps the page's body in an `onRenderHtml` hook —
|
|
13
|
+
* see `templates/pages/index.ts` for the vanilla shell.
|
|
14
|
+
*/
|
|
15
|
+
export declare function welcomeViewVanilla(_ctx: TemplateContext): string;
|
|
16
|
+
export declare function welcomeViewReact(_ctx: TemplateContext): string;
|
|
17
|
+
export declare function welcomeViewVue(_ctx: TemplateContext): string;
|
|
18
|
+
export declare function welcomeViewSolid(_ctx: TemplateContext): string;
|
|
19
|
+
//# sourceMappingURL=welcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"welcome.d.ts","sourceRoot":"","sources":["../../../src/templates/views/welcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,wBAAgB,WAAW,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAOxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAwChE;AAsCD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CA6E9D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAkF5D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CA8E9D"}
|