bank20baht-cli 0.3.1 → 0.4.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 CHANGED
@@ -38,15 +38,15 @@ bun run check # lint + format:check + knip + typecheck — green on the emp
38
38
  What you get:
39
39
 
40
40
  ```
41
- package.json workspaces apps/* + packages/*, lint-staged, check script
42
- tsconfig.base.json strict, moduleResolution bundler, verbatimModuleSyntax
41
+ package.json workspaces apps/* + packages/*, check script, prettier config ref
42
+ tsconfig.base.json extends bank20baht-strict/tsconfig/base.json (strict + noUncheckedIndexedAccess + exactOptionalPropertyTypes ...)
43
43
  tsconfig.json typechecks scripts/ (extend the base from each workspace)
44
- eslint.config.ts ESLint 10 + typescript-eslint + eslint-config-prettier
45
- .prettierrc no semicolons, single quotes, printWidth 100
46
- knip.json dead-code / unused-dependency checks
44
+ eslint.config.ts one line: bank20baht-strict/eslint `base` (ESLint 10, typescript-eslint strict, sonarjs, prettier)
45
+ lint-staged.config.js · commitlint.config.js re-exports from bank20baht-strict
46
+ knip.ts dead-code / unused-dependency checks (bank20baht-strict/knip)
47
47
  commitlint.config.js Conventional Commits
48
48
  .husky/ pre-commit → gitleaks + lint-staged · commit-msg → commitlint · pre-push → bun run check:fast
49
- .gitleaks.toml · .jscpd.json · .dependency-cruiser.cjs · renovate.json · .github/ (CI: lint, typecheck, knip/madge/deps, dup, test, build, gitleaks, audit, commitlint)
49
+ .gitleaks.toml · .jscpd.json · .dependency-cruiser.mjs · renovate.json · .github/ (CI: lint, typecheck, knip/madge/deps, dup, test, build, gitleaks, audit, commitlint)
50
50
  scripts/dev.ts runs every apps/*/ "dev" script in parallel with prefixed output
51
51
  scripts/each.ts `bun run scripts/each.ts <script>` in every workspace that defines it
52
52
  .mcp.json, CLAUDE.md zvec_grep code-search MCP wiring for Claude Code
@@ -65,7 +65,7 @@ husky hooks prove themselves before you touch anything. Flags:
65
65
 
66
66
  Add a workspace by creating `apps/<name>/package.json` with `dev` / `build` / `typecheck`
67
67
  scripts; `bun run dev`, `bun run build` and `bun run typecheck` pick it up automatically.
68
- Add a matching entry to `knip.json` so dead-code checks cover it.
68
+ Add a matching entry to `knip.ts` so dead-code checks cover it.
69
69
 
70
70
  ### `bahtui create <name>`
71
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bank20baht-cli",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Scaffold bun workspaces (bahtui new) and DDD monorepos (React + Elysia + Eden, bahtui create) plus bahtui generators.",
6
6
  "license": "MIT",
@@ -22,15 +22,17 @@ scripts/each.ts `bun run scripts/each.ts <script>` in every workspace that
22
22
  ```
23
23
 
24
24
  Add a workspace by creating `apps/<name>/package.json` (or `packages/<name>`)
25
- with `dev`, `build` and `typecheck` scripts, then extend `knip.json` with a
25
+ with `dev`, `build` and `typecheck` scripts, then extend `knip.ts` with a
26
26
  matching workspace entry so dead-code checks cover it.
27
27
 
28
28
  ## Toolchain
29
29
 
30
30
  - **ESLint 10 + typescript-eslint** (`eslint.config.ts`), **Prettier** (no semi,
31
- single quotes, width 100), **knip** — all run by `bun run check`.
31
+ single quotes, width 100), **knip** — all run by `bun run check`. Their config comes from
32
+ `bank20baht-strict`: bump it to take rule updates (Renovate does this); put app overrides
33
+ last, each with a reason.
32
34
  - **husky** hooks: `pre-commit` → lint-staged, `commit-msg` → commitlint
33
35
  (Conventional Commits), `pre-push` → `bun run check`.
34
- - `tsconfig.base.json` — strict, `moduleResolution: bundler`,
35
- `verbatimModuleSyntax`, `noUncheckedIndexedAccess`. Extend it from each
36
- workspace's `tsconfig.json`.
36
+ - `tsconfig.base.json` — extends `bank20baht-strict/tsconfig/base.json` (strict,
37
+ `verbatimModuleSyntax`, `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`, ...).
38
+ Extend it from each workspace's `tsconfig.json`.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Architecture boundaries, checked with `bun run deps`. `generic` gives no-circular and
3
+ * production-not-tests for apps/* and packages/*; add layer rules (features may not import
4
+ * each other, shared/ knows no feature, ...) as your structure grows. Every rule is `error`:
5
+ * a violation is a decision, not a warning.
6
+ */
7
+ import { makeConfig } from 'bank20baht-strict/depcruise'
8
+
9
+ export default makeConfig({ generic: true })
@@ -1,3 +1 @@
1
- export default {
2
- extends: ['@commitlint/config-conventional'],
3
- }
1
+ export { default } from 'bank20baht-strict/commitlint'
@@ -1,64 +1,7 @@
1
- import js from '@eslint/js'
2
- import prettier from 'eslint-config-prettier'
3
- import sonarjs from 'eslint-plugin-sonarjs'
4
1
  import { defineConfig } from 'eslint/config'
5
- import tseslint from 'typescript-eslint'
6
2
 
7
- export default defineConfig([
8
- {
9
- ignores: [
10
- '**/dist/**',
11
- '**/node_modules/**',
12
- '**/*.gen.ts',
13
- '**/.angular/**',
14
- '**/coverage/**',
15
- '**/playwright-report/**',
16
- '**/test-results/**',
17
- ],
18
- },
19
- // Plain JS config files: no type information available.
20
- {
21
- files: ['**/*.{js,mjs,cjs}'],
22
- extends: [js.configs.recommended],
23
- },
24
- // TypeScript, type-aware. Every .ts file must be covered by a tsconfig.
25
- {
26
- files: ['**/*.{ts,tsx}'],
27
- extends: [
28
- js.configs.recommended,
29
- ...tseslint.configs.strictTypeChecked,
30
- ...tseslint.configs.stylisticTypeChecked,
31
- ],
32
- languageOptions: {
33
- parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
34
- },
35
- rules: {
36
- '@typescript-eslint/no-unused-vars': [
37
- 'error',
38
- { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
39
- ],
40
- '@typescript-eslint/consistent-type-imports': 'error',
41
- '@typescript-eslint/switch-exhaustiveness-check': 'error',
42
- '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
43
- '@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
44
- },
45
- },
46
- // Duplication and complexity (jscpd covers whole-block clones, see .jscpd.json).
47
- {
48
- files: ['**/*.{ts,tsx}'],
49
- plugins: { sonarjs },
50
- rules: {
51
- 'sonarjs/no-identical-functions': 'error',
52
- 'sonarjs/no-identical-expressions': 'error',
53
- 'sonarjs/cognitive-complexity': ['error', 15],
54
- },
55
- },
56
- // Repeated literals are ordinary in tests, so the rule only guards production code.
57
- {
58
- files: ['**/*.{ts,tsx}'],
59
- ignores: ['**/*.test.ts', '**/*.spec.ts'],
60
- plugins: { sonarjs },
61
- rules: { 'sonarjs/no-duplicate-string': ['error', { threshold: 4 }] },
62
- },
63
- prettier,
64
- ])
3
+ import { base } from 'bank20baht-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 'bank20baht-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 'bank20baht-strict/lint-staged'
@@ -16,7 +16,7 @@
16
16
  "format:check": "prettier --check .",
17
17
  "knip": "knip",
18
18
  "madge": "madge --circular --extensions ts,tsx apps packages scripts",
19
- "deps": "depcruise apps packages scripts --config .dependency-cruiser.cjs",
19
+ "deps": "depcruise apps packages scripts --config .dependency-cruiser.mjs",
20
20
  "dup": "jscpd",
21
21
  "audit": "bun audit --audit-level=high",
22
22
  "secrets": "gitleaks git --redact --no-banner",
@@ -25,21 +25,15 @@
25
25
  "check": "bun run check:fast && bun run knip && bun run dup && bun run build && bun run test",
26
26
  "prepare": "husky"
27
27
  },
28
- "lint-staged": {
29
- "*.{ts,tsx}": [
30
- "eslint --fix",
31
- "prettier --write"
32
- ],
33
- "*.{json,md,html,css}": [
34
- "prettier --write"
35
- ]
36
- },
28
+ "prettier": "bank20baht-strict/prettier",
37
29
  "packageManager": "bun@1.3.14",
38
30
  "devDependencies": {
39
31
  "@commitlint/cli": "^21.2.2",
40
32
  "@commitlint/config-conventional": "^21.2.2",
33
+ "@eslint/css": "^2.0.0",
41
34
  "@eslint/js": "^10.0.1",
42
35
  "@types/bun": "^1.3.0",
36
+ "bank20baht-strict": "0.0.3",
43
37
  "dependency-cruiser": "^18.3.1",
44
38
  "eslint": "^10.10.0",
45
39
  "eslint-config-prettier": "^10.1.8",
@@ -1,16 +1,3 @@
1
1
  {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "moduleDetection": "force",
7
- "allowImportingTsExtensions": true,
8
- "verbatimModuleSyntax": true,
9
- "esModuleInterop": true,
10
- "resolveJsonModule": true,
11
- "strict": true,
12
- "skipLibCheck": true,
13
- "noUncheckedIndexedAccess": true,
14
- "noEmit": true
15
- }
2
+ "extends": "bank20baht-strict/tsconfig/base.json"
16
3
  }
@@ -3,5 +3,5 @@
3
3
  "compilerOptions": {
4
4
  "types": ["bun"]
5
5
  },
6
- "include": ["scripts", "eslint.config.ts"]
6
+ "include": ["scripts", "eslint.config.ts", "knip.ts"]
7
7
  }
@@ -1,29 +0,0 @@
1
- /**
2
- * Architecture boundaries, checked with `bun run deps`. Add a rule per layer
3
- * rule you want enforced (features may not import each other, shared/ knows no
4
- * feature, ...). Every rule is `error`: a violation is a decision, not a warning.
5
- */
6
- const TESTS = '\\.(test|spec)\\.tsx?$'
7
-
8
- /** @type {import('dependency-cruiser').IConfiguration} */
9
- module.exports = {
10
- forbidden: [
11
- {
12
- name: 'no-circular',
13
- severity: 'error',
14
- from: {},
15
- to: { circular: true },
16
- },
17
- {
18
- name: 'production-not-tests',
19
- severity: 'error',
20
- from: { path: '^(apps|packages)/[^/]+/src/', pathNot: TESTS },
21
- to: { path: TESTS },
22
- },
23
- ],
24
- options: {
25
- doNotFollow: { path: 'node_modules' },
26
- tsPreCompilationDeps: true,
27
- exclude: { path: ['/dist/', '\\.gen\\.ts$'] },
28
- },
29
- }
@@ -1,6 +0,0 @@
1
- {
2
- "semi": false,
3
- "singleQuote": true,
4
- "trailingComma": "all",
5
- "printWidth": 100
6
- }
@@ -1,10 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/knip@latest/schema.json",
3
- "workspaces": {
4
- ".": {
5
- "entry": ["scripts/*.ts"],
6
- "project": ["scripts/**/*.ts"]
7
- }
8
- },
9
- "ignoreBinaries": ["gitleaks"]
10
- }