forked from actions-rs/clippy-check
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.ts
More file actions
84 lines (77 loc) · 2.41 KB
/
vite.config.ts
File metadata and controls
84 lines (77 loc) · 2.41 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
import nodePath from "node:path";
import { codecovVitePlugin } from "@codecov/vite-plugin";
import type { SSROptions, UserConfig } from "vite";
import { loadEnv } from "vite";
import { checker } from "vite-plugin-checker";
import type { ViteUserConfigFn } from "vitest/config";
import { coverageConfigDefaults, defineConfig } from "vitest/config";
function buildSsr(): SSROptions {
const ssr: SSROptions = {
target: "node",
};
if (process.env["VITEST"] !== "true") {
ssr.noExternal = true;
}
return ssr;
}
const configFunction: ViteUserConfigFn = defineConfig(({ mode }) => {
const environment = loadEnv(mode, process.cwd(), "");
const config: UserConfig = {
appType: "custom",
build: {
lib: {
entry: nodePath.resolve(import.meta.dirname, "src/index.ts"),
fileName: "index",
formats: ["es"],
},
minify: false,
target: "node24",
emptyOutDir: true,
sourcemap: true,
ssr: true,
rolldownOptions: {
treeshake: true,
},
},
ssr: buildSsr(),
resolve: {
tsconfigPaths: true,
},
plugins: [
checker({ typescript: true }),
codecovVitePlugin({
enableBundleAnalysis: environment["GITHUB_ACTIONS"] === "true",
bundleName: "clippy-check",
oidc: {
useGitHubOIDC: true,
},
telemetry: false,
}),
],
test: {
coverage: {
exclude: [...coverageConfigDefaults.exclude, "./dependency-cruiser.config.mjs"],
reporter: ["json", "html", "text", "lcov"],
provider: "v8",
reportsDirectory: "reports",
},
environment: "node",
environmentOptions: {
// node: {},
},
globals: false,
outputFile: {
junit: "./reports/results.xml",
},
restoreMocks: true,
setupFiles: ["./test.setup.ts"],
server: {
deps: {
inline: ["@actions-rs-plus/core", "@actions/core", "@actions/exec", "@actions/io"],
},
},
},
};
return config;
});
export default configFunction;