@20baht/cli 0.0.0-stage → 0.1.1

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 (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +214 -2
  3. package/dist/application/create.js +72 -0
  4. package/dist/application/generate.js +239 -0
  5. package/dist/application/ports.js +1 -0
  6. package/dist/args.js +49 -0
  7. package/dist/cli.js +207 -0
  8. package/dist/domain/blueprint.js +6 -0
  9. package/dist/domain/create-plan.js +59 -0
  10. package/dist/domain/deploy-plan.js +82 -0
  11. package/dist/domain/form-dsl.js +120 -0
  12. package/dist/domain/generate-plan.js +60 -0
  13. package/dist/domain/naming.js +18 -0
  14. package/dist/domain/remote-plan.js +153 -0
  15. package/dist/domain/template-path.js +19 -0
  16. package/dist/infrastructure/fs-reader.js +19 -0
  17. package/dist/infrastructure/fs-writer.js +27 -0
  18. package/dist/infrastructure/shell-runner.js +32 -0
  19. package/dist/infrastructure/spawn-plan.js +35 -0
  20. package/dist/infrastructure/template-renderer.js +16 -0
  21. package/dist/infrastructure/template-source.js +28 -0
  22. package/package.json +53 -4
  23. package/templates/angular/README.md.hbs +46 -0
  24. package/templates/angular/_dependency-cruiser.mjs +51 -0
  25. package/templates/angular/apps/server/package.json +30 -0
  26. package/templates/angular/apps/server/src/app.ts +14 -0
  27. package/templates/angular/apps/server/src/index.ts +8 -0
  28. package/templates/angular/apps/server/test/app.test.ts +12 -0
  29. package/templates/angular/apps/server/tsconfig.json +7 -0
  30. package/templates/angular/apps/server/tsconfig.types.json +12 -0
  31. package/templates/angular/apps/shell/_editorconfig +17 -0
  32. package/templates/angular/apps/shell/angular.json +115 -0
  33. package/templates/angular/apps/shell/federation.config.mjs +44 -0
  34. package/templates/angular/apps/shell/package.json +43 -0
  35. package/templates/angular/apps/shell/public/federation.manifest.json +1 -0
  36. package/templates/angular/apps/shell/src/app/app.config.ts +20 -0
  37. package/templates/angular/apps/shell/src/app/app.css +4 -0
  38. package/templates/angular/apps/shell/src/app/app.html.hbs +16 -0
  39. package/templates/angular/apps/shell/src/app/app.routes.ts.hbs +39 -0
  40. package/templates/angular/apps/shell/src/app/app.ts +57 -0
  41. package/templates/angular/apps/shell/src/app/core/federation/load-remote.ts +31 -0
  42. package/templates/angular/apps/shell/src/app/core/federation/manifest.spec.ts +46 -0
  43. package/templates/angular/apps/shell/src/app/core/federation/manifest.ts +37 -0
  44. package/templates/angular/apps/shell/src/app/core/federation/remote-loader.ts +20 -0
  45. package/templates/angular/apps/shell/src/app/core/federation/timeout.ts +17 -0
  46. package/templates/angular/apps/shell/src/app/modules/home/home.component.ts.hbs +46 -0
  47. package/templates/angular/apps/shell/src/app/modules/unavailable/unavailable.component.ts +39 -0
  48. package/templates/angular/apps/shell/src/bootstrap.ts +25 -0
  49. package/templates/angular/apps/shell/src/environments/environment.development.ts +10 -0
  50. package/templates/angular/apps/shell/src/environments/environment.ts +10 -0
  51. package/templates/angular/apps/shell/src/index.html.hbs +12 -0
  52. package/templates/angular/apps/shell/src/main.ts +43 -0
  53. package/templates/angular/apps/shell/src/styles.css +19 -0
  54. package/templates/angular/apps/shell/tsconfig.app.json +10 -0
  55. package/templates/angular/apps/shell/tsconfig.federation.json +4 -0
  56. package/templates/angular/apps/shell/tsconfig.json.hbs +39 -0
  57. package/templates/angular/apps/shell/tsconfig.spec.json +9 -0
  58. package/templates/angular/bahtui.json +6 -0
  59. package/templates/angular/eslint.config.ts.hbs +28 -0
  60. package/templates/angular/knip.ts +30 -0
  61. package/templates/angular/package.json.hbs +52 -0
  62. package/templates/angular/packages/kit/package.json.hbs +27 -0
  63. package/templates/angular/packages/kit/src/api.ts +21 -0
  64. package/templates/angular/packages/kit/src/errors.ts +28 -0
  65. package/templates/angular/packages/kit/src/index.ts +2 -0
  66. package/templates/angular/packages/kit/test/errors.test.ts +28 -0
  67. package/templates/angular/packages/kit/tsconfig.json +9 -0
  68. package/templates/create/README.md.hbs +32 -0
  69. package/templates/create/_github/workflows/ci.yml +56 -0
  70. package/templates/create/_gitignore +6 -0
  71. package/templates/create/_husky/pre-commit +3 -0
  72. package/templates/create/_prettierignore +3 -0
  73. package/templates/create/_prettierrc.json +4 -0
  74. package/templates/create/apps/api/package.json.hbs +21 -0
  75. package/templates/create/apps/api/src/index.test.ts.hbs +10 -0
  76. package/templates/create/apps/api/src/index.ts.hbs +14 -0
  77. package/templates/create/apps/api/tsconfig.json +7 -0
  78. package/templates/create/apps/web/index.html.hbs +20 -0
  79. package/templates/create/apps/web/package.json.hbs +24 -0
  80. package/templates/create/apps/web/src/App.tsx.hbs +31 -0
  81. package/templates/create/apps/web/src/app.css +27 -0
  82. package/templates/create/apps/web/src/health.test.ts.hbs +28 -0
  83. package/templates/create/apps/web/src/health.ts.hbs +14 -0
  84. package/templates/create/apps/web/src/main.tsx.hbs +20 -0
  85. package/templates/create/apps/web/src/vite-env.d.ts.hbs +1 -0
  86. package/templates/create/apps/web/tsconfig.json +8 -0
  87. package/templates/create/apps/web/vite.config.ts.hbs +6 -0
  88. package/templates/create/bahtui.json.hbs +7 -0
  89. package/templates/create/eslint.config.js +30 -0
  90. package/templates/create/knip.json +9 -0
  91. package/templates/create/libs/shared/eden/index.ts.hbs +9 -0
  92. package/templates/create/libs/shared/eden/package.json.hbs +15 -0
  93. package/templates/create/libs/shared/eden/tsconfig.json +4 -0
  94. package/templates/create/package.json.hbs +47 -0
  95. package/templates/create/tsconfig.base.json +17 -0
  96. package/templates/deploy/deploy/__project__.service.hbs +23 -0
  97. package/templates/deploy/deploy/env.example.hbs +4 -0
  98. package/templates/deploy/deploy/install.sh.hbs +58 -0
  99. package/templates/deploy/deploy/nginx.conf.hbs +67 -0
  100. package/templates/deploy/scripts/deploy.ts.hbs +33 -0
  101. package/templates/deploy/scripts/preview.ts.hbs +57 -0
  102. package/templates/deploy/scripts/release.ts.hbs +48 -0
  103. package/templates/new/CLAUDE.md +3 -0
  104. package/templates/new/README.md.hbs +38 -0
  105. package/templates/new/_dependency-cruiser.mjs +9 -0
  106. package/templates/new/_github/actions/setup/action.yml +15 -0
  107. package/templates/new/_github/workflows/ci.yml +122 -0
  108. package/templates/new/_gitignore +12 -0
  109. package/templates/new/_gitleaks.toml +6 -0
  110. package/templates/new/_husky/commit-msg +1 -0
  111. package/templates/new/_husky/pre-commit +8 -0
  112. package/templates/new/_husky/pre-push +1 -0
  113. package/templates/new/_jscpd.json +20 -0
  114. package/templates/new/_mcp.json +9 -0
  115. package/templates/new/_prettierignore +5 -0
  116. package/templates/new/apps/_gitkeep +0 -0
  117. package/templates/new/commitlint.config.js +1 -0
  118. package/templates/new/eslint.config.ts.hbs +7 -0
  119. package/templates/new/knip.ts +7 -0
  120. package/templates/new/lint-staged.config.js +1 -0
  121. package/templates/new/package.json.hbs +51 -0
  122. package/templates/new/packages/_gitkeep +0 -0
  123. package/templates/new/renovate.json +23 -0
  124. package/templates/new/scripts/dev.ts +54 -0
  125. package/templates/new/scripts/each.ts +29 -0
  126. package/templates/new/scripts/workspaces.ts +24 -0
  127. package/templates/new/tsconfig.base.json +3 -0
  128. package/templates/new/tsconfig.json +7 -0
  129. package/templates/remote/_editorconfig +17 -0
  130. package/templates/remote/angular.json.hbs +95 -0
  131. package/templates/remote/federation.config.mjs.hbs +48 -0
  132. package/templates/remote/package.json.hbs +38 -0
  133. package/templates/remote/src/app/__name__.routes.ts.hbs +12 -0
  134. package/templates/remote/src/app/modules/__name__/__name__.component.ts.hbs +37 -0
  135. package/templates/remote/src/app/services/__name__.service.ts.hbs +14 -0
  136. package/templates/remote/src/index.html.hbs +11 -0
  137. package/templates/remote/src/main.ts.hbs +3 -0
  138. package/templates/remote/tsconfig.app.json +10 -0
  139. package/templates/remote/tsconfig.federation.json +4 -0
  140. package/templates/remote/tsconfig.json.hbs +36 -0
@@ -0,0 +1,122 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ci-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ lint:
18
+ name: lint · prettier
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 10
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: ./.github/actions/setup
24
+ - run: bun run lint
25
+ - run: bun run format:check
26
+
27
+ typecheck:
28
+ name: typecheck
29
+ runs-on: ubuntu-latest
30
+ timeout-minutes: 10
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: ./.github/actions/setup
34
+ - run: bun run typecheck
35
+
36
+ structure:
37
+ name: knip · madge · boundaries
38
+ runs-on: ubuntu-latest
39
+ timeout-minutes: 10
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+ - uses: ./.github/actions/setup
43
+ - run: bun run knip
44
+ - run: bun run madge
45
+ - run: bun run deps
46
+
47
+ dup:
48
+ name: duplication
49
+ runs-on: ubuntu-latest
50
+ timeout-minutes: 10
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+ - uses: ./.github/actions/setup
54
+ - run: bun run dup -- --reporters console,json --output jscpd-report
55
+ - uses: actions/upload-artifact@v4
56
+ if: failure()
57
+ with:
58
+ name: jscpd-report
59
+ path: jscpd-report
60
+ retention-days: 7
61
+
62
+ test:
63
+ name: test
64
+ runs-on: ubuntu-latest
65
+ timeout-minutes: 10
66
+ steps:
67
+ - uses: actions/checkout@v4
68
+ - uses: ./.github/actions/setup
69
+ - run: bun run test
70
+ - uses: actions/upload-artifact@v4
71
+ if: failure()
72
+ with:
73
+ name: coverage
74
+ path: '**/coverage'
75
+ retention-days: 7
76
+
77
+ build:
78
+ name: build
79
+ runs-on: ubuntu-latest
80
+ timeout-minutes: 10
81
+ steps:
82
+ - uses: actions/checkout@v4
83
+ - uses: ./.github/actions/setup
84
+ - run: bun run build
85
+
86
+ gitleaks:
87
+ name: gitleaks
88
+ runs-on: ubuntu-latest
89
+ timeout-minutes: 5
90
+ steps:
91
+ - uses: actions/checkout@v4
92
+ with:
93
+ fetch-depth: 0
94
+ - uses: gitleaks/gitleaks-action@v2
95
+ env:
96
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97
+
98
+ audit:
99
+ name: dependency audit
100
+ runs-on: ubuntu-latest
101
+ timeout-minutes: 5
102
+ steps:
103
+ - uses: actions/checkout@v4
104
+ - uses: ./.github/actions/setup
105
+ # The npm advisory endpoint answers 503 now and then; retry before giving
106
+ # up, and never block a merge on it - a red audit is a warning to look at.
107
+ - run: |
108
+ for i in 1 2 3; do bun run audit && exit 0; echo "audit attempt $i failed"; sleep 15; done
109
+ exit 1
110
+ continue-on-error: true
111
+
112
+ commitlint:
113
+ name: commitlint
114
+ if: github.event_name == 'pull_request'
115
+ runs-on: ubuntu-latest
116
+ timeout-minutes: 5
117
+ steps:
118
+ - uses: actions/checkout@v4
119
+ with:
120
+ fetch-depth: 0
121
+ - uses: ./.github/actions/setup
122
+ - run: bunx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
@@ -0,0 +1,12 @@
1
+ node_modules
2
+ .zvec-grep
3
+ dist
4
+ coverage
5
+ *.tsbuildinfo
6
+ .angular
7
+ .env
8
+ .env.*
9
+ !.env.example
10
+ *.log
11
+ .DS_Store
12
+ bun.lockb
@@ -0,0 +1,6 @@
1
+ # Default gitleaks rule set. Add an [[allowlists]] entry here (with a reason)
2
+ # rather than a `# gitleaks:allow` comment when a finding is a false positive.
3
+ title = "gitleaks config"
4
+
5
+ [extend]
6
+ useDefault = true
@@ -0,0 +1 @@
1
+ bunx commitlint --edit "$1"
@@ -0,0 +1,8 @@
1
+ # Secret scan of what is about to be committed. CI runs the same scan over the
2
+ # whole history, so a machine without gitleaks only loses the early warning.
3
+ if command -v gitleaks >/dev/null 2>&1; then
4
+ gitleaks git --pre-commit --staged --redact --no-banner || exit 1
5
+ else
6
+ echo "gitleaks is not installed - skipping the local secret scan (CI still runs it). brew install gitleaks" >&2
7
+ fi
8
+ bunx lint-staged
@@ -0,0 +1 @@
1
+ bun run check:fast
@@ -0,0 +1,20 @@
1
+ {
2
+ "path": ["apps", "packages", "scripts"],
3
+ "format": ["typescript", "markup", "css"],
4
+ "ignore": [
5
+ "**/node_modules/**",
6
+ "**/dist/**",
7
+ "**/coverage/**",
8
+ "**/test-results/**",
9
+ "**/playwright-report/**",
10
+ "**/*.spec.ts",
11
+ "**/*.test.ts",
12
+ "**/*.d.ts",
13
+ "**/*.gen.ts"
14
+ ],
15
+ "minTokens": 50,
16
+ "minLines": 5,
17
+ "gitignore": true,
18
+ "reporters": ["console"],
19
+ "threshold": 5
20
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "zvec_grep": {
4
+ "type": "stdio",
5
+ "command": "zg",
6
+ "args": ["server", "--stdio"]
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ dist
3
+ bun.lock
4
+ coverage
5
+ .angular
File without changes
@@ -0,0 +1 @@
1
+ export { default } from '@20baht/strict/commitlint'
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'eslint/config'
2
+
3
+ import { base } from '@20baht/strict/eslint'
4
+
5
+ // Every rule in `base` is an error. Add app overrides below, each with a reason:
6
+ // // eslint-disable-next-line <rule> -- <why>
7
+ export default defineConfig([...base])
@@ -0,0 +1,7 @@
1
+ import { knip } from '@20baht/strict/knip'
2
+
3
+ export default knip({
4
+ workspaces: {
5
+ '.': { entry: ['scripts/*.ts'], project: ['scripts/**/*.ts'] },
6
+ },
7
+ })
@@ -0,0 +1 @@
1
+ export { default } from '@20baht/strict/lint-staged'
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "private": true,
4
+ "type": "module",
5
+ "workspaces": [
6
+ "apps/*",
7
+ "packages/*"
8
+ ],
9
+ "scripts": {
10
+ "dev": "bun run scripts/dev.ts",
11
+ "build": "bun run scripts/each.ts build",
12
+ "typecheck": "tsc -p tsconfig.json && bun run scripts/each.ts typecheck",
13
+ "lint": "eslint .",
14
+ "lint:fix": "eslint . --fix",
15
+ "format": "prettier --write .",
16
+ "format:check": "prettier --check .",
17
+ "knip": "knip",
18
+ "madge": "madge --circular --extensions ts,tsx --exclude '(^|/)(dist|node_modules|\\.angular)/' apps packages scripts",
19
+ "deps": "depcruise apps packages scripts --config .dependency-cruiser.mjs",
20
+ "dup": "jscpd",
21
+ "audit": "bun audit --audit-level=high",
22
+ "secrets": "gitleaks git --redact --no-banner",
23
+ "test": "bun run scripts/each.ts test:coverage",
24
+ "check:fast": "bun run lint && bun run format:check && bun run typecheck && bun run madge && bun run deps",
25
+ "check": "bun run check:fast && bun run knip && bun run dup && bun run build && bun run test",
26
+ "prepare": "husky"
27
+ },
28
+ "prettier": "@20baht/strict/prettier",
29
+ "packageManager": "bun@1.3.14",
30
+ "devDependencies": {
31
+ "@commitlint/cli": "^21.2.2",
32
+ "@commitlint/config-conventional": "^21.2.2",
33
+ "@eslint/css": "^2.0.0",
34
+ "@eslint/js": "^10.0.1",
35
+ "@types/bun": "^1.3.0",
36
+ "@20baht/strict": "0.1.1",
37
+ "dependency-cruiser": "^18.3.1",
38
+ "eslint": "^10.10.0",
39
+ "eslint-config-prettier": "^10.1.8",
40
+ "eslint-plugin-sonarjs": "^4.2.1",
41
+ "husky": "^9.1.7",
42
+ "jiti": "^2.6.1",
43
+ "jscpd": "^5.3.0",
44
+ "knip": "^6.35.1",
45
+ "lint-staged": "^17.5.1",
46
+ "madge": "^8.0.0",
47
+ "prettier": "^3.9.6",
48
+ "typescript": "^5.9.3",
49
+ "typescript-eslint": "^8.70.0"
50
+ }
51
+ }
File without changes
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": ["config:recommended", ":semanticCommitTypeAll(chore)"],
4
+ "schedule": ["before 6am on monday"],
5
+ "prConcurrentLimit": 4,
6
+ "packageRules": [
7
+ {
8
+ "description": "Everything not matched below: one weekly PR.",
9
+ "matchPackageNames": ["*"],
10
+ "groupName": "others"
11
+ },
12
+ {
13
+ "description": "Dev tooling: linters, formatters, test runners, type packages.",
14
+ "matchDepTypes": ["devDependencies"],
15
+ "groupName": "dev-deps"
16
+ },
17
+ {
18
+ "description": "GitHub Actions move together.",
19
+ "matchManagers": ["github-actions"],
20
+ "groupName": "github-actions"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Run every `apps/*` workspace `dev` script in parallel with prefixed,
3
+ * live-streamed output. Replaces `bun run --filter '*' dev`, which serializes
4
+ * long-running scripts and never starts the second one.
5
+ */
6
+ import { workspacesWithScript } from './workspaces.ts'
7
+
8
+ const colors = ['\x1b[36m', '\x1b[35m', '\x1b[33m', '\x1b[32m', '\x1b[34m']
9
+ const reset = '\x1b[0m'
10
+
11
+ const targets = workspacesWithScript('dev', ['apps']).map((ws, i) => ({
12
+ ...ws,
13
+ color: colors[i % colors.length],
14
+ }))
15
+
16
+ if (targets.length === 0) {
17
+ console.log('No apps/*/package.json with a "dev" script yet — nothing to run.')
18
+ process.exit(0)
19
+ }
20
+
21
+ const procs = targets.map(({ name, cwd, color }) => {
22
+ const proc = Bun.spawn(['bun', 'run', 'dev'], {
23
+ cwd,
24
+ env: process.env,
25
+ stdout: 'pipe',
26
+ stderr: 'pipe',
27
+ })
28
+
29
+ const prefix = (line: string) => `${color}[${name}]${reset} ${line}`
30
+ const pump = async (stream: ReadableStream<Uint8Array>) => {
31
+ const decoder = new TextDecoder()
32
+ let buf = ''
33
+ for await (const chunk of stream) {
34
+ buf += decoder.decode(chunk, { stream: true })
35
+ const lines = buf.split('\n')
36
+ buf = lines.pop() ?? ''
37
+ for (const line of lines) console.log(prefix(line))
38
+ }
39
+ if (buf) console.log(prefix(buf))
40
+ }
41
+
42
+ void pump(proc.stdout)
43
+ void pump(proc.stderr)
44
+ return proc
45
+ })
46
+
47
+ const shutdown = () => {
48
+ for (const p of procs) p.kill()
49
+ process.exit(0)
50
+ }
51
+ process.on('SIGINT', shutdown)
52
+ process.on('SIGTERM', shutdown)
53
+
54
+ await Promise.all(procs.map((p) => p.exited))
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `bun run scripts/each.ts <script>` — run `<script>` in every apps/* and
3
+ * packages/* workspace that defines it, one after another, failing on the
4
+ * first non-zero exit. Unlike `bun run --filter '*' <script>` it exits 0 when
5
+ * no workspace defines the script yet, so a fresh repo passes `bun run check`.
6
+ */
7
+ import { workspacesWithScript } from './workspaces.ts'
8
+
9
+ const script = process.argv[2]
10
+ if (!script) {
11
+ console.error('usage: bun run scripts/each.ts <script>')
12
+ process.exit(1)
13
+ }
14
+
15
+ const targets = workspacesWithScript(script)
16
+ if (targets.length === 0) {
17
+ console.log(`No workspace defines "${script}" yet — nothing to run.`)
18
+ process.exit(0)
19
+ }
20
+
21
+ for (const { name, cwd } of targets) {
22
+ console.log(`\x1b[36m[${name}]\x1b[0m bun run ${script}`)
23
+ const proc = Bun.spawnSync(['bun', 'run', script], {
24
+ cwd,
25
+ env: process.env,
26
+ stdio: ['inherit', 'inherit', 'inherit'],
27
+ })
28
+ if (proc.exitCode !== 0) process.exit(proc.exitCode)
29
+ }
@@ -0,0 +1,24 @@
1
+ import { existsSync, readdirSync, readFileSync } from 'node:fs'
2
+ import { join } from 'node:path'
3
+
4
+ export type Workspace = {
5
+ name: string
6
+ cwd: string
7
+ }
8
+
9
+ /** Every `apps/*` and `packages/*` directory whose package.json defines `script`. */
10
+ export function workspacesWithScript(script: string, groups = ['apps', 'packages']): Workspace[] {
11
+ const found: Workspace[] = []
12
+ for (const group of groups) {
13
+ if (!existsSync(group)) continue
14
+ for (const entry of readdirSync(group, { withFileTypes: true })) {
15
+ if (!entry.isDirectory()) continue
16
+ const cwd = join(group, entry.name)
17
+ const pkgPath = join(cwd, 'package.json')
18
+ if (!existsSync(pkgPath)) continue
19
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as { scripts?: Record<string, string> }
20
+ if (typeof pkg.scripts?.[script] === 'string') found.push({ name: entry.name, cwd })
21
+ }
22
+ }
23
+ return found
24
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@20baht/strict/tsconfig/base.json"
3
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": ["bun"]
5
+ },
6
+ "include": ["scripts", "eslint.config.ts", "knip.ts"]
7
+ }
@@ -0,0 +1,17 @@
1
+ # Editor configuration, see https://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ indent_size = 2
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.ts]
12
+ quote_type = single
13
+ ij_typescript_use_double_quotes = false
14
+
15
+ [*.md]
16
+ max_line_length = off
17
+ trim_trailing_whitespace = false
@@ -0,0 +1,95 @@
1
+ {
2
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+ "version": 1,
4
+ "cli": {
5
+ "packageManager": "bun"
6
+ },
7
+ "newProjectRoot": "projects",
8
+ "projects": {
9
+ "{{app}}": {
10
+ "projectType": "application",
11
+ "schematics": {},
12
+ "root": "",
13
+ "sourceRoot": "src",
14
+ "prefix": "{{name}}",
15
+ "architect": {
16
+ "build": {
17
+ "builder": "@angular-architects/native-federation:build",
18
+ "options": {
19
+ "cacheExternalArtifacts": true,
20
+ "tsConfig": "tsconfig.federation.json"
21
+ },
22
+ "configurations": {
23
+ "production": {
24
+ "target": "{{app}}:esbuild:production"
25
+ },
26
+ "development": {
27
+ "target": "{{app}}:esbuild:development",
28
+ "dev": true
29
+ }
30
+ },
31
+ "defaultConfiguration": "production"
32
+ },
33
+ "serve": {
34
+ "builder": "@angular-architects/native-federation:build",
35
+ "options": {
36
+ "target": "{{app}}:serve-original:development",
37
+ "tsConfig": "tsconfig.federation.json",
38
+ "rebuildDelay": 500,
39
+ "cacheExternalArtifacts": true,
40
+ "dev": true,
41
+ "devServer": true,
42
+ "port": 0
43
+ }
44
+ },
45
+ "esbuild": {
46
+ "builder": "@angular/build:application",
47
+ "options": {
48
+ "browser": "src/main.ts",
49
+ "tsConfig": "tsconfig.app.json",
50
+ "styles": [],
51
+ "polyfills": ["es-module-shims"]
52
+ },
53
+ "configurations": {
54
+ "production": {
55
+ "budgets": [
56
+ {
57
+ "type": "initial",
58
+ "maximumWarning": "500kB",
59
+ "maximumError": "1MB"
60
+ },
61
+ {
62
+ "type": "anyComponentStyle",
63
+ "maximumWarning": "4kB",
64
+ "maximumError": "8kB"
65
+ }
66
+ ],
67
+ "outputHashing": "all"
68
+ },
69
+ "development": {
70
+ "optimization": false,
71
+ "extractLicenses": false,
72
+ "sourceMap": true
73
+ }
74
+ },
75
+ "defaultConfiguration": "production"
76
+ },
77
+ "serve-original": {
78
+ "builder": "@angular/build:dev-server",
79
+ "configurations": {
80
+ "production": {
81
+ "buildTarget": "{{app}}:esbuild:production"
82
+ },
83
+ "development": {
84
+ "buildTarget": "{{app}}:esbuild:development"
85
+ }
86
+ },
87
+ "defaultConfiguration": "development",
88
+ "options": {
89
+ "port": {{port}}
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,48 @@
1
+ import { withNativeFederation, fromPackageJson } from '@angular-architects/native-federation/config'
2
+
3
+ export default withNativeFederation({
4
+ name: '{{app}}',
5
+
6
+ shared: fromPackageJson({
7
+ singleton: true,
8
+ strictVersion: true,
9
+ requiredVersion: 'auto',
10
+ build: 'package',
11
+ })
12
+ // includeSecondaries is an opt-out of ignoreUnusedDeps, so all of
13
+ // @angular/core is shared to prevent mismatches.
14
+ .patch(['@angular/core'], { includeSecondaries: { keepAll: true } })
15
+ // Same for @20baht/ui: the host and the remotes may import different entry
16
+ // points of it. Unshared, each side bundles its own copy of the elements and
17
+ // the second customElements.define('baht-button') throws.
18
+ .patch(['@20baht/ui'], { includeSecondaries: { keepAll: true } }),
19
+
20
+ skip: [
21
+ 'rxjs/ajax',
22
+ 'rxjs/fetch',
23
+ 'rxjs/testing',
24
+ 'rxjs/webSocket',
25
+ // Server / React entry points of @20baht/ui (pulled in by keepAll above).
26
+ '@20baht/ui/ssr',
27
+ '@20baht/ui/hydrate',
28
+ '@20baht/ui/react',
29
+ // marked's command-line entry imports Node built-ins.
30
+ /^marked\/bin/,
31
+ ],
32
+
33
+ // The kit (a tsconfig path into packages/kit) is compiled into each app, not shared.
34
+ sharedMappings: [],
35
+
36
+ exposes: {
37
+ './Routes': './src/app/{{name}}.routes.ts',
38
+ },
39
+
40
+ features: {
41
+ // Off: the unused-dependency scan (sheriff) refuses sources outside the app folder, and
42
+ // the kit lives in packages/kit. Every package.json dependency is shared instead, so each
43
+ // app lists @20baht/ui's optional peers (marked, dompurify, flatpickr) itself.
44
+ ignoreUnusedDeps: false,
45
+ // Groups chunks in remoteEntry.json for a smaller metadata file.
46
+ denseChunking: true,
47
+ },
48
+ })
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "{{app}}",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "ng": "ng",
7
+ "dev": "ng serve",
8
+ "build": "ng build",
9
+ "typecheck": "tsc -b --noEmit",
10
+ "pretypecheck": "bun run --filter server build:types",
11
+ "prebuild": "bun run --filter server build:types"
12
+ },
13
+ "dependencies": {
14
+ "@angular-architects/native-federation": "^22.2.1",
15
+ "@angular/common": "^22.2.0",
16
+ "@angular/compiler": "^22.2.0",
17
+ "@angular/core": "^22.2.0",
18
+ "@angular/platform-browser": "^22.2.0",
19
+ "@angular/router": "^22.2.0",
20
+ "@20baht/engine": "0.1.1",
21
+ "@20baht/ui": "0.1.1",
22
+ "@20baht/angular": "0.1.1",
23
+ "dompurify": "3.4.17",
24
+ "es-module-shims": "^2.8.0",
25
+ "flatpickr": "4.6.13",
26
+ "marked": "18.1.3",
27
+ "@20baht/ngx-eden": "^0.1.0",
28
+ "rxjs": "~7.8.0",
29
+ "tslib": "^2.3.0"
30
+ },
31
+ "devDependencies": {
32
+ "@angular/build": "^22.2.0",
33
+ "@angular/cli": "^22.2.0",
34
+ "@angular/compiler-cli": "^22.2.0",
35
+ "@softarc/native-federation-orchestrator": "^4.6.0",
36
+ "typescript": "~6.0.2"
37
+ }
38
+ }
@@ -0,0 +1,12 @@
1
+ import type { Routes } from '@angular/router'
2
+
3
+ import { {{pascal}}Component } from './modules/{{name}}/{{name}}.component'
4
+
5
+ /** What the host mounts under `/{{name}}` (exposed as `./Routes`). */
6
+ export const routes: Routes = [
7
+ {
8
+ path: '',
9
+ title: '{{title}}',
10
+ component: {{pascal}}Component,
11
+ },
12
+ ]