-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.task.ts
33 lines (26 loc) 路 909 Bytes
/
build.task.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
import {z} from 'zod';
import type {Task} from './task.js';
import {Plugins} from './plugin.js';
import {clean_fs} from './clean_fs.js';
export const Args = z
.object({
install: z.boolean({description: 'run npm install before building'}).default(false),
})
.strict();
export type Args = z.infer<typeof Args>;
export const task: Task<Args> = {
summary: 'build the project',
Args,
run: async (ctx): Promise<void> => {
const {args, invoke_task} = ctx;
const {install} = args;
await invoke_task('sync', {install});
// TODO possibly detect if the git workspace is clean, and ask for confirmation if not,
// because we're not doing things like `gro gen` here because that's a dev/CI concern
await clean_fs({build_dist: true});
const plugins = await Plugins.create({...ctx, dev: false, watch: false});
await plugins.setup();
await plugins.adapt();
await plugins.teardown();
},
};