-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
chompfile.toml
147 lines (125 loc) · 3.15 KB
/
chompfile.toml
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
142
143
144
145
146
147
version = 0.1
default-task = 'build'
[[task]]
target = 'lib'
deps = ['lib/**/*.js']
[[task]]
name = 'build'
target = 'dist'
deps = ['lib', 'npm:install', 'build:dec']
template = 'rollup'
[task.template-options]
input = [
'lib/generator-deno.js',
'lib/generator.js',
'lib/common/fetch-vscode.js',
'lib/common/fetch-deno.js',
'lib/common/fetch-node.js',
'lib/common/fetch-native.js'
]
onwarn = false
clear-dir = true
[task.template-options.output]
dir = 'dist'
[[task]]
name = 'build:ts'
target = 'lib/##.js'
deps = ['src/##.ts']
template = 'swc'
[task.template-options.config]
inlineSourcesContent = false
'jsc.target' = 'es2019'
# TODO: We should emit declaration files with swc once they support it.
# See: https://github.com/swc-project/swc/issues/657
[[task]]
name = 'build:dec'
deps = ['src/**/*.ts']
run = 'tsc --emitDeclarationOnly'
[[task]]
target = 'lib/version.js'
dep = 'package.json'
engine = 'node'
run = '''
import { readFileSync, writeFileSync } from 'fs';
const { version } = JSON.parse(readFileSync('package.json', 'utf8'));
writeFileSync('lib/version.js', `export default ${JSON.stringify(version)}`);
'''
[[task]]
name = 'build:ts'
target = 'lib/##.js'
deps = ['src/##.ts']
template = 'swc'
[task.template-options.config]
inlineSourcesContent = false
'jsc.target' = 'es2019'
[[task]]
name = 'test'
serial = true
deps = [
'test:unit',
'test:integration',
'test:browser',
]
[[task]]
name = 'test:unit'
dep = 'unit:'
[[task]]
name = 'unit:#'
deps = ['lib/##.test.js', 'lib']
run = 'node -C source --enable-source-maps $DEP'
[[task]]
name = 'test:integration'
dep = 'integration:'
[[task]]
name = 'integration:#'
deps = ['test/##.test.js', 'lib']
# env = { JSPM_GENERATOR_LOG = '1' }
run = 'node -C source --enable-source-maps $DEP'
[[task]]
name = 'test:browser'
deps = ['build:ts', 'dist/*', 'test/test.html']
run = 'node test/server.mjs'
[[task]]
name = 'test:browser:watch'
env = { WATCH_MODE = '1' }
run = 'node test/server.mjs'
[[task]]
name = 'cache-clear'
engine = 'node'
run = '''
import { clearCache } from '@jspm/generator';
clearCache();
'''
[[task]]
target = 'test/test.html'
deps = ['src/**/*.ts', 'dist/generator.js']
engine = 'node'
run = '''
import { Generator } from '@jspm/generator';
import { readFile, writeFile } from 'fs/promises';
const generator = new Generator({
mapUrl: new URL('./test/test.html', import.meta.url.replace('//[', '/[')),
env: ['browser', 'module', 'production']
});
await generator.link('@jspm/generator');
await generator.install('node:assert');
const html = await generator.htmlInject(await readFile(process.env.TARGET, 'utf8'), {
htmlUrl: new URL(process.env.TARGET, import.meta.url.replace('//[', '/['))
});
await writeFile(process.env.TARGET, html);
'''
[[task]]
name = 'prettier'
template = 'prettier'
deps = ['src/**/*.ts', 'test/**/*.js']
[task.template-options]
ignore-path = '.prettierignore'
files = 'src/**/*.ts test/**/*.js'
loglevel = 'warn'
[[task]]
name = 'typecheck'
deps = ['src/**/*.ts', 'src/*.ts']
run = '''
tsc --noEmit
'''