This repository was archived by the owner on Apr 11, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ts
More file actions
75 lines (64 loc) · 1.76 KB
/
build.ts
File metadata and controls
75 lines (64 loc) · 1.76 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
import path from 'node:path'
import process from 'node:process'
import consola from 'consola'
import fs from 'fs-extra'
import { PluginsRoot } from './constant.ts'
import { processPlugins } from './processor.ts'
import { report } from './reporters/index.ts'
/**
* Build all plugins or specific ones
* @param ids Plugin IDs to process, or undefined to process all
*/
export async function buildPlugins(ids?: string[]): Promise<void> {
try {
let pluginIds = ids
// If no IDs specified, discover all plugins
if (!pluginIds || pluginIds.length === 0) {
pluginIds = await fs.readdir(PluginsRoot)
pluginIds = pluginIds.filter((id) => {
const pluginPath = path.join(PluginsRoot, id)
return fs.statSync(pluginPath).isDirectory()
})
}
// Process plugins
const result = await processPlugins(pluginIds)
// Report results
await report(result)
// Exit with appropriate code
if (result.errors.length > 0) {
process.exit(1)
}
}
catch (error) {
consola.error('Build failed:', error)
process.exit(1)
}
}
/**
* Check mode for PR validation
* Only process changed plugins and validate them
*/
export async function checkPlugins(ids?: string[]): Promise<void> {
try {
let pluginIds = ids
if (!pluginIds || pluginIds.length === 0) {
// TODO: Use detectChangedPlugins() when git setup is available
pluginIds = []
}
if (pluginIds.length === 0) {
return
}
// Process plugins
const result = await processPlugins(pluginIds)
// Report results
await report(result)
// Exit with appropriate code
if (result.errors.length > 0) {
process.exit(1)
}
}
catch (error) {
consola.error('Check failed:', error)
process.exit(1)
}
}