-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtasks.ts
56 lines (55 loc) · 2.19 KB
/
tasks.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { Task } from 'https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.8.0/src/index.ts'
// ------------------------------------------------------------------
// Clean
// ------------------------------------------------------------------
Task.run('clean', async () => {
await Task.folder('target').delete()
})
// ------------------------------------------------------------------
// Format
// ------------------------------------------------------------------
Task.run('format', async () => {
await Task.shell('deno fmt src')
})
// ------------------------------------------------------------------
// Start
// ------------------------------------------------------------------
Task.run('start', async () => {
await Task.shell('deno run -A --watch example/index.ts')
})
// ------------------------------------------------------------------
// Test
// ------------------------------------------------------------------
Task.run('test', async () => {
await Task.shell('deno test -A test')
})
// ------------------------------------------------------------------
// Build
// ------------------------------------------------------------------
Task.run('build', () => Task.build('src', {
compiler: 'latest',
outdir: 'target',
additional: ['license', 'readme.md'],
packageJson: {
name: '@sinclair/parsebox',
description: 'Parser Combinators in the TypeScript Type System',
version: '0.9.2',
keywords: ['typescript', 'parser', 'combinator'],
license: 'MIT',
author: 'sinclairzx81',
repository: {
type: 'git',
url: 'https://github.com/sinclairzx81/parsebox'
}
},
}))
// ------------------------------------------------------------------
// Publish
// ------------------------------------------------------------------
Task.run('publish', async (otp: string, target: string = `target/build`) => {
const { version } = JSON.parse(await Deno.readTextFile(`${target}/package.json`))
if(version.includes('-dev')) throw Error(`package version should not include -dev specifier`)
await Task.shell(`cd ${target} && npm publish sinclair-parsebox-${version}.tgz --access=public --otp ${otp}`)
await Task.shell(`git tag ${version}`)
await Task.shell(`git push origin ${version}`)
})