-
Notifications
You must be signed in to change notification settings - Fork 198
Expand file tree
/
Copy pathtasks.ts
More file actions
126 lines (123 loc) · 5.68 KB
/
tasks.ts
File metadata and controls
126 lines (123 loc) · 5.68 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
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
// deno-fmt-ignore-file
import { Syntax } from './task/syntax/index.ts'
import { Website } from './task/website/index.ts'
import { Bench } from './task/bench/index.ts'
import { Turing } from './task/turing/index.ts'
import { Range } from './task/range/index.ts'
import { Metrics } from './task/metrics/index.ts'
import { Spec } from './task/spec/index.ts'
import { Task } from 'tasksmith'
const Version = '1.1.33'
// ------------------------------------------------------------------
// Build
// ------------------------------------------------------------------
const BuildPackage = (target: string = `target/build`) => Task.build.esm('src', {
outdir: target,
compiler: '6.0.3',
additional: ['license', 'readme.md'],
packageJson: {
name: 'typebox',
description: 'Json Schema Type Builder with Static Type Resolution for TypeScript',
version: Version,
keywords: ['typescript', 'jsonschema'],
license: 'MIT',
author: 'sinclairzx81',
repository: {
type: 'git',
url: 'https://github.com/sinclairzx81/typebox'
}
},
})
// ------------------------------------------------------------------
// Publish
// ------------------------------------------------------------------
const PublishPackage = async (target: string = `target/build`) => {
const { version } = JSON.parse(await Task.file(`${target}/package.json`).read())
await Task.shell(`git tag ${version}`)
await Task.shell(`git push origin ${version}`)
}
// ------------------------------------------------------------------
// Bench
// ------------------------------------------------------------------
Task.run('bench', () => Bench.Run())
// ------------------------------------------------------------------
// Build
// ------------------------------------------------------------------
Task.run('build', (target: string = `target/build`) => BuildPackage(target))
// ------------------------------------------------------------------
// Clean
// ------------------------------------------------------------------
Task.run('clean', () => Task.folder('target').delete())
// ------------------------------------------------------------------
// Local
// ------------------------------------------------------------------
Task.run('local', (target: string = `../build-test/node_modules/typebox`) => BuildPackage(target))
// ------------------------------------------------------------------
// Publish
// ------------------------------------------------------------------
Task.run('publish', (target: string = `target/build`) => PublishPackage(target))
// ------------------------------------------------------------------
// Format
// ------------------------------------------------------------------
Task.run('format', () => Task.shell('deno fmt src test/typebox task/spec'))
// ------------------------------------------------------------------
// Lint
// ------------------------------------------------------------------
Task.run('lint', () => Task.shell('deno lint src'))
// ------------------------------------------------------------------
// Spec
// ------------------------------------------------------------------
Task.run('spec', () => Spec.refresh('test/jsonschema/cases'))
// ------------------------------------------------------------------
// Syntax
// ------------------------------------------------------------------
Task.run('syntax', () => Syntax())
// ------------------------------------------------------------------
// Start
// ------------------------------------------------------------------
Task.run('start', () => Task.shell('deno run -A --watch --no-check example/index.ts'))
// ------------------------------------------------------------------
// Test
// ------------------------------------------------------------------
Task.run('test', async (filter: string = '') =>
Task.shell('deno lint src').catch(() => null).then(() =>
Task.test.run(['test/jsonschema', 'test/typebox'], { filter }))
)
// ------------------------------------------------------------------
// Fast
// ------------------------------------------------------------------
Task.run('fast', (filter: string = '') => Task.test.run(['test/jsonschema', 'test/typebox'], { watch: true, noCheck: true, filter }))
// ------------------------------------------------------------------
// Website
// ------------------------------------------------------------------
Task.run('website', () => Website('docs'))
// ------------------------------------------------------------------
// Turing
// ------------------------------------------------------------------
Task.run('turing', () => Turing.Debug())
// ------------------------------------------------------------------
// Report
// ------------------------------------------------------------------
Task.run('report', () => Task.test.report(['test/jsonschema', 'test/typebox']))
// ------------------------------------------------------------------
// Metrics
// ------------------------------------------------------------------
Task.run('metrics', () => Metrics())
// ------------------------------------------------------------------
// Native
// ------------------------------------------------------------------
Task.run('native', (target: string = `target/build`) => Task.tsgo('latest')
.run('src/index.ts --target ESNext --module ESNext --strict --noEmit --ignoreConfig --allowImportingTsExtensions'))
// ------------------------------------------------------------------
// Range
// ------------------------------------------------------------------
Task.run('range', async () => {
await Range.Legacy([
'5.0.4', '5.1.3', '5.1.6', '5.2.2', '5.3.2', '5.3.3',
'5.4.3', '5.4.5', '5.5.2', '5.5.3', '5.5.4', '5.6.2',
'5.6.3', '5.7.2', '5.7.3', '5.9.2', '5.9.3',
])
await Range.Modern([
'6.0.2', '6.0.3', 'next', 'latest',
])
})