forked from jspm/generator.jspm.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchompfile.toml
55 lines (48 loc) · 1.28 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
version = 0.1
default-task = 'build'
[[task]]
name = 'npm:install'
targets = [
'node_modules',
'package-lock.json',
]
deps = ['package.json']
validation = 'ok-only'
display = 'init-only'
run = 'npm install'
[[task]]
name = 'serve'
deps = ['build']
run = 'npx http-server -o /sandbox.html'
[[task]]
name = 'build'
targets = ['sandbox.html']
deps = [
'sandbox.html',
'src/**/*',
'npm:install',
]
invalidation = 'always'
engine = 'node'
run = '''
import { Generator } from '@jspm/generator';
import { readFile, writeFile } from 'fs/promises';
import { pathToFileURL } from 'url';
import mkdirp from 'mkdirp';
import { dirname } from 'path';
const generator = new Generator({
cache: false,
mapUrl: pathToFileURL(process.env.TARGET),
env: ["browser", "production", "module"]
});
const htmlSource = await readFile(process.env.DEP, 'utf-8');
mkdirp.sync(dirname(process.env.TARGET));
await writeFile(process.env.TARGET, await generator.htmlGenerate(htmlSource, {
htmlUrl: pathToFileURL(process.env.TARGET),
preload: true,
integrity: true
}));
'''
[[task]]
name = 'deploy'
run = 'ipfs --api=/ip4/127.0.0.1/tcp/45005 name publish /ipfs/$(ipfs --api=/ip4/127.0.0.1/tcp/45005 add -r . -Q --cid-version=1)'