@aiot-toolkit/aiotpack 2.0.3 → 2.0.4-beta.2

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.
@@ -172,13 +172,48 @@ class UxAfterCompile {
172
172
  if (!content.packageInfo) {
173
173
  content.packageInfo = _ZipUtil.default.createComment(compilerOption);
174
174
  }
175
- if (completeFeature && translateCache?.featureCache.size) {
175
+
176
+ // feature
177
+ if (translateCache?.featureCache.size) {
178
+ // 消息提示
179
+ // 1. 获取未手动配置的 feature
180
+ // 2. 如果开启自动填充,则 info;否则 warn
176
181
  const featureSet = new Set([...Array.from(translateCache.featureCache), ...(content.features || []).map(item => item.name)]);
177
- content.features = Array.from(featureSet).map(item => {
178
- return {
179
- name: item
182
+ const usedList = Array.from(featureSet).filter(Boolean);
183
+ const unSetList = usedList.filter(featureItem => !content.features?.find(item => item.name === featureItem));
184
+ if (unSetList?.length) {
185
+ const featureMessage = {
186
+ word: `\n${JSON.stringify(unSetList.map(item => ({
187
+ name: item
188
+ })), undefined, 2)}`,
189
+ style: _sharedUtils.ColorConsole.getStyle(_sharedUtils.Loglevel.INFO)
180
190
  };
181
- });
191
+ if (completeFeature) {
192
+ _sharedUtils.ColorConsole.logger({
193
+ level: _sharedUtils.Loglevel.WARN,
194
+ message: [`missing feature (will auto set in rpk):`, featureMessage, {
195
+ word: '\n\nplease copy to `src/manifest.json`'
196
+ }]
197
+ });
198
+ } else {
199
+ _sharedUtils.ColorConsole.logger({
200
+ level: _sharedUtils.Loglevel.THROW,
201
+ message: [`missing feature:`, featureMessage, `\n\nthere are tow ways to set`, {
202
+ word: ['copy to `src/manifest.json`', 'add build option `--complete-feature`'].map((item, index) => `\n${index + 1}. ${item}`).join('')
203
+ }]
204
+ });
205
+ throw new Error(`missing feature`);
206
+ }
207
+ }
208
+
209
+ // 填充feature
210
+ if (completeFeature) {
211
+ content.features = usedList.map(item => {
212
+ return {
213
+ name: item
214
+ };
215
+ });
216
+ }
182
217
  }
183
218
  _fsExtra.default.writeJSONSync(_path.default.join(projectPath, outputPath, _UxFileUtils.default.CONFIG_FILE_NAME), content, {
184
219
  spaces: 2
@@ -314,7 +349,7 @@ class UxAfterCompile {
314
349
  return;
315
350
  }
316
351
  try {
317
- const foldList = ['node_modules'];
352
+ const foldList = ['node_modules', '.git'];
318
353
  foldList.forEach(item => {
319
354
  const sourcePath = _path.default.join(context.projectPath, item);
320
355
  const targetPath = _path.default.join(compilerOption.projectPath, item);
@@ -127,7 +127,13 @@ class JavascriptCompiler {
127
127
  if (configurator.hook) {
128
128
  configurator.hook(result);
129
129
  }
130
- return _lodash.default.merge({}, result, quickAppConfig?.webpack);
130
+
131
+ // 数组,则全部数组(默认合并数组中相同序号的项)
132
+ return _lodash.default.mergeWith({}, result, quickAppConfig?.webpack, (source, target) => {
133
+ if (Array.isArray(target) && Array.isArray(source)) {
134
+ return [...target, ...source];
135
+ }
136
+ });
131
137
  }
132
138
  getConfigurator(param) {
133
139
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/aiotpack",
3
- "version": "2.0.3",
3
+ "version": "2.0.4-beta.2",
4
4
  "description": "The process tool for packaging aiot projects.",
5
5
  "keywords": [
6
6
  "aiotpack"
@@ -19,16 +19,16 @@
19
19
  "test": "node ./__tests__/aiotpack.test.js"
20
20
  },
21
21
  "dependencies": {
22
- "@aiot-toolkit/generator": "2.0.3",
23
- "@aiot-toolkit/parser": "2.0.3",
24
- "@aiot-toolkit/shared-utils": "2.0.3",
22
+ "@aiot-toolkit/generator": "2.0.4-beta.2",
23
+ "@aiot-toolkit/parser": "2.0.4-beta.2",
24
+ "@aiot-toolkit/shared-utils": "2.0.4-beta.2",
25
25
  "@hap-toolkit/aaptjs": "^2.0.0",
26
- "@rspack/core": "^1.0.0",
26
+ "@rspack/core": "^1.1.8",
27
27
  "aiot-parse5": "^1.0.0",
28
28
  "archiver": "^7.0.1",
29
29
  "babel-loader": "^9.1.3",
30
30
  "fast-glob": "^3.3.2",
31
- "file-lane": "2.0.3",
31
+ "file-lane": "2.0.4-beta.2",
32
32
  "file-loader": "^6.2.0",
33
33
  "fs-extra": "^11.2.0",
34
34
  "jsrsasign": "^11.1.0",
@@ -36,6 +36,7 @@
36
36
  "lodash": "^4.17.21",
37
37
  "ts-morph": "^19.0.0",
38
38
  "url-loader": "^4.1.1",
39
+ "webpack": "^5.97.1",
39
40
  "webpack-bundle-analyzer": "^4.10.2",
40
41
  "webpack-sources": "^3.2.3"
41
42
  },
@@ -45,5 +46,5 @@
45
46
  "@types/jsrsasign": "^10.5.12",
46
47
  "@types/webpack-sources": "^3.2.3"
47
48
  },
48
- "gitHead": "e29e61eb89c2559eb9f3a18c51fd5ce4c4196cc2"
49
+ "gitHead": "e9015685f29790709c420a9f8c41ade936a85300"
49
50
  }