file-lane 2.0.2-beta.1 → 2.0.2-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/FileLane.js +12 -2
- package/lib/interface/IFileLaneConfig.d.ts +19 -10
- package/package.json +6 -4
package/lib/FileLane.js
CHANGED
|
@@ -152,8 +152,10 @@ class FileLane {
|
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
catch (error) {
|
|
155
|
-
console.log('error', error);
|
|
155
|
+
console.log('FileLane error', error);
|
|
156
156
|
ColorConsole_1.default.throw(`ERROR: build error, ${error || 'unknown error'}`);
|
|
157
|
+
// 结束任务
|
|
158
|
+
process.exit();
|
|
157
159
|
}
|
|
158
160
|
});
|
|
159
161
|
}
|
|
@@ -276,7 +278,15 @@ class FileLane {
|
|
|
276
278
|
const { followWorks } = this.config;
|
|
277
279
|
if (followWorks) {
|
|
278
280
|
for (let item of followWorks) {
|
|
279
|
-
|
|
281
|
+
try {
|
|
282
|
+
ColorConsole_1.default.info(`FollowWork: ${item.workerDescribe} start`);
|
|
283
|
+
yield item.worker(this.context, this.config, this.compilerOption);
|
|
284
|
+
ColorConsole_1.default.info(`FollowWork: ${item.workerDescribe} end`);
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
ColorConsole_1.default.throw(`FollowWork: ${item.workerDescribe} error, ${error}`);
|
|
288
|
+
process.exit();
|
|
289
|
+
}
|
|
280
290
|
}
|
|
281
291
|
}
|
|
282
292
|
});
|
|
@@ -5,6 +5,18 @@ import IPlugin from './IPlugin';
|
|
|
5
5
|
export type ILoaderClass = (new (...args: any[]) => ILoader) & {
|
|
6
6
|
raw?: boolean;
|
|
7
7
|
};
|
|
8
|
+
export interface IRule {
|
|
9
|
+
/**
|
|
10
|
+
* 配置文件
|
|
11
|
+
*/
|
|
12
|
+
test: MatchType;
|
|
13
|
+
/**
|
|
14
|
+
* 文件的 Loader,从前向后依次执行,前一个 loader 结果做为后一个 loader 的入参
|
|
15
|
+
*/
|
|
16
|
+
loader: ILoaderClass[];
|
|
17
|
+
exclude?: MatchType;
|
|
18
|
+
include?: MatchType;
|
|
19
|
+
}
|
|
8
20
|
/**
|
|
9
21
|
* IFileLaneConfig
|
|
10
22
|
*/
|
|
@@ -45,15 +57,7 @@ export default interface IFileLaneConfig<O = any> {
|
|
|
45
57
|
/**
|
|
46
58
|
* 转换规则
|
|
47
59
|
*/
|
|
48
|
-
rules:
|
|
49
|
-
/**
|
|
50
|
-
* 配置文件
|
|
51
|
-
*/
|
|
52
|
-
test: MatchType;
|
|
53
|
-
loader: ILoaderClass[];
|
|
54
|
-
exclude?: MatchType;
|
|
55
|
-
include?: MatchType;
|
|
56
|
-
}[];
|
|
60
|
+
rules: IRule[];
|
|
57
61
|
};
|
|
58
62
|
/**
|
|
59
63
|
* 插件
|
|
@@ -78,11 +82,16 @@ export default interface IFileLaneConfig<O = any> {
|
|
|
78
82
|
* ux--[webpack, zip]
|
|
79
83
|
* uxInspect--[webpack, zipPhone, zipWatch, zipTv]
|
|
80
84
|
*/
|
|
81
|
-
followWorks?:
|
|
85
|
+
followWorks?: FollowWoker<O>[];
|
|
82
86
|
/**
|
|
83
87
|
* 配置watch时忽略的文件或者文件夹
|
|
84
88
|
*/
|
|
85
89
|
watchIgnores?: MatchType;
|
|
86
90
|
}
|
|
91
|
+
type FollowWoker<O> = {
|
|
92
|
+
worker: FollowWork<O>;
|
|
93
|
+
workerDescribe?: string;
|
|
94
|
+
};
|
|
87
95
|
export type FollowWork<O = any> = (context: IFileLaneContext, config?: IFileLaneConfig, compilerOption?: O) => Promise<any>;
|
|
88
96
|
export type PreWork<O = any> = (context: IFileLaneContext, fileList: string[], config: IFileLaneConfig, compilerOption?: O) => Promise<any>;
|
|
97
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-lane",
|
|
3
|
-
"version": "2.0.2-beta.
|
|
3
|
+
"version": "2.0.2-beta.10",
|
|
4
4
|
"description": "File conversion tool, can be one-to-one, one to N, N to one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"file",
|
|
@@ -20,13 +20,15 @@
|
|
|
20
20
|
"test": "node ./__tests__/file-lane.test.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aiot-toolkit/shared-utils": "2.0.2-beta.
|
|
23
|
+
"@aiot-toolkit/shared-utils": "2.0.2-beta.10",
|
|
24
24
|
"archiver": "^6.0.1",
|
|
25
25
|
"chokidar": "^3.5.3",
|
|
26
26
|
"lodash": "^4.17.21"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/archiver": "^5.3.2"
|
|
29
|
+
"@types/archiver": "^5.3.2",
|
|
30
|
+
"@types/fs-extra": "^11.0.4",
|
|
31
|
+
"fs-extra": "^11.2.0"
|
|
30
32
|
},
|
|
31
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "00d23c1ad1306a6c72bb007685de9fd4a6ee61af"
|
|
32
34
|
}
|