-
Notifications
You must be signed in to change notification settings - Fork 9
/
kpo.tasks.mjs
44 lines (42 loc) · 1.43 KB
/
kpo.tasks.mjs
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
import { catches, create, exec, finalize, lift, recreate, series } from 'kpo';
import project from './config/project.config.mjs';
import defaults from './config/riseup.config.mjs';
export default Promise.resolve(defaults)
.then(({ tasks }) => tasks)
.then(({ commit, contents, distribute, release, tarball }) => {
const tasks = {
start: exec('node', [project.build.destination]),
watch: exec('tsx', ['--watch', './src']),
build: series(
contents,
exec('tsup', ['--config', './config/tsup.config.mts'])
),
tarball,
lint: finalize(
exec('eslint', ['.']),
exec('tsc', ['--noEmit']),
exec('prettier', ['.', '--log-level', 'warn', '--cache', '--check'])
),
fix: series(
exec('eslint', ['.', '--fix']),
exec('prettier', ['.', '--log-level', 'warn', '--write'])
),
test: exec('vitest', ['-c', './config/vitest.config.mts']),
commit,
release,
distribute,
validate: series(
create(() => tasks.lint),
create(() => tasks.test),
lift({ purge: true, mode: 'audit' }, () => tasks),
catches({ level: 'silent' }, exec('npm', ['audit']))
),
/* Hooks */
version: series(
create(() => tasks.validate),
create(() => tasks.build),
create(() => series(tasks.docs, exec('git', ['add', '.'])))
)
};
return recreate({ announce: true }, tasks);
});