-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegemrc.ts
42 lines (38 loc) · 1002 Bytes
/
codegemrc.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
34
35
36
37
38
39
40
41
42
// import { defineConfig } from "./src/mod";
function loadFile(url: string) {
return async () => {
return url;
};
}
function pluginTest() {
return {
name: 'test',
generatedHook: async (files) => {
files[0].code = 'generatedHook-test';
return files;
},
};
}
function createIcon(
type: 'ts' | 'js',
): (source: any[]) => { pathname: string; code: string }[] {
return (source: any[]) => [{ pathname: `hello.${type}`, code: source[0] }];
}
export default {
output: 'example/generated', // 根目录;所有生成文件统一生成在这个目录下
factory: [
{
name: 'test1',
use: [loadFile('http://www.test.json')],
machine: createIcon('js'),
output: 'example/generated/test1', // 优先级 > root output
},
{
name: 'test2',
use: [loadFile('http://www.test2.json')],
machine: createIcon('js'),
output: 'example/generated/test2', // 优先级 > root output
},
],
plugin: [pluginTest()],
};