aiot-toolkit 2.0.5 → 2.0.6-beta.1
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/README.md +20 -0
- package/lib/bin.js +35 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ aiot-toolkit2.0目前支持的打包格式如下:
|
|
|
51
51
|
| aiot createVVD | 创建 vela 模拟器 |
|
|
52
52
|
| aiot deleteVVD | 删除 vela 模拟器 |
|
|
53
53
|
| aiot resign | build目录重新生成rpk, 详情: [resign](#resign) |
|
|
54
|
+
| aiot jsc | js转换为jsc文件, 详情:[jsc](#jsc) |
|
|
54
55
|
|
|
55
56
|
## build 参数
|
|
56
57
|
|
|
@@ -92,3 +93,22 @@ folder
|
|
|
92
93
|
dist // 生成
|
|
93
94
|
***.rpk
|
|
94
95
|
```
|
|
96
|
+
|
|
97
|
+
## jsc
|
|
98
|
+
|
|
99
|
+
指定目录的js文件转换为jsc文件
|
|
100
|
+
|
|
101
|
+
| 参数名 | 类型 | 描述 | 必填 | 默认值 |
|
|
102
|
+
| -------- | ------- | ---------------- | ---- | ------ |
|
|
103
|
+
| path | string | 转换的目录 | 是 | |
|
|
104
|
+
| deletejs | boolean | 是否删除源js文件 | 否 | false |
|
|
105
|
+
|
|
106
|
+
### 删除
|
|
107
|
+
|
|
108
|
+
```shell
|
|
109
|
+
aiot jsc --path=folder
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```shell
|
|
113
|
+
aiot jsc --path=folder --deletejs
|
|
114
|
+
```
|
package/lib/bin.js
CHANGED
|
@@ -13,6 +13,8 @@ var _DeviceUtil = _interopRequireDefault(require("./utils/DeviceUtil"));
|
|
|
13
13
|
var _VelaAvdUtils = _interopRequireDefault(require("./utils/VelaAvdUtils"));
|
|
14
14
|
var _ZipUtil = _interopRequireDefault(require("@aiot-toolkit/aiotpack/lib/compiler/javascript/vela/utils/ZipUtil"));
|
|
15
15
|
var _BuildNameFormatType = _interopRequireDefault(require("@aiot-toolkit/aiotpack/lib/compiler/javascript/vela/enum/BuildNameFormatType"));
|
|
16
|
+
var _Jsc = _interopRequireDefault(require("@aiot-toolkit/aiotpack/lib/compiler/javascript/vela/utils/Jsc"));
|
|
17
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
16
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
19
|
// 支持的最低node版本
|
|
18
20
|
const NODE_MINIMUM_VERSION = '18.0.0';
|
|
@@ -186,8 +188,41 @@ async function main() {
|
|
|
186
188
|
};
|
|
187
189
|
return _ZipUtil.default.createRpk(projectPath + '/build', param);
|
|
188
190
|
}
|
|
191
|
+
}, {
|
|
192
|
+
name: 'jsc',
|
|
193
|
+
description: 'transform js file to jsc file',
|
|
194
|
+
paramList: [{
|
|
195
|
+
name: 'path',
|
|
196
|
+
description: 'source folder'
|
|
197
|
+
}, {
|
|
198
|
+
name: 'deletejs',
|
|
199
|
+
description: 'delete js file after transform',
|
|
200
|
+
type: 'confirm',
|
|
201
|
+
defaultValue: false
|
|
202
|
+
}],
|
|
203
|
+
action: translateJsToJsc
|
|
189
204
|
}]
|
|
190
205
|
};
|
|
191
206
|
_commander.Command.registeProgram(config);
|
|
192
207
|
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* js 文件转换为 jsc 文件
|
|
211
|
+
* @param option
|
|
212
|
+
* @returns
|
|
213
|
+
*/
|
|
214
|
+
function translateJsToJsc(option) {
|
|
215
|
+
const {
|
|
216
|
+
path,
|
|
217
|
+
deletejs
|
|
218
|
+
} = option;
|
|
219
|
+
if (!path) {
|
|
220
|
+
_sharedUtils.ColorConsole.throw('Please provide a valid path for the jsc command.');
|
|
221
|
+
return;
|
|
222
|
+
} else if (!_fs.default.existsSync(path)) {
|
|
223
|
+
_sharedUtils.ColorConsole.throw(`The provided path "${path}" does not exist.`);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
return new _Jsc.default(process.cwd(), path).jsc(deletejs);
|
|
227
|
+
}
|
|
193
228
|
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiot-toolkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6-beta.1",
|
|
4
4
|
"description": "Tools for creating, developing, and packaging aiot applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiot"
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"test": "node ./__tests__/aiot-toolkit.test.js"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@aiot-toolkit/aiotpack": "2.0.
|
|
26
|
-
"@aiot-toolkit/commander": "2.0.
|
|
27
|
-
"@aiot-toolkit/emulator": "2.0.
|
|
28
|
-
"@aiot-toolkit/shared-utils": "2.0.
|
|
25
|
+
"@aiot-toolkit/aiotpack": "2.0.6-beta.1",
|
|
26
|
+
"@aiot-toolkit/commander": "2.0.6-beta.1",
|
|
27
|
+
"@aiot-toolkit/emulator": "2.0.6-beta.1",
|
|
28
|
+
"@aiot-toolkit/shared-utils": "2.0.6-beta.1",
|
|
29
29
|
"@inquirer/prompts": "^5.3.0",
|
|
30
30
|
"@miwt/adb": "^0.9.0",
|
|
31
31
|
"axios": "^1.7.4",
|
|
32
|
-
"file-lane": "2.0.
|
|
32
|
+
"file-lane": "2.0.6-beta.1",
|
|
33
33
|
"fs-extra": "^11.2.0",
|
|
34
34
|
"koa-router": "^13.0.1",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"@types/qr-image": "^3.2.9",
|
|
44
44
|
"@types/semver": "^7.5.8"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "892743ccc51408960e6cee86675538501b3e47f1"
|
|
47
47
|
}
|