@kasoa/vite-plus-config 0.1.2 → 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 +43 -88
- package/dist/base-7cyIJaBC.mjs +572 -0
- package/dist/base-7cyIJaBC.mjs.map +1 -0
- package/dist/src/base/index.mjs +1 -1
- package/dist/src/cloudflare-workers/index.d.mts.map +1 -1
- package/dist/src/cloudflare-workers/index.mjs +4 -4
- package/dist/src/cloudflare-workers/index.mjs.map +1 -1
- package/dist/src/library/index.mjs +1 -1
- package/dist/src/monorepo/index.mjs +1 -1
- package/dist/src/node/index.mjs +1 -1
- package/dist/src/react/index.mjs +1 -1
- package/dist/src/react-native/index.d.mts +7 -0
- package/dist/src/react-native/index.d.mts.map +1 -0
- package/dist/src/react-native/index.mjs +13 -0
- package/dist/src/react-native/index.mjs.map +1 -0
- package/package.json +20 -16
- package/dist/base-Xhg6v9Ct.mjs +0 -287
- package/dist/base-Xhg6v9Ct.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
# @kasoa/vite-plus-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Strict Vite+ presets for formatting, linting, type checking, testing, packaging, and staged checks. Requires Node.js 24.11 or newer, Vite+ 0.2.8 or newer, and TypeScript 7.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
Install Vite+ and the shared config:
|
|
8
|
-
|
|
9
7
|
```bash
|
|
10
8
|
pnpm add -D @kasoa/vite-plus-config vite-plus typescript@^7
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
11
|
+
## Presets
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
| Export | Use |
|
|
14
|
+
| -------------------- | ----------------------------------------------- |
|
|
15
|
+
| `base` | TypeScript applications and custom compositions |
|
|
16
|
+
| `react` | Browser React applications |
|
|
17
|
+
| `react-native` | React Native and Expo applications |
|
|
18
|
+
| `node` | Node.js applications and tools |
|
|
19
|
+
| `library` | ESM libraries built with `vp pack` |
|
|
20
|
+
| `monorepo` | Workspace roots using Vite+ tasks |
|
|
21
|
+
| `cloudflare-workers` | Node preset plus workerd-based Vitest wiring |
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
import { createConfig } from "@kasoa/vite-plus-config/base";
|
|
23
|
-
|
|
24
|
-
export default createConfig();
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### React Projects
|
|
23
|
+
Create `vite.config.ts` with the matching factory:
|
|
28
24
|
|
|
29
25
|
```ts
|
|
30
26
|
import { createConfig } from "@kasoa/vite-plus-config/react";
|
|
@@ -32,119 +28,78 @@ import { createConfig } from "@kasoa/vite-plus-config/react";
|
|
|
32
28
|
export default createConfig();
|
|
33
29
|
```
|
|
34
30
|
|
|
35
|
-
###
|
|
31
|
+
### React Native and Expo
|
|
36
32
|
|
|
37
33
|
```ts
|
|
38
|
-
import { createConfig } from "@kasoa/vite-plus-config/
|
|
34
|
+
import { createConfig } from "@kasoa/vite-plus-config/react-native";
|
|
39
35
|
|
|
40
36
|
export default createConfig();
|
|
41
37
|
```
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
import { createConfig } from "@kasoa/vite-plus-config/library";
|
|
47
|
-
|
|
48
|
-
export default createConfig();
|
|
49
|
-
```
|
|
39
|
+
The native preset rejects DOM globals, permits Expo's statically replaced `process.env` and React Native's `__DEV__`, excludes DOM accessibility rules, and ignores `.expo` output. It does not ignore `android` or `ios`, which may be project-owned source.
|
|
50
40
|
|
|
51
|
-
###
|
|
41
|
+
### Cloudflare Workers tests
|
|
52
42
|
|
|
53
|
-
|
|
54
|
-
import { createConfig } from "@kasoa/vite-plus-config/monorepo";
|
|
43
|
+
Install the optional peers:
|
|
55
44
|
|
|
56
|
-
|
|
45
|
+
```bash
|
|
46
|
+
pnpm add -D @cloudflare/vitest-pool-workers wrangler
|
|
57
47
|
```
|
|
58
48
|
|
|
59
|
-
## Customizing a Preset
|
|
60
|
-
|
|
61
|
-
Pass overrides directly to the preset factory. Nested config is merged so consumers can stay strict by default and still tweak what they need.
|
|
62
|
-
|
|
63
49
|
```ts
|
|
64
|
-
import { createConfig } from "@kasoa/vite-plus-config/
|
|
50
|
+
import { createConfig } from "@kasoa/vite-plus-config/cloudflare-workers";
|
|
65
51
|
|
|
66
52
|
export default createConfig({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
miniflare: {
|
|
54
|
+
bindings: {
|
|
55
|
+
CORS_ALLOWED_ORIGINS: "",
|
|
70
56
|
},
|
|
71
57
|
},
|
|
72
58
|
test: {
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
provide: {
|
|
60
|
+
d1Migrations: [],
|
|
75
61
|
},
|
|
76
62
|
},
|
|
77
63
|
});
|
|
78
64
|
```
|
|
79
65
|
|
|
80
|
-
|
|
66
|
+
Wrangler owns Worker development, builds, type generation, and deployment. Vite+ owns static checks and workerd tests. Consumers retain ownership of bindings, migrations, setup files, coverage, and `test.provide` values.
|
|
81
67
|
|
|
82
|
-
|
|
68
|
+
## Overrides
|
|
83
69
|
|
|
84
|
-
|
|
85
|
-
pnpm add -D @cloudflare/vitest-pool-workers wrangler
|
|
86
|
-
```
|
|
70
|
+
Pass project-specific overrides to the factory. Lint rule tuples are replaced atomically; other arrays follow Vite's merge behavior.
|
|
87
71
|
|
|
88
72
|
```ts
|
|
89
|
-
import { createConfig } from "@kasoa/vite-plus-config/
|
|
73
|
+
import { createConfig } from "@kasoa/vite-plus-config/react";
|
|
90
74
|
|
|
91
75
|
export default createConfig({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
76
|
+
lint: {
|
|
77
|
+
rules: {
|
|
78
|
+
complexity: "off",
|
|
79
|
+
"max-params": ["warn", { max: 5 }],
|
|
95
80
|
},
|
|
96
81
|
},
|
|
97
82
|
test: {
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
coverage: {
|
|
84
|
+
reporter: ["text", "html"],
|
|
100
85
|
},
|
|
101
86
|
},
|
|
102
87
|
});
|
|
103
88
|
```
|
|
104
89
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
```json
|
|
108
|
-
{
|
|
109
|
-
"scripts": {
|
|
110
|
-
"dev": "wrangler dev",
|
|
111
|
-
"build": "wrangler deploy --dry-run",
|
|
112
|
-
"check": "vp check",
|
|
113
|
-
"test": "vp test"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Keep project-specific migrations, bindings, coverage, setup files, and `test.provide` values in the consuming project. Vite-owned frontend and full-stack applications should configure `@cloudflare/vite-plugin` with their project-specific plugins.
|
|
90
|
+
The React presets report React Compiler violations, but linting does not install or enable compiler transforms. Configure the compiler separately in applications that use it.
|
|
119
91
|
|
|
120
|
-
##
|
|
92
|
+
## Commands
|
|
121
93
|
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"check:fix": "vp check --fix"
|
|
127
|
-
}
|
|
128
|
-
}
|
|
94
|
+
```bash
|
|
95
|
+
vp check
|
|
96
|
+
vp check --fix
|
|
97
|
+
vp test
|
|
129
98
|
```
|
|
130
99
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
Use `vp config` to generate commit hooks from the shared `staged` rules. Keep one `vite.config.ts` unless the project needs separate configurations.
|
|
134
|
-
|
|
135
|
-
## Configurations
|
|
136
|
-
|
|
137
|
-
- **`base`**: Strict TypeScript-first format, lint, type-aware/type-check defaults, dependency/build ignores, test include, and staged-file defaults.
|
|
138
|
-
- **`react`**: `base` plus browser globals, React lint rules, and Tailwind-aware formatting. React Native or Expo projects that want to reject DOM globals can override `lint.env.browser` to `false`.
|
|
139
|
-
- **`node`**: `base` plus Node-oriented lint rules.
|
|
140
|
-
- **`library`**: `base` plus ESM-only packaging defaults for `vp pack`.
|
|
141
|
-
- **`monorepo`**: `base` plus root-only `run` defaults for workspace caching.
|
|
142
|
-
- **`cloudflare-workers`**: `node` plus Cloudflare Worker test wiring.
|
|
143
|
-
|
|
144
|
-
## Author
|
|
100
|
+
Use path arguments for focused iteration and run the complete command before committing. Import Vitest APIs from `vite-plus/test`.
|
|
145
101
|
|
|
146
|
-
|
|
147
|
-
https://github.com/emmanuelchucks
|
|
102
|
+
`vp config` generates commit hooks from the preset's staged-check configuration.
|
|
148
103
|
|
|
149
104
|
## License
|
|
150
105
|
|