-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.task.ts
More file actions
60 lines (55 loc) · 2.14 KB
/
Copy pathrelease.task.ts
File metadata and controls
60 lines (55 loc) · 2.14 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
import { z } from 'zod';
import type { Task } from './task.ts';
import { has_sveltekit_library, has_sveltekit_app } from './sveltekit_helpers.ts';
import { package_json_load } from './package_json.ts';
/** @nodocs */
export const Args = z.strictObject({
dry: z
.boolean()
.meta({ description: 'build and prepare without actually publishing or deploying' })
.default(false),
check: z.boolean().meta({ description: 'dual of no-check' }).default(true),
'no-check': z
.boolean()
.meta({ description: 'opt out of checking before publishing' })
.default(false),
build: z.boolean().meta({ description: 'dual of no-build' }).default(true),
'no-build': z.boolean().meta({ description: 'opt out of building' }).default(false),
pull: z.boolean().meta({ description: 'dual of no-pull' }).default(true),
'no-pull': z.boolean().meta({ description: 'opt out of git pull' }).default(false),
sync: z.boolean().meta({ description: 'dual of no-sync' }).default(true),
'no-sync': z.boolean().meta({ description: 'opt out of gro sync' }).default(false),
install: z.boolean().meta({ description: 'dual of no-install' }).default(true),
'no-install': z.boolean().meta({ description: 'opt out of installing packages' }).default(false),
gen: z.boolean().meta({ description: 'dual of no-gen' }).default(true),
'no-gen': z.boolean().meta({ description: 'opt out of gro gen in deploy build' }).default(false),
force_build: z
.boolean()
.meta({ description: 'force a fresh build, ignoring the cache' })
.default(false)
});
export type Args = z.infer<typeof Args>;
/** @nodocs */
export const task: Task<Args> = {
summary: 'publish and deploy',
Args,
run: async ({ args, invoke_task }) => {
const { dry, check, build, pull, sync, install, gen, force_build } = args;
const package_json = await package_json_load();
const publish = (await has_sveltekit_library(package_json)).ok;
if (publish) {
await invoke_task('publish', { optional: true, dry, check, build, pull, sync, install });
}
if ((await has_sveltekit_app()).ok) {
await invoke_task('deploy', {
build: build && !publish,
dry,
pull,
sync,
install,
gen,
force_build
});
}
}
};