-
Notifications
You must be signed in to change notification settings - Fork 1
/
tsup.config.ts
44 lines (36 loc) · 1.27 KB
/
tsup.config.ts
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
import { defineConfig } from "tsup";
import * as preset from "tsup-preset-solid";
const preset_options: preset.PresetOptions = {
// array or single object
entries: [
// default entry (index)
{
// entries with '.tsx' extension will have `solid` export condition generated
entry: "src/index.tsx",
// will generate a separate development entry
dev_entry: true,
},
],
// Set to `true` to remove all `console.*` calls and `debugger` statements in prod builds
drop_console: true,
// Set to `true` to generate a CommonJS build alongside ESM
// cjs: true,
};
const CI =
process.env["CI"] === "true" ||
process.env["GITHUB_ACTIONS"] === "true" ||
process.env["CI"] === '"1"' ||
process.env["GITHUB_ACTIONS"] === '"1"';
export default defineConfig((config) => {
const watching = !!config.watch;
const parsed_options = preset.parsePresetOptions(preset_options, watching);
if (!watching && !CI) {
const package_fields = preset.generatePackageExports(parsed_options);
console.log(
`package.json: \n\n${JSON.stringify(package_fields, null, 2)}\n\n`
);
// will update ./package.json with the correct export fields
preset.writePackageJson(package_fields);
}
return preset.generateTsupOptions(parsed_options);
});