-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjust.config.js
46 lines (39 loc) · 1.16 KB
/
just.config.js
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
const { task, series, parallel, logger } = require('just-scripts')
const util = require('util')
const proc = require('child_process')
const mkdirp = require('mkdirp')
const rimraf = require('rimraf')
const ncp = require('ncp')
const manifest = require('./src/manifest.json')
const name = manifest.name.replace(/[^\w\-]+/gi, '')
const version = manifest.version
const cp = util.promisify(ncp)
const rmrf = util.promisify(rimraf)
const exec = util.promisify(proc.exec)
task('build', async () => {
await Promise.all([
cp('src/', 'build/', {
stopOnErr: true,
filter(filename) {
return !/\.tsx?$/.test(filename)
},
}),
exec('tsc'),
])
})
task('clean', async () => {
await rmrf('build/')
})
task('zip', async () => {
const filename = `${name}-v${version}.zip`
logger.info(`zipping into "${filename}"...`)
await mkdirp('dist/')
await exec(`7z a -r dist/${filename} build/.`)
})
task('srczip', async () => {
await mkdirp('dist/')
await exec(`git archive -9 -v -o ./dist/${name}-v${version}.Source.zip HEAD`)
})
task('default', series('clean', 'build'))
task('dist', parallel('zip', 'srczip'))
task('all', series('default', 'dist'))