@aamini/config 0.0.19 → 0.2.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 +111 -20
- package/dist/anti-slop/index.d.mts +6 -0
- package/dist/anti-slop/index.mjs +2414 -0
- package/dist/anti-slop/index.mjs.map +1 -0
- package/dist/merge-BEomHgbw.d.mts +21 -0
- package/dist/merge-DThKwm_6.mjs +193 -0
- package/dist/merge-DThKwm_6.mjs.map +1 -0
- package/dist/playwright.d.mts +8 -3
- package/dist/playwright.mjs +20 -11
- package/dist/playwright.mjs.map +1 -1
- package/dist/root-U5B4x0aj.mjs +15 -0
- package/dist/root-U5B4x0aj.mjs.map +1 -0
- package/dist/tanstack/index.d.mts +45 -0
- package/dist/tanstack/index.mjs +189 -0
- package/dist/tanstack/index.mjs.map +1 -0
- package/dist/vite-plus/index.d.mts +101 -0
- package/dist/vite-plus/index.mjs +2 -0
- package/dist/vitest/browser.d.mts +22 -0
- package/dist/vitest/browser.mjs +84 -0
- package/dist/vitest/browser.mjs.map +1 -0
- package/dist/vitest/db.d.mts +28 -0
- package/dist/vitest/db.mjs +42 -0
- package/dist/vitest/db.mjs.map +1 -0
- package/dist/vitest/index.d.mts +29 -0
- package/dist/vitest/index.mjs +2 -0
- package/dist/vitest/react.d.mts +34 -0
- package/dist/vitest/react.mjs +43 -0
- package/dist/vitest/react.mjs.map +1 -0
- package/dist/vitest/server.d.mts +13 -0
- package/dist/vitest/server.mjs +28 -0
- package/dist/vitest/server.mjs.map +1 -0
- package/dist/vitest-CXdvqyRH.mjs +169 -0
- package/dist/vitest-CXdvqyRH.mjs.map +1 -0
- package/package.json +169 -95
- package/tsconfig/astro.json +9 -0
- package/tsconfig/{tsconfig.strict.json → base.json} +8 -0
- package/tsconfig/react.json +9 -0
- package/dist/setup/styles.d.mts +0 -1
- package/dist/setup/styles.mjs +0 -2
- package/dist/test/browser.d.mts +0 -17
- package/dist/test/browser.mjs +0 -35
- package/dist/test/browser.mjs.map +0 -1
- package/dist/test/db.d.mts +0 -41
- package/dist/test/db.mjs +0 -93
- package/dist/test/db.mjs.map +0 -1
- package/dist/test/server.d.mts +0 -16
- package/dist/test/server.mjs +0 -30
- package/dist/test/server.mjs.map +0 -1
- package/dist/test/visual-page.d.mts +0 -30
- package/dist/test/visual-page.mjs +0 -40
- package/dist/test/visual-page.mjs.map +0 -1
- package/dist/vite.d.mts +0 -73
- package/dist/vite.mjs +0 -208
- package/dist/vite.mjs.map +0 -1
- package/tsconfig/tsconfig.lib.json +0 -19
- package/tsconfig/tsconfig.tanstack.json +0 -17
package/README.md
CHANGED
|
@@ -1,32 +1,123 @@
|
|
|
1
1
|
# @aamini/config
|
|
2
2
|
|
|
3
|
-
Shared
|
|
3
|
+
Shared Vite+ config for aria-amini apps: framework plugins, format, lint, and
|
|
4
|
+
TypeScript.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
```bash
|
|
7
|
+
pnpm add -D @aamini/config vite-plus oxlint-plugin-eslint
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Entry points
|
|
11
|
+
|
|
12
|
+
| Subpath | Exports |
|
|
13
|
+
| ---------------------- | ------------------------------------------------------ |
|
|
14
|
+
| `/tanstack` | `defineToolkit()`: the complete TanStack Start config |
|
|
15
|
+
| `/vite-plus` | `fmt`, `lint(framework)`, `mergeToolkitConfig()` |
|
|
16
|
+
| `/vitest` | `unitProject()`, `serverProject()`, `browserProject()` |
|
|
17
|
+
| `/vitest/browser` | `expectScreenshot()`, `waitForPageIdle()` |
|
|
18
|
+
| `/vitest/react` | `renderPage()` |
|
|
19
|
+
| `/vitest/server` | `createServerTest()`: MSW server fixture |
|
|
20
|
+
| `/vitest/db` | `createDbTest()`: Postgres testcontainer and Drizzle |
|
|
21
|
+
| `/playwright` | `playwrightConfig()` |
|
|
22
|
+
| `/anti-slop` | Oxlint JS plugin. `lint()` registers it. |
|
|
23
|
+
| `/tsconfig/base.json` | Strict compiler options |
|
|
24
|
+
| `/tsconfig/react.json` | Base plus React JSX, DOM, and Vite client types |
|
|
25
|
+
| `/tsconfig/astro.json` | Base plus Astro client types |
|
|
26
|
+
|
|
27
|
+
## TanStack Start
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { defineToolkit } from '@aamini/config/tanstack'
|
|
31
|
+
|
|
32
|
+
export default defineToolkit({
|
|
33
|
+
root: import.meta.dirname,
|
|
34
|
+
plugins: { devtools: false, nitro: { preset: 'node-server' } },
|
|
35
|
+
config: { server: { port: 4000 } },
|
|
36
|
+
})
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The toolkit owns the framework plugins and their order: `tanstackStart`,
|
|
40
|
+
`devtools`, `nitro`, `tailwindcss`, `react`, `reactCompiler`, and `varlock`.
|
|
41
|
+
`devtools` and `nitro` do not run under Vitest. Set a key to `false` to remove
|
|
42
|
+
that plugin. Set an object to merge options over the toolkit options. App
|
|
43
|
+
plugins go in `config.plugins` and run after the toolkit plugins.
|
|
44
|
+
|
|
45
|
+
The app installs each plugin package that it uses. If an enabled plugin's
|
|
46
|
+
package is missing, `defineToolkit()` throws an error with the `pnpm add -D`
|
|
47
|
+
command. Set `shadcn: false` to remove the `@shadcn/lint` rules.
|
|
48
|
+
|
|
49
|
+
### Tests
|
|
50
|
+
|
|
51
|
+
`defineToolkit()` adds three Vitest projects: `unit`, `server`, and `browser`.
|
|
52
|
+
Set `tests.<project>` to `false` to remove a project. Set an object to merge
|
|
53
|
+
`test` options over the toolkit options. Arrays replace the toolkit values.
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
export default defineToolkit({
|
|
57
|
+
root: import.meta.dirname,
|
|
58
|
+
tests: {
|
|
59
|
+
server: { include: ['src/**/*.test.ts'] },
|
|
60
|
+
browser: { setupFiles: ['./src/app.css'] },
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
```
|
|
6
64
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
with auto-detected MSW handlers
|
|
12
|
-
- **`test/db`** — PostgreSQL testcontainer + drizzle + MSW integration fixture
|
|
13
|
-
- **Playwright config** — shared Playwright configuration
|
|
14
|
-
- **`msw.ts`** — re-exports to ensure singleton MSW instances
|
|
65
|
+
The `browser` project runs Chromium in two instances: `desktop` (1280×720) and
|
|
66
|
+
`mobile` (375×812). Visual tests compare at zero tolerance. A capture stops at
|
|
67
|
+
the viewport, and `fullHeight` grows the viewport to the full target. Mobile
|
|
68
|
+
baselines get a `-mobile` suffix.
|
|
15
69
|
|
|
16
|
-
|
|
70
|
+
```tsx
|
|
71
|
+
import { renderPage } from '@aamini/config/vitest/react'
|
|
72
|
+
|
|
73
|
+
test('home', async () => {
|
|
74
|
+
const page = await renderPage(HomePage, { path: '/', wrapper: AppProviders })
|
|
75
|
+
|
|
76
|
+
await page.expectScreenshot('home')
|
|
77
|
+
await page.expectScreenshot('home-full', { fullHeight: true })
|
|
78
|
+
})
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Playwright runs smoke tests only, against any `BASE_URL`:
|
|
17
82
|
|
|
18
83
|
```ts
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export default
|
|
84
|
+
import { playwrightConfig } from '@aamini/config/playwright'
|
|
85
|
+
|
|
86
|
+
export default playwrightConfig({ testDir: './e2e' })
|
|
22
87
|
```
|
|
23
88
|
|
|
89
|
+
## Building blocks
|
|
90
|
+
|
|
24
91
|
```ts
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
|
|
92
|
+
import { fmt, lint, mergeToolkitConfig } from '@aamini/config/vite-plus'
|
|
93
|
+
import { defineConfig } from 'vite-plus'
|
|
94
|
+
|
|
95
|
+
export default defineConfig(
|
|
96
|
+
mergeToolkitConfig(
|
|
97
|
+
{ fmt, lint: lint('react') },
|
|
98
|
+
{
|
|
99
|
+
fmt: {
|
|
100
|
+
ignorePatterns: (preset) => [...preset, 'src/generated/**'],
|
|
101
|
+
},
|
|
102
|
+
lint: { rules: { 'no-console': 'off' } },
|
|
103
|
+
},
|
|
104
|
+
),
|
|
105
|
+
)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"extends": "@aamini/config/tsconfig/react.json",
|
|
111
|
+
"include": ["**/*.ts", "**/*.tsx"]
|
|
112
|
+
}
|
|
28
113
|
```
|
|
29
114
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
`
|
|
115
|
+
## Merge rules
|
|
116
|
+
|
|
117
|
+
`mergeToolkitConfig(preset, config)` merges the app config over the preset.
|
|
118
|
+
|
|
119
|
+
- A function value replaces the preset value at the same path. It receives the
|
|
120
|
+
preset value. This applies only where the preset sets a non-function value.
|
|
121
|
+
- A lint rule entry replaces the preset entry.
|
|
122
|
+
- Other values go to `mergeConfig` from Vite+. Objects merge deep, arrays
|
|
123
|
+
append, and scalars replace.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/anti-slop/index.d.ts
|
|
2
|
+
/** Generic Oxlint rules that reject low-evidence and low-signal implementation patterns. */
|
|
3
|
+
declare const antiSlopPlugin: import("vite-plus/lint/plugins").Plugin;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { antiSlopPlugin as default };
|
|
6
|
+
//# sourceMappingURL=index.d.mts.map
|