-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsup.config.ts
37 lines (34 loc) · 1.02 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
import { defineConfig } from 'tsup';
import * as preset from 'tsup-preset-solid';
const preset_options: preset.PresetOptions = {
entries: [
{
name: 'index',
entry: 'src/index.ts',
dev_entry: true,
},
{
name: 'state',
entry: 'src/state/index.ts',
dev_entry: true,
},
],
drop_console: true,
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);
});