-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
97 lines (92 loc) · 1.9 KB
/
tsdown.config.ts
File metadata and controls
97 lines (92 loc) · 1.9 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
import {resolve} from 'node:path'
const testBuild = process.env['TEST_BUILD'] === '1'
const strategyNames = [
'firebase',
'ipfs',
'mqtt',
'nostr',
'supabase',
'torrent'
]
const ci = process.env['CI'] === 'true'
const coreSourcePath = resolve('packages/core/src/index.ts')
const empty = resolve('scripts/empty.ts')
const packageDepsConfig = {
deps: {
skipNodeModulesBundle: true
}
}
const browserBundleDepsConfig = {
deps: {
alwaysBundle: [/^@trystero-p2p\//],
onlyBundle: false
}
}
const dropDevLabelStatements = testBuild
? {}
: {
inputOptions: {
transform: {
dropLabels: ['DEV']
}
}
}
export default [
{
workspace: {
include: ['packages/*'],
exclude: ['packages/trystero']
},
entry: 'src/index.ts',
dts: true,
unbundle: true,
sourcemap: true,
exports: true,
...packageDepsConfig,
publint: ci,
attw: ci,
...dropDevLabelStatements
},
{
workspace: {
include: ['packages/trystero']
},
entry: {
index: 'src/index.ts',
nostr: 'src/nostr.ts',
torrent: 'src/torrent.ts',
mqtt: 'src/mqtt.ts',
ipfs: 'src/ipfs.ts',
supabase: 'src/supabase.ts',
firebase: 'src/firebase.ts'
},
dts: true,
unbundle: true,
sourcemap: true,
exports: true,
...packageDepsConfig,
publint: ci,
attw: ci,
...dropDevLabelStatements
},
...strategyNames.map((name, index) => ({
workspace: false as const,
entry: {
[`trystero-${name}.min`]: `packages/${name}/src/index.ts`
},
outDir: 'dist',
dts: false,
format: 'es' as const,
platform: 'browser' as const,
sourcemap: true,
minify: !testBuild,
...browserBundleDepsConfig,
alias: {
'@trystero-p2p/core': coreSourcePath,
crypto: empty,
'node:crypto': empty
},
clean: index === 0,
...dropDevLabelStatements
}))
]