@dbtlr/tooling 0.1.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 +94 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +38 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types-55c3OwME.d.mts +9 -0
- package/dist/types-55c3OwME.d.mts.map +1 -0
- package/dist/types-DnGmJhKp.mjs +6 -0
- package/dist/types-DnGmJhKp.mjs.map +1 -0
- package/dist/vite-plus.d.mts +26 -0
- package/dist/vite-plus.d.mts.map +1 -0
- package/dist/vite-plus.mjs +137 -0
- package/dist/vite-plus.mjs.map +1 -0
- package/dist/vite.d.mts +13 -0
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +11 -0
- package/dist/vite.mjs.map +1 -0
- package/dist/vitest.d.mts +17 -0
- package/dist/vitest.d.mts.map +1 -0
- package/dist/vitest.mjs +20 -0
- package/dist/vitest.mjs.map +1 -0
- package/package.json +78 -0
- package/tsconfig/base.json +15 -0
- package/tsconfig/bun.json +12 -0
- package/tsconfig/monorepo.json +13 -0
- package/tsconfig/node.json +13 -0
- package/tsconfig/react.json +17 -0
- package/tsconfig/vitest.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# @dbtlr/tooling
|
|
2
|
+
|
|
3
|
+
Shared Vite+ config for Drew's TypeScript projects — one `toolingConfig()` entry point.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
One call describes what the project is and returns a finished Vite+ config:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
// vite.config.ts
|
|
11
|
+
import { toolingConfig } from '@dbtlr/tooling';
|
|
12
|
+
|
|
13
|
+
export default toolingConfig({ react: true }); // browser React app
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Intent flags fan out to lint, test, and Vite config. Every project shape is a single `toolingConfig` call:
|
|
17
|
+
|
|
18
|
+
| Project | Call |
|
|
19
|
+
| ---------------------- | -------------------------------------------------------------------------- |
|
|
20
|
+
| Node server | `toolingConfig({ node: true })` |
|
|
21
|
+
| Browser React app | `toolingConfig({ react: true })` |
|
|
22
|
+
| Isomorphic React (SSR) | `toolingConfig({ node: true, react: true })` |
|
|
23
|
+
| Published library | `toolingConfig({ pack: { entry: ['src/index.ts'] } })` |
|
|
24
|
+
| Node CLI / package | `toolingConfig({ node: true, pack: { entry: ['src/cli.ts'] } })` |
|
|
25
|
+
| Monorepo root | `toolingConfig({ node: ['packages/api/**'], react: ['packages/web/**'] })` |
|
|
26
|
+
|
|
27
|
+
See [`examples/`](./examples) for runnable, CI-verified versions of each.
|
|
28
|
+
|
|
29
|
+
### How intent maps to config
|
|
30
|
+
|
|
31
|
+
- `node` — Node lint target (allows `node:` builtins) + node test env.
|
|
32
|
+
- `react` — React lint plugins + modern-JSX rules + PascalCase filenames, jsdom test env, and the Vite react-app block.
|
|
33
|
+
- `node` + `react` — isomorphic: both lint targets, jsdom test.
|
|
34
|
+
- `pack` present — buildable/publishable package (adds the `pack` block).
|
|
35
|
+
- `test` — override the derived env (`'node'` / `'react'`) or omit it (`false`).
|
|
36
|
+
|
|
37
|
+
`node`/`react` accept `boolean | string[]`. **A boolean configures the whole project; a glob list scopes the target to those files** (a `files`-scoped oxlint override) and marks a **monorepo root** — lint is centralized and no project-wide test/Vite block is added (members own those). This is how one root config addresses each package's runtime in a vite-plus monorepo (whose `pnpm-workspace.yaml` centralizes lint config).
|
|
38
|
+
|
|
39
|
+
`toolingConfig` also accepts the Vite+ options (`lint` / `fmt` / `staged` / `pack`) as overrides on top of the derived defaults. (`node`/`react` are canonical at the top level, so they're not repeated under `lint`.)
|
|
40
|
+
|
|
41
|
+
### Strict by default
|
|
42
|
+
|
|
43
|
+
Lint is **strict by default** — warnings fail (`denyWarnings`) and type-aware lint + type checking run (`typeAware`, `typeCheck`). Opt out per-flag via the `lint` override, e.g. `toolingConfig({ react: true, lint: { typeCheck: false } })`.
|
|
44
|
+
|
|
45
|
+
## TypeScript presets
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"extends": "@dbtlr/tooling/tsconfig/node.json",
|
|
50
|
+
"include": ["src/**/*.ts", "tests/**/*.ts"]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Available presets:
|
|
55
|
+
|
|
56
|
+
- `@dbtlr/tooling/tsconfig/base.json`
|
|
57
|
+
- `@dbtlr/tooling/tsconfig/node.json`
|
|
58
|
+
- `@dbtlr/tooling/tsconfig/bun.json`
|
|
59
|
+
- `@dbtlr/tooling/tsconfig/react.json`
|
|
60
|
+
- `@dbtlr/tooling/tsconfig/monorepo.json`
|
|
61
|
+
- `@dbtlr/tooling/tsconfig/vitest.json`
|
|
62
|
+
|
|
63
|
+
## Granular helpers (escape hatch)
|
|
64
|
+
|
|
65
|
+
`toolingConfig` composes these; reach for them directly when you need finer control — e.g. a monorepo **member** package, or passing Vite plugins. Each is its own subpath export:
|
|
66
|
+
|
|
67
|
+
- `vitePlusBase` / `vitePlusPackage` (`@dbtlr/tooling/vite-plus`) — lint/fmt/staged, plus a `pack` block for buildable packages. `node`/`react` live under the `lint` option here. Strict by default.
|
|
68
|
+
- `vitestNode` / `vitestReact` (`@dbtlr/tooling/vitest`) — Vitest project config (node / jsdom).
|
|
69
|
+
- `viteReactApp` (`@dbtlr/tooling/vite`) — the Vite react-app block; pass `plugins: [react()]` for a real dev/build server.
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { defineConfig } from 'vite-plus';
|
|
73
|
+
import { vitePlusPackage } from '@dbtlr/tooling/vite-plus';
|
|
74
|
+
import { vitestNode } from '@dbtlr/tooling/vitest';
|
|
75
|
+
|
|
76
|
+
export default defineConfig({
|
|
77
|
+
...vitePlusPackage({ lint: { node: true }, pack: { entry: ['src/index.ts'] } }),
|
|
78
|
+
...vitestNode(),
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Linting and formatting are delivered through Vite+ (`vp lint` / `vp fmt`), which bundles Oxlint — there is no standalone Oxlint subpath.
|
|
83
|
+
|
|
84
|
+
## Dependency policy
|
|
85
|
+
|
|
86
|
+
`@dbtlr/tooling` declares its tool integrations (`vite`, `vite-plus`) as **optional peer dependencies** — install the ones your config uses. `vite-plus` powers the whole toolchain (build / lint / fmt / test via `vp`).
|
|
87
|
+
|
|
88
|
+
## Verification
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pnpm install
|
|
92
|
+
pnpm run check
|
|
93
|
+
pnpm run pack:dry
|
|
94
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { n as JsonPrimitive, r as JsonValue, t as JsonObject } from "./types-55c3OwME.mjs";
|
|
2
|
+
import { VitePlusLintOptions, vitePlusBase, vitePlusPackage } from "./vite-plus.mjs";
|
|
3
|
+
import { vitestNode, vitestReact } from "./vitest.mjs";
|
|
4
|
+
import { viteReactApp } from "./vite.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/tooling-config.d.ts
|
|
7
|
+
type LintTarget = boolean | readonly string[];
|
|
8
|
+
type ToolingConfigOptions = {
|
|
9
|
+
readonly node?: LintTarget;
|
|
10
|
+
readonly react?: LintTarget;
|
|
11
|
+
readonly test?: 'node' | 'react' | false;
|
|
12
|
+
readonly pack?: JsonObject;
|
|
13
|
+
readonly lint?: Omit<VitePlusLintOptions, 'node' | 'react'>;
|
|
14
|
+
readonly fmt?: JsonObject;
|
|
15
|
+
readonly staged?: JsonObject | false;
|
|
16
|
+
};
|
|
17
|
+
declare const toolingConfig: (options?: ToolingConfigOptions) => import("vite-plus").UserConfig;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { type JsonObject, type JsonPrimitive, type JsonValue, type ToolingConfigOptions, toolingConfig, vitePlusBase, vitePlusPackage, viteReactApp, vitestNode, vitestReact };
|
|
20
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/tooling-config.ts"],"mappings":";;;;;;KASK,UAAA;AAAA,KAEA,oBAAA;EAAA,SACM,IAAA,GAAO,UAAA;EAAA,SACP,KAAA,GAAQ,UAAA;EAAA,SACR,IAAA;EAAA,SACA,IAAA,GAAO,UAAA;EAAA,SACP,IAAA,GAAO,IAAA,CAAK,mBAAA;EAAA,SACZ,GAAA,GAAM,UAAA;EAAA,SACN,MAAA,GAAS,UAAA;AAAA;AAAA,cAOd,aAAA,GAAiB,OAAA,GAAS,oBAAyB,yBAAA,UAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { t as compactObject } from "./types-DnGmJhKp.mjs";
|
|
2
|
+
import { vitePlusBase, vitePlusPackage } from "./vite-plus.mjs";
|
|
3
|
+
import { viteReactApp } from "./vite.mjs";
|
|
4
|
+
import { vitestNode, vitestReact } from "./vitest.mjs";
|
|
5
|
+
import { defineConfig } from "vite-plus";
|
|
6
|
+
//#region src/tooling-config.ts
|
|
7
|
+
const isScopedTarget = (target) => Array.isArray(target);
|
|
8
|
+
const toolingConfig = (options = {}) => {
|
|
9
|
+
const { node, react, test, pack, lint, fmt, staged } = options;
|
|
10
|
+
const scoped = isScopedTarget(node) || isScopedTarget(react);
|
|
11
|
+
const baseOptions = compactObject({
|
|
12
|
+
fmt,
|
|
13
|
+
lint: {
|
|
14
|
+
...lint,
|
|
15
|
+
node,
|
|
16
|
+
react
|
|
17
|
+
},
|
|
18
|
+
staged
|
|
19
|
+
});
|
|
20
|
+
const base = pack === void 0 ? vitePlusBase(baseOptions) : vitePlusPackage({
|
|
21
|
+
...baseOptions,
|
|
22
|
+
pack
|
|
23
|
+
});
|
|
24
|
+
const viteApp = react === true && !scoped ? viteReactApp() : {};
|
|
25
|
+
const testBlock = (() => {
|
|
26
|
+
if (scoped || test === false) return {};
|
|
27
|
+
return (test ?? (react ? "react" : "node")) === "react" ? vitestReact() : vitestNode();
|
|
28
|
+
})();
|
|
29
|
+
return defineConfig({
|
|
30
|
+
...base,
|
|
31
|
+
...viteApp,
|
|
32
|
+
...testBlock
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { toolingConfig, vitePlusBase, vitePlusPackage, viteReactApp, vitestNode, vitestReact };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/tooling-config.ts"],"sourcesContent":["import { defineConfig } from 'vite-plus';\n\nimport { compactObject } from './types.js';\nimport type { JsonObject } from './types.js';\nimport { vitePlusBase, vitePlusPackage } from './vite-plus.js';\nimport type { VitePlusLintOptions } from './vite-plus.js';\nimport { viteReactApp } from './vite.js';\nimport { vitestNode, vitestReact } from './vitest.js';\n\ntype LintTarget = boolean | readonly string[];\n\ntype ToolingConfigOptions = {\n readonly node?: LintTarget;\n readonly react?: LintTarget;\n readonly test?: 'node' | 'react' | false;\n readonly pack?: JsonObject;\n readonly lint?: Omit<VitePlusLintOptions, 'node' | 'react'>;\n readonly fmt?: JsonObject;\n readonly staged?: JsonObject | false;\n};\n\n// A glob list scopes a target to a monorepo's packages; a bare `true` means the\n// whole single project. Globs => this is a monorepo root: lint only, no test/vite.\nconst isScopedTarget = (target: LintTarget | undefined): boolean => Array.isArray(target);\n\nconst toolingConfig = (options: ToolingConfigOptions = {}) => {\n const { node, react, test, pack, lint, fmt, staged } = options;\n const scoped = isScopedTarget(node) || isScopedTarget(react);\n\n const baseOptions = compactObject({\n fmt,\n lint: { ...lint, node, react },\n staged,\n });\n const base =\n pack === undefined ? vitePlusBase(baseOptions) : vitePlusPackage({ ...baseOptions, pack });\n\n // Single-project react gets the vite react-app block; a monorepo root (any glob\n // target) does not — gated on `scoped` so it stays consistent with the test block.\n const viteApp = react === true && !scoped ? viteReactApp() : {};\n\n // Derive the test env from intent unless overridden; monorepo roots and\n // `test: false` carry no test block (members own their own test config).\n const testBlock = ((): JsonObject => {\n if (scoped || test === false) {\n return {};\n }\n const env = test ?? (react ? 'react' : 'node');\n return env === 'react' ? vitestReact() : vitestNode();\n })();\n\n return defineConfig({ ...base, ...viteApp, ...testBlock });\n};\n\nexport { toolingConfig };\nexport type { ToolingConfigOptions };\n"],"mappings":";;;;;;AAuBA,MAAM,kBAAkB,WAA4C,MAAM,QAAQ,MAAM;AAExF,MAAM,iBAAiB,UAAgC,CAAC,MAAM;CAC5D,MAAM,EAAE,MAAM,OAAO,MAAM,MAAM,MAAM,KAAK,WAAW;CACvD,MAAM,SAAS,eAAe,IAAI,KAAK,eAAe,KAAK;CAE3D,MAAM,cAAc,cAAc;EAChC;EACA,MAAM;GAAE,GAAG;GAAM;GAAM;EAAM;EAC7B;CACF,CAAC;CACD,MAAM,OACJ,SAAS,KAAA,IAAY,aAAa,WAAW,IAAI,gBAAgB;EAAE,GAAG;EAAa;CAAK,CAAC;CAI3F,MAAM,UAAU,UAAU,QAAQ,CAAC,SAAS,aAAa,IAAI,CAAC;CAI9D,MAAM,mBAA+B;EACnC,IAAI,UAAU,SAAS,OACrB,OAAO,CAAC;EAGV,QADY,SAAS,QAAQ,UAAU,aACxB,UAAU,YAAY,IAAI,WAAW;CACtD,EAAA,CAAG;CAEH,OAAO,aAAa;EAAE,GAAG;EAAM,GAAG;EAAS,GAAG;CAAU,CAAC;AAC3D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
3
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
4
|
+
type JsonObject = {
|
|
5
|
+
readonly [key: string]: JsonValue | undefined;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { JsonPrimitive as n, JsonValue as r, JsonObject as t };
|
|
9
|
+
//# sourceMappingURL=types-55c3OwME.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-55c3OwME.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";KAAK,aAAA;AAAA,KACA,SAAA,GAAY,aAAA,GAAgB,UAAA,GAAa,SAAA;AAAA,KACzC,UAAA;EAAA,UAAyB,GAAA,WAAc,SAAS;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DnGmJhKp.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["type JsonPrimitive = string | number | boolean | null;\ntype JsonValue = JsonPrimitive | JsonObject | JsonValue[];\ntype JsonObject = { readonly [key: string]: JsonValue | undefined };\n\ntype DeepPartial<Type> = {\n [Key in keyof Type]?: Type[Key] extends object ? DeepPartial<Type[Key]> : Type[Key];\n};\n\n// Dropping only undefined-valued keys preserves Type's shape, so the assertion is safe.\nconst compactObject = <Type extends Record<string, unknown>>(value: Type): Type =>\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined)) as Type;\n\nexport { compactObject };\nexport type { DeepPartial, JsonObject, JsonPrimitive, JsonValue };\n"],"mappings":";AASA,MAAM,iBAAuD,UAE3D,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC,QAAQ,GAAG,WAAW,UAAU,KAAA,CAAS,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { t as JsonObject } from "./types-55c3OwME.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/vite-plus.d.ts
|
|
4
|
+
type LintTarget = boolean | readonly string[];
|
|
5
|
+
type VitePlusLintOptions = {
|
|
6
|
+
readonly typeAware?: boolean;
|
|
7
|
+
readonly typeCheck?: boolean;
|
|
8
|
+
readonly denyWarnings?: boolean;
|
|
9
|
+
readonly maxWarnings?: number;
|
|
10
|
+
readonly ignores?: readonly string[];
|
|
11
|
+
readonly node?: LintTarget;
|
|
12
|
+
readonly react?: LintTarget;
|
|
13
|
+
readonly rules?: JsonObject;
|
|
14
|
+
readonly overrides?: readonly JsonObject[];
|
|
15
|
+
};
|
|
16
|
+
type VitePlusPackageOptions = {
|
|
17
|
+
readonly pack?: JsonObject;
|
|
18
|
+
readonly lint?: VitePlusLintOptions;
|
|
19
|
+
readonly fmt?: JsonObject;
|
|
20
|
+
readonly staged?: JsonObject | false;
|
|
21
|
+
};
|
|
22
|
+
declare const vitePlusBase: (options?: VitePlusPackageOptions) => JsonObject;
|
|
23
|
+
declare const vitePlusPackage: (options?: VitePlusPackageOptions) => JsonObject;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { type VitePlusLintOptions, type VitePlusPackageOptions, vitePlusBase, vitePlusPackage };
|
|
26
|
+
//# sourceMappingURL=vite-plus.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plus.d.mts","names":[],"sources":["../src/vite-plus.ts"],"mappings":";;;KAQK,UAAA;AAAA,KAEA,mBAAA;EAAA,SACM,SAAA;EAAA,SACA,SAAA;EAAA,SACA,YAAA;EAAA,SACA,WAAA;EAAA,SACA,OAAA;EAAA,SACA,IAAA,GAAO,UAAA;EAAA,SACP,KAAA,GAAQ,UAAA;EAAA,SACR,KAAA,GAAQ,UAAA;EAAA,SACR,SAAA,YAAqB,UAAA;AAAA;AAAA,KAsC3B,sBAAA;EAAA,SACM,IAAA,GAAO,UAAA;EAAA,SACP,IAAA,GAAO,mBAAA;EAAA,SACP,GAAA,GAAM,UAAA;EAAA,SACN,MAAA,GAAS,UAAA;AAAA;AAAA,cA4Gd,YAAA,GAAgB,OAAA,GAAS,sBAAA,KAA8B,UAmBzD;AAAA,cAEE,eAAA,GAAmB,OAAA,GAAS,sBAAA,KAA8B,UAO9D"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { t as compactObject } from "./types-DnGmJhKp.mjs";
|
|
2
|
+
//#region src/vite-plus.ts
|
|
3
|
+
const REACT_PLUGINS = [
|
|
4
|
+
"react",
|
|
5
|
+
"react-perf",
|
|
6
|
+
"jsx-a11y"
|
|
7
|
+
];
|
|
8
|
+
const REACT_RULES = {
|
|
9
|
+
"react/react-in-jsx-scope": "off",
|
|
10
|
+
"unicorn/filename-case": ["warn", { cases: {
|
|
11
|
+
kebabCase: true,
|
|
12
|
+
pascalCase: true
|
|
13
|
+
} }]
|
|
14
|
+
};
|
|
15
|
+
const NODE_PLUGINS = ["node"];
|
|
16
|
+
const NODE_RULES = { "import/no-nodejs-modules": "off" };
|
|
17
|
+
const isWholeProject = (target) => target === true;
|
|
18
|
+
const targetGlobs = (target) => Array.isArray(target) && target.length > 0 ? target : void 0;
|
|
19
|
+
const scopedOverride = (globs, plugins, rules) => ({
|
|
20
|
+
files: [...globs],
|
|
21
|
+
plugins: [...plugins],
|
|
22
|
+
rules: { ...rules }
|
|
23
|
+
});
|
|
24
|
+
const vitePlusLint = (options = {}) => {
|
|
25
|
+
const nodeWhole = isWholeProject(options.node);
|
|
26
|
+
const reactWhole = isWholeProject(options.react);
|
|
27
|
+
const nodeGlobs = targetGlobs(options.node);
|
|
28
|
+
const reactGlobs = targetGlobs(options.react);
|
|
29
|
+
const targetOverrides = [...nodeGlobs ? [scopedOverride(nodeGlobs, NODE_PLUGINS, NODE_RULES)] : [], ...reactGlobs ? [scopedOverride(reactGlobs, REACT_PLUGINS, REACT_RULES)] : []];
|
|
30
|
+
return {
|
|
31
|
+
categories: {
|
|
32
|
+
correctness: "error",
|
|
33
|
+
nursery: "off",
|
|
34
|
+
pedantic: "off",
|
|
35
|
+
perf: "error",
|
|
36
|
+
restriction: "off",
|
|
37
|
+
style: "warn",
|
|
38
|
+
suspicious: "error"
|
|
39
|
+
},
|
|
40
|
+
ignorePatterns: [
|
|
41
|
+
"node_modules",
|
|
42
|
+
"dist",
|
|
43
|
+
"build",
|
|
44
|
+
"coverage",
|
|
45
|
+
".turbo",
|
|
46
|
+
".vite",
|
|
47
|
+
...options.ignores ?? []
|
|
48
|
+
],
|
|
49
|
+
options: compactObject({
|
|
50
|
+
denyWarnings: options.denyWarnings ?? true,
|
|
51
|
+
maxWarnings: options.maxWarnings,
|
|
52
|
+
typeAware: options.typeAware ?? true,
|
|
53
|
+
typeCheck: options.typeCheck ?? true
|
|
54
|
+
}),
|
|
55
|
+
overrides: [
|
|
56
|
+
...targetOverrides,
|
|
57
|
+
{
|
|
58
|
+
files: [
|
|
59
|
+
"tests/**/*.ts",
|
|
60
|
+
"tests/**/*.tsx",
|
|
61
|
+
"**/*.test.ts",
|
|
62
|
+
"**/*.test.tsx",
|
|
63
|
+
"**/*.spec.ts",
|
|
64
|
+
"**/*.spec.tsx"
|
|
65
|
+
],
|
|
66
|
+
rules: {
|
|
67
|
+
"max-statements": "off",
|
|
68
|
+
"vitest/no-importing-vitest-globals": "off",
|
|
69
|
+
"vitest/prefer-expect-assertions": "off",
|
|
70
|
+
"vitest/prefer-importing-vitest-globals": "off"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
...options.overrides ?? []
|
|
74
|
+
],
|
|
75
|
+
plugins: [
|
|
76
|
+
"typescript",
|
|
77
|
+
"import",
|
|
78
|
+
"eslint",
|
|
79
|
+
"unicorn",
|
|
80
|
+
"oxc",
|
|
81
|
+
"promise",
|
|
82
|
+
"vitest",
|
|
83
|
+
...nodeWhole ? NODE_PLUGINS : [],
|
|
84
|
+
...reactWhole ? REACT_PLUGINS : []
|
|
85
|
+
],
|
|
86
|
+
rules: {
|
|
87
|
+
"capitalized-comments": "off",
|
|
88
|
+
"import/no-named-export": "off",
|
|
89
|
+
"import/no-nodejs-modules": "error",
|
|
90
|
+
"import/prefer-default-export": "off",
|
|
91
|
+
"no-duplicate-imports": ["warn", { allowSeparateTypeImports: true }],
|
|
92
|
+
"no-magic-numbers": "off",
|
|
93
|
+
"no-ternary": "off",
|
|
94
|
+
"sort-imports": "off",
|
|
95
|
+
"typescript/consistent-type-definitions": ["warn", "type"],
|
|
96
|
+
"unicorn/no-null": "off",
|
|
97
|
+
"unicorn/prefer-ternary": "off",
|
|
98
|
+
"vitest/prefer-importing-vitest-globals": "off",
|
|
99
|
+
"vitest/prefer-to-be-falsy": "off",
|
|
100
|
+
"vitest/prefer-to-be-truthy": "off",
|
|
101
|
+
...nodeWhole ? NODE_RULES : {},
|
|
102
|
+
...reactWhole ? REACT_RULES : {},
|
|
103
|
+
...options.rules
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
const vitePlusBase = (options = {}) => compactObject({
|
|
108
|
+
fmt: {
|
|
109
|
+
ignorePatterns: [
|
|
110
|
+
"pnpm-lock.yaml",
|
|
111
|
+
"bun.lock",
|
|
112
|
+
"dist/**",
|
|
113
|
+
"build/**",
|
|
114
|
+
"node_modules/**",
|
|
115
|
+
"coverage/**",
|
|
116
|
+
".turbo/**",
|
|
117
|
+
".vite/**"
|
|
118
|
+
],
|
|
119
|
+
singleQuote: true,
|
|
120
|
+
sortImports: { ignoreCase: true },
|
|
121
|
+
...options.fmt
|
|
122
|
+
},
|
|
123
|
+
lint: vitePlusLint(options.lint),
|
|
124
|
+
staged: options.staged === false ? void 0 : options.staged ?? { "*": "vp check --fix" }
|
|
125
|
+
});
|
|
126
|
+
const vitePlusPackage = (options = {}) => ({
|
|
127
|
+
...vitePlusBase(options),
|
|
128
|
+
pack: {
|
|
129
|
+
dts: { tsgo: true },
|
|
130
|
+
exports: true,
|
|
131
|
+
...options.pack
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
//#endregion
|
|
135
|
+
export { vitePlusBase, vitePlusPackage };
|
|
136
|
+
|
|
137
|
+
//# sourceMappingURL=vite-plus.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plus.mjs","names":[],"sources":["../src/vite-plus.ts"],"sourcesContent":["import { compactObject } from './types.js';\nimport type { JsonObject } from './types.js';\n\n// A lint target — `node` or `react` — is a set of files the target applies to.\n// `true` means the whole project (config emitted at the top level); a list of\n// globs means just those files (config emitted as a scoped `overrides` fragment),\n// which is how a mixed-target monorepo's centralized root config addresses each\n// package. `false`/omitted/`[]` means the target is off.\ntype LintTarget = boolean | readonly string[];\n\ntype VitePlusLintOptions = {\n readonly typeAware?: boolean;\n readonly typeCheck?: boolean;\n readonly denyWarnings?: boolean;\n readonly maxWarnings?: number;\n readonly ignores?: readonly string[];\n readonly node?: LintTarget;\n readonly react?: LintTarget;\n readonly rules?: JsonObject;\n readonly overrides?: readonly JsonObject[];\n};\n\n// oxlint plugins enabled for a React target; the `react` plugin also carries the\n// rules-of-hooks / exhaustive-deps checks.\nconst REACT_PLUGINS = ['react', 'react-perf', 'jsx-a11y'] as const;\n\n// The rule tweaks a React target needs: the modern automatic JSX runtime (no\n// in-scope React import) and PascalCase component filenames.\nconst REACT_RULES: JsonObject = {\n 'react/react-in-jsx-scope': 'off',\n 'unicorn/filename-case': ['warn', { cases: { kebabCase: true, pascalCase: true } }],\n};\n\n// oxlint plugins enabled for a Node target.\nconst NODE_PLUGINS = ['node'] as const;\n\n// The rule a Node target needs: allow Node builtins (forbidden by the browser\n// baseline). Enabled alongside the `node` plugin. Consumed by both the\n// whole-project and glob-scoped node paths so they can't drift.\nconst NODE_RULES: JsonObject = {\n 'import/no-nodejs-modules': 'off',\n};\n\n// A target is \"whole project\" only when explicitly `true`.\nconst isWholeProject = (target: LintTarget | undefined): boolean => target === true;\n\n// Non-empty glob list → the target is scoped to those files; otherwise undefined.\nconst targetGlobs = (target: LintTarget | undefined): readonly string[] | undefined =>\n Array.isArray(target) && target.length > 0 ? target : undefined;\n\n// Build the scoped `overrides` fragment for a glob-targeted plugin set + rules.\nconst scopedOverride = (\n globs: readonly string[],\n plugins: readonly string[],\n rules: JsonObject,\n): JsonObject => ({ files: [...globs], plugins: [...plugins], rules: { ...rules } });\n\ntype VitePlusPackageOptions = {\n readonly pack?: JsonObject;\n readonly lint?: VitePlusLintOptions;\n readonly fmt?: JsonObject;\n readonly staged?: JsonObject | false;\n};\n\nconst vitePlusLint = (options: VitePlusLintOptions = {}): JsonObject => {\n const nodeWhole = isWholeProject(options.node);\n const reactWhole = isWholeProject(options.react);\n const nodeGlobs = targetGlobs(options.node);\n const reactGlobs = targetGlobs(options.react);\n\n // Glob-scoped targets become `overrides` fragments; they precede the standing\n // test-file override and any caller-supplied overrides.\n const targetOverrides: JsonObject[] = [\n ...(nodeGlobs ? [scopedOverride(nodeGlobs, NODE_PLUGINS, NODE_RULES)] : []),\n ...(reactGlobs ? [scopedOverride(reactGlobs, REACT_PLUGINS, REACT_RULES)] : []),\n ];\n\n return {\n categories: {\n correctness: 'error',\n nursery: 'off',\n pedantic: 'off',\n perf: 'error',\n restriction: 'off',\n style: 'warn',\n suspicious: 'error',\n },\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'coverage',\n '.turbo',\n '.vite',\n ...(options.ignores ?? []),\n ],\n // Strict by default: warnings fail, and type-aware lint + type checking run.\n // This is the house gate; opt out of any of them per-flag with `false`.\n options: compactObject({\n denyWarnings: options.denyWarnings ?? true,\n maxWarnings: options.maxWarnings,\n typeAware: options.typeAware ?? true,\n typeCheck: options.typeCheck ?? true,\n }),\n overrides: [\n ...targetOverrides,\n {\n files: [\n 'tests/**/*.ts',\n 'tests/**/*.tsx',\n '**/*.test.ts',\n '**/*.test.tsx',\n '**/*.spec.ts',\n '**/*.spec.tsx',\n ],\n rules: {\n 'max-statements': 'off',\n 'vitest/no-importing-vitest-globals': 'off',\n 'vitest/prefer-expect-assertions': 'off',\n 'vitest/prefer-importing-vitest-globals': 'off',\n },\n },\n ...(options.overrides ?? []),\n ],\n plugins: [\n 'typescript',\n 'import',\n 'eslint',\n 'unicorn',\n 'oxc',\n 'promise',\n 'vitest',\n // Whole-project targets enable plugins here; glob-scoped targets enable them\n // in their `overrides` fragment instead (see targetOverrides).\n ...(nodeWhole ? NODE_PLUGINS : []),\n ...(reactWhole ? REACT_PLUGINS : []),\n ],\n rules: {\n 'capitalized-comments': 'off',\n 'import/no-named-export': 'off',\n // Browser baseline forbids Node builtins; a whole-project node target lifts\n // this via NODE_RULES below, a glob-scoped one only inside its override.\n 'import/no-nodejs-modules': 'error',\n // Named exports are the house style (see import/no-named-export above), so\n // don't nudge single-export modules toward a default export.\n 'import/prefer-default-export': 'off',\n 'no-duplicate-imports': ['warn', { allowSeparateTypeImports: true }],\n 'no-magic-numbers': 'off',\n 'no-ternary': 'off',\n 'sort-imports': 'off',\n 'typescript/consistent-type-definitions': ['warn', 'type'],\n 'unicorn/no-null': 'off',\n // Ternaries are allowed (no-ternary off) but not forced; prefer-ternary would\n // rewrite else-if chains into nested ternaries, conflicting with unicorn/no-nested-ternary.\n 'unicorn/prefer-ternary': 'off',\n 'vitest/prefer-importing-vitest-globals': 'off',\n // Conflicts with vitest/prefer-strict-boolean-matchers; prefer strict toBe(true|false).\n // Disabled at base (not just in test files) so the conflict can't fire anywhere.\n 'vitest/prefer-to-be-falsy': 'off',\n 'vitest/prefer-to-be-truthy': 'off',\n // Whole-project targets only; glob-scoped rules live in their overrides.\n // Spread last so a whole-project node target overrides the baseline above.\n ...(nodeWhole ? NODE_RULES : {}),\n ...(reactWhole ? REACT_RULES : {}),\n ...options.rules,\n },\n };\n};\n\nconst vitePlusBase = (options: VitePlusPackageOptions = {}): JsonObject =>\n compactObject({\n fmt: {\n ignorePatterns: [\n 'pnpm-lock.yaml',\n 'bun.lock',\n 'dist/**',\n 'build/**',\n 'node_modules/**',\n 'coverage/**',\n '.turbo/**',\n '.vite/**',\n ],\n singleQuote: true,\n sortImports: { ignoreCase: true },\n ...options.fmt,\n },\n lint: vitePlusLint(options.lint),\n staged: options.staged === false ? undefined : (options.staged ?? { '*': 'vp check --fix' }),\n });\n\nconst vitePlusPackage = (options: VitePlusPackageOptions = {}): JsonObject => ({\n ...vitePlusBase(options),\n pack: {\n dts: { tsgo: true },\n exports: true,\n ...options.pack,\n },\n});\n\nexport { vitePlusBase, vitePlusPackage };\nexport type { VitePlusLintOptions, VitePlusPackageOptions };\n"],"mappings":";;AAwBA,MAAM,gBAAgB;CAAC;CAAS;CAAc;AAAU;AAIxD,MAAM,cAA0B;CAC9B,4BAA4B;CAC5B,yBAAyB,CAAC,QAAQ,EAAE,OAAO;EAAE,WAAW;EAAM,YAAY;CAAK,EAAE,CAAC;AACpF;AAGA,MAAM,eAAe,CAAC,MAAM;AAK5B,MAAM,aAAyB,EAC7B,4BAA4B,MAC9B;AAGA,MAAM,kBAAkB,WAA4C,WAAW;AAG/E,MAAM,eAAe,WACnB,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS,IAAI,SAAS,KAAA;AAGxD,MAAM,kBACJ,OACA,SACA,WACgB;CAAE,OAAO,CAAC,GAAG,KAAK;CAAG,SAAS,CAAC,GAAG,OAAO;CAAG,OAAO,EAAE,GAAG,MAAM;AAAE;AASlF,MAAM,gBAAgB,UAA+B,CAAC,MAAkB;CACtE,MAAM,YAAY,eAAe,QAAQ,IAAI;CAC7C,MAAM,aAAa,eAAe,QAAQ,KAAK;CAC/C,MAAM,YAAY,YAAY,QAAQ,IAAI;CAC1C,MAAM,aAAa,YAAY,QAAQ,KAAK;CAI5C,MAAM,kBAAgC,CACpC,GAAI,YAAY,CAAC,eAAe,WAAW,cAAc,UAAU,CAAC,IAAI,CAAC,GACzE,GAAI,aAAa,CAAC,eAAe,YAAY,eAAe,WAAW,CAAC,IAAI,CAAC,CAC/E;CAEA,OAAO;EACL,YAAY;GACV,aAAa;GACb,SAAS;GACT,UAAU;GACV,MAAM;GACN,aAAa;GACb,OAAO;GACP,YAAY;EACd;EACA,gBAAgB;GACd;GACA;GACA;GACA;GACA;GACA;GACA,GAAI,QAAQ,WAAW,CAAC;EAC1B;EAGA,SAAS,cAAc;GACrB,cAAc,QAAQ,gBAAgB;GACtC,aAAa,QAAQ;GACrB,WAAW,QAAQ,aAAa;GAChC,WAAW,QAAQ,aAAa;EAClC,CAAC;EACD,WAAW;GACT,GAAG;GACH;IACE,OAAO;KACL;KACA;KACA;KACA;KACA;KACA;IACF;IACA,OAAO;KACL,kBAAkB;KAClB,sCAAsC;KACtC,mCAAmC;KACnC,0CAA0C;IAC5C;GACF;GACA,GAAI,QAAQ,aAAa,CAAC;EAC5B;EACA,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GAGA,GAAI,YAAY,eAAe,CAAC;GAChC,GAAI,aAAa,gBAAgB,CAAC;EACpC;EACA,OAAO;GACL,wBAAwB;GACxB,0BAA0B;GAG1B,4BAA4B;GAG5B,gCAAgC;GAChC,wBAAwB,CAAC,QAAQ,EAAE,0BAA0B,KAAK,CAAC;GACnE,oBAAoB;GACpB,cAAc;GACd,gBAAgB;GAChB,0CAA0C,CAAC,QAAQ,MAAM;GACzD,mBAAmB;GAGnB,0BAA0B;GAC1B,0CAA0C;GAG1C,6BAA6B;GAC7B,8BAA8B;GAG9B,GAAI,YAAY,aAAa,CAAC;GAC9B,GAAI,aAAa,cAAc,CAAC;GAChC,GAAG,QAAQ;EACb;CACF;AACF;AAEA,MAAM,gBAAgB,UAAkC,CAAC,MACvD,cAAc;CACZ,KAAK;EACH,gBAAgB;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,aAAa;EACb,aAAa,EAAE,YAAY,KAAK;EAChC,GAAG,QAAQ;CACb;CACA,MAAM,aAAa,QAAQ,IAAI;CAC/B,QAAQ,QAAQ,WAAW,QAAQ,KAAA,IAAa,QAAQ,UAAU,EAAE,KAAK,iBAAiB;AAC5F,CAAC;AAEH,MAAM,mBAAmB,UAAkC,CAAC,OAAmB;CAC7E,GAAG,aAAa,OAAO;CACvB,MAAM;EACJ,KAAK,EAAE,MAAM,KAAK;EAClB,SAAS;EACT,GAAG,QAAQ;CACb;AACF"}
|
package/dist/vite.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { r as JsonValue, t as JsonObject } from "./types-55c3OwME.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/vite.d.ts
|
|
4
|
+
type ViteReactAppOptions = {
|
|
5
|
+
readonly plugins?: readonly JsonValue[];
|
|
6
|
+
readonly alias?: JsonObject;
|
|
7
|
+
readonly server?: JsonObject;
|
|
8
|
+
readonly test?: JsonObject;
|
|
9
|
+
};
|
|
10
|
+
declare const viteReactApp: (options?: ViteReactAppOptions) => JsonObject;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { type ViteReactAppOptions, viteReactApp };
|
|
13
|
+
//# sourceMappingURL=vite.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite.ts"],"mappings":";;;KAEK,mBAAA;EAAA,SACM,OAAA,YAAmB,SAAA;EAAA,SACnB,KAAA,GAAQ,UAAA;EAAA,SACR,MAAA,GAAS,UAAA;EAAA,SACT,IAAA,GAAO,UAAA;AAAA;AAAA,cAGZ,YAAA,GAAgB,OAAA,GAAS,mBAAA,KAA2B,UAKxD"}
|
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/vite.ts
|
|
2
|
+
const viteReactApp = (options = {}) => ({
|
|
3
|
+
plugins: options.plugins ? [...options.plugins] : [],
|
|
4
|
+
resolve: options.alias ? { alias: options.alias } : void 0,
|
|
5
|
+
server: options.server,
|
|
6
|
+
test: options.test
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { viteReactApp };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=vite.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.mjs","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import type { JsonObject, JsonValue } from './types.js';\n\ntype ViteReactAppOptions = {\n readonly plugins?: readonly JsonValue[];\n readonly alias?: JsonObject;\n readonly server?: JsonObject;\n readonly test?: JsonObject;\n};\n\nconst viteReactApp = (options: ViteReactAppOptions = {}): JsonObject => ({\n plugins: options.plugins ? [...options.plugins] : [],\n resolve: options.alias ? { alias: options.alias } : undefined,\n server: options.server,\n test: options.test,\n});\n\nexport { viteReactApp };\nexport type { ViteReactAppOptions };\n"],"mappings":";AASA,MAAM,gBAAgB,UAA+B,CAAC,OAAmB;CACvE,SAAS,QAAQ,UAAU,CAAC,GAAG,QAAQ,OAAO,IAAI,CAAC;CACnD,SAAS,QAAQ,QAAQ,EAAE,OAAO,QAAQ,MAAM,IAAI,KAAA;CACpD,QAAQ,QAAQ;CAChB,MAAM,QAAQ;AAChB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { t as JsonObject } from "./types-55c3OwME.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/vitest.d.ts
|
|
4
|
+
type VitestProjectOptions = {
|
|
5
|
+
readonly name?: string;
|
|
6
|
+
readonly include?: readonly string[];
|
|
7
|
+
readonly exclude?: readonly string[];
|
|
8
|
+
readonly setupFiles?: readonly string[];
|
|
9
|
+
readonly globals?: boolean;
|
|
10
|
+
readonly coverage?: JsonObject | false;
|
|
11
|
+
};
|
|
12
|
+
type VitestEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'browser';
|
|
13
|
+
declare const vitestNode: (options?: VitestProjectOptions) => JsonObject;
|
|
14
|
+
declare const vitestReact: (options?: VitestProjectOptions) => JsonObject;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { type VitestEnvironment, type VitestProjectOptions, vitestNode, vitestReact };
|
|
17
|
+
//# sourceMappingURL=vitest.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.d.mts","names":[],"sources":["../src/vitest.ts"],"mappings":";;;KAGK,oBAAA;EAAA,SACM,IAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA,GAAW,UAAU;AAAA;AAAA,KAG3B,iBAAA;AAAA,cAkBC,UAAA,GAAc,OAAA,GAAS,oBAAA,KAA4B,UACkB;AAAA,cAErE,WAAA,GAAe,OAAA,GAAS,oBAAA,KAA4B,UAItD"}
|
package/dist/vitest.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { t as compactObject } from "./types-DnGmJhKp.mjs";
|
|
2
|
+
//#region src/vitest.ts
|
|
3
|
+
const vitestConfig = (environment, options, defaultInclude) => ({ test: compactObject({
|
|
4
|
+
coverage: options.coverage === false ? void 0 : options.coverage,
|
|
5
|
+
environment,
|
|
6
|
+
exclude: options.exclude ? [...options.exclude] : void 0,
|
|
7
|
+
globals: options.globals,
|
|
8
|
+
include: [...options.include ?? defaultInclude],
|
|
9
|
+
name: options.name,
|
|
10
|
+
setupFiles: options.setupFiles ? [...options.setupFiles] : void 0
|
|
11
|
+
}) });
|
|
12
|
+
const vitestNode = (options = {}) => vitestConfig("node", options, ["src/**/*.test.ts", "tests/**/*.test.ts"]);
|
|
13
|
+
const vitestReact = (options = {}) => vitestConfig("jsdom", {
|
|
14
|
+
globals: true,
|
|
15
|
+
...options
|
|
16
|
+
}, ["src/**/*.test.{ts,tsx}", "tests/**/*.test.{ts,tsx}"]);
|
|
17
|
+
//#endregion
|
|
18
|
+
export { vitestNode, vitestReact };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=vitest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.mjs","names":[],"sources":["../src/vitest.ts"],"sourcesContent":["import { compactObject } from './types.js';\nimport type { JsonObject } from './types.js';\n\ntype VitestProjectOptions = {\n readonly name?: string;\n readonly include?: readonly string[];\n readonly exclude?: readonly string[];\n readonly setupFiles?: readonly string[];\n readonly globals?: boolean;\n readonly coverage?: JsonObject | false;\n};\n\ntype VitestEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'browser';\n\nconst vitestConfig = (\n environment: VitestEnvironment,\n options: VitestProjectOptions,\n defaultInclude: readonly string[],\n): JsonObject => ({\n test: compactObject({\n coverage: options.coverage === false ? undefined : options.coverage,\n environment,\n exclude: options.exclude ? [...options.exclude] : undefined,\n globals: options.globals,\n include: [...(options.include ?? defaultInclude)],\n name: options.name,\n setupFiles: options.setupFiles ? [...options.setupFiles] : undefined,\n }),\n});\n\nconst vitestNode = (options: VitestProjectOptions = {}): JsonObject =>\n vitestConfig('node', options, ['src/**/*.test.ts', 'tests/**/*.test.ts']);\n\nconst vitestReact = (options: VitestProjectOptions = {}): JsonObject =>\n vitestConfig('jsdom', { globals: true, ...options }, [\n 'src/**/*.test.{ts,tsx}',\n 'tests/**/*.test.{ts,tsx}',\n ]);\n\nexport { vitestNode, vitestReact };\nexport type { VitestEnvironment, VitestProjectOptions };\n"],"mappings":";;AAcA,MAAM,gBACJ,aACA,SACA,oBACgB,EAChB,MAAM,cAAc;CAClB,UAAU,QAAQ,aAAa,QAAQ,KAAA,IAAY,QAAQ;CAC3D;CACA,SAAS,QAAQ,UAAU,CAAC,GAAG,QAAQ,OAAO,IAAI,KAAA;CAClD,SAAS,QAAQ;CACjB,SAAS,CAAC,GAAI,QAAQ,WAAW,cAAe;CAChD,MAAM,QAAQ;CACd,YAAY,QAAQ,aAAa,CAAC,GAAG,QAAQ,UAAU,IAAI,KAAA;AAC7D,CAAC,EACH;AAEA,MAAM,cAAc,UAAgC,CAAC,MACnD,aAAa,QAAQ,SAAS,CAAC,oBAAoB,oBAAoB,CAAC;AAE1E,MAAM,eAAe,UAAgC,CAAC,MACpD,aAAa,SAAS;CAAE,SAAS;CAAM,GAAG;AAAQ,GAAG,CACnD,0BACA,0BACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dbtlr/tooling",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared TypeScript, Vitest, and Vite+ config for dbtlr projects — one toolingConfig() entry point.",
|
|
5
|
+
"homepage": "https://github.com/dbtlr/ts-tooling#readme",
|
|
6
|
+
"bugs": "https://github.com/dbtlr/ts-tooling/issues",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/dbtlr/ts-tooling.git"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"tsconfig",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.mts",
|
|
22
|
+
"default": "./dist/index.mjs"
|
|
23
|
+
},
|
|
24
|
+
"./vitest": {
|
|
25
|
+
"types": "./dist/vitest.d.mts",
|
|
26
|
+
"default": "./dist/vitest.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./vite-plus": {
|
|
29
|
+
"types": "./dist/vite-plus.d.mts",
|
|
30
|
+
"default": "./dist/vite-plus.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./vite": {
|
|
33
|
+
"types": "./dist/vite.d.mts",
|
|
34
|
+
"default": "./dist/vite.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./tsconfig/base.json": "./tsconfig/base.json",
|
|
37
|
+
"./tsconfig/node.json": "./tsconfig/node.json",
|
|
38
|
+
"./tsconfig/bun.json": "./tsconfig/bun.json",
|
|
39
|
+
"./tsconfig/react.json": "./tsconfig/react.json",
|
|
40
|
+
"./tsconfig/monorepo.json": "./tsconfig/monorepo.json",
|
|
41
|
+
"./tsconfig/vitest.json": "./tsconfig/vitest.json",
|
|
42
|
+
"./package.json": "./package.json"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public",
|
|
46
|
+
"provenance": true
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^24.0.0",
|
|
50
|
+
"typescript": "^5.9.0",
|
|
51
|
+
"vite-plus": "^0.2.1"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"vite": ">=7.0.0",
|
|
55
|
+
"vite-plus": ">=0.2.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"vite": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"vite-plus": {
|
|
62
|
+
"optional": true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=24"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "vp pack",
|
|
70
|
+
"lint": "vp lint",
|
|
71
|
+
"format": "vp fmt",
|
|
72
|
+
"fmt:check": "vp fmt --check",
|
|
73
|
+
"test": "vp test",
|
|
74
|
+
"check": "vp check && vp test && vp pack",
|
|
75
|
+
"check:examples": "bash scripts/check-examples.sh",
|
|
76
|
+
"pack:dry": "pnpm pack --dry-run"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"lib": ["ESNext"],
|
|
6
|
+
"moduleDetection": "force",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"verbatimModuleSyntax": true,
|
|
11
|
+
"noUncheckedIndexedAccess": true,
|
|
12
|
+
"noFallthroughCasesInSwitch": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"module": "Preserve",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"types": ["bun"],
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"resolveJsonModule": true
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"exactOptionalPropertyTypes": true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"module": "NodeNext",
|
|
6
|
+
"moduleResolution": "NodeNext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"resolveJsonModule": true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"target": "ES2022",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "Bundler",
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"types": ["vite/client"],
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"noUncheckedSideEffectImports": true
|
|
16
|
+
}
|
|
17
|
+
}
|