-
Notifications
You must be signed in to change notification settings - Fork 182
Expand file tree
/
Copy pathvite.config.ts
More file actions
141 lines (139 loc) · 4.82 KB
/
Copy pathvite.config.ts
File metadata and controls
141 lines (139 loc) · 4.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import { defineConfig } from "vite-plus";
// Fingerprint source/configuration, not pnpm's machine-specific install state
// or directory listings that change when generated outputs are absent in CI.
const toolchainInputs = [
"package.json",
"pnpm-lock.yaml",
"pnpm-workspace.yaml",
".node-version",
".npmrc",
"tsconfig.json",
"vite.config.ts",
"patches/**",
];
const demoInputs = [
...toolchainInputs,
"packages/kumo-docs-astro/package.json",
"packages/kumo-docs-astro/tsconfig.json",
"packages/kumo-docs-astro/scripts/extract-demo-examples.ts",
"packages/kumo-docs-astro/src/components/demos/**",
];
const registryInputs = [
...demoInputs,
"packages/kumo/package.json",
"packages/kumo/tsconfig.json",
"packages/kumo/src/**",
"packages/kumo/scripts/**",
];
export default defineConfig({
staged: {
"*": "vp check --fix",
},
run: {
// We use pnpm until
// https://github.com/voidzero-dev/vite-plus/issues/2238 is fixed.
tasks: {
"gen:demos": {
command: "pnpm --filter @cloudflare/kumo-docs-astro codegen:demos",
input: demoInputs,
output: ["packages/kumo-docs-astro/dist/demo-metadata.json"],
},
"gen:registry": {
command: "tsx packages/kumo/scripts/component-registry/index.ts",
dependsOn: ["gen:demos"],
input: registryInputs,
// Restore the memo too: the package build invokes codegen a second time.
output: [
"packages/kumo/ai/**",
"packages/kumo/.cache/component-registry-cache.json",
],
},
"build:kumo": {
command: "pnpm --filter @cloudflare/kumo build",
// Pre-warms the registry memo so the in-build codegen pass is incremental.
dependsOn: ["gen:registry"],
input: [
...demoInputs,
".gitignore",
"packages/kumo/**",
"!packages/kumo/node_modules/**",
"!packages/kumo/ai/**",
"!packages/kumo/dist/**",
"!packages/kumo/.cache/**",
"!packages/kumo/**/*.tsbuildinfo",
],
},
"gen:figma-data": {
command: "pnpm --filter @cloudflare/kumo-figma build:data",
},
"build:docs": {
command: "pnpm --filter @cloudflare/kumo-docs-astro build",
// The docs site consumes the built kumo package.
dependsOn: ["build:kumo"],
// The build regenerates these itself; outputs, not inputs.
input: [
{ auto: true },
"!packages/kumo-docs-astro/.astro/**",
"!packages/kumo-docs-astro/public/skill.md",
"!packages/kumo-docs-astro/dist/**",
],
},
},
},
fmt: {
// Match the repo's previous Prettier print width.
printWidth: 80,
ignorePatterns: [
// Mustache tag names in plop templates break Oxfmt's Handlebars parser.
"**/*.hbs",
// Generated by `wrangler types`.
"packages/kumo-screenshot-worker/worker-configuration.d.ts",
// TEMPORARY: MDX formatting changes rendered output (JSX-children
// whitespace); native support tracked in https://github.com/oxc-project/oxc/issues/24608
"**/*.mdx",
// Oxfmt diffs from Prettier on long CSS lines: https://github.com/oxc-project/oxc/issues/24843
"packages/kumo/src/styles/kumo.css",
// TEMPORARY: Oxfmt doesn't follow Prettier 3.9's union wrapping yet: https://github.com/oxc-project/oxc/issues/23923
"packages/kumo-docs-astro/src/components/demos/Chart/ColorDemo.tsx",
"packages/kumo-figma/src/generators/shared.ts",
"packages/kumo-figma/src/parsers/tailwind-to-figma.ts",
"packages/kumo/src/components/chart/Color.ts",
"packages/kumo/src/components/dialog/dialog.tsx",
"packages/kumo/src/components/toast/toast.tsx",
"packages/kumo/src/utils/portal-provider.tsx",
"packages/kumo/src/utils/resolve-variant.ts",
"tools/deployments/validate-pr-description.ts",
],
// Replaces prettier-plugin-tailwindcss; the stylesheet teaches kumo-* utilities.
sortTailwindcss: {
functions: ["cn", "clsx"],
stylesheet: "./packages/kumo/src/styles/kumo-standalone.css",
},
},
lint: {
// ci/ and tools/ were never linted; figma scripts import kumo's non-exported files.
ignorePatterns: ["ci/**", "tools/**", "packages/kumo-figma/scripts/**"],
jsPlugins: [
"./packages/kumo/lint/kumo-plugin.js",
{
name: "vite-plus",
specifier: "vite-plus/oxlint-plugin",
},
],
plugins: ["eslint", "typescript"],
categories: {
correctness: "error",
},
rules: {
"kumo/no-cross-package-imports": "error",
"kumo/no-primitive-colors": "error",
"kumo/no-tailwind-dark-variant": "error",
"kumo/no-flow-node-custom-render": "error",
"vite-plus/prefer-vite-plus-imports": "error",
},
options: {
typeAware: true,
typeCheck: true,
},
},
});