aiot-toolkit 2.0.5-beta.11 → 2.0.5-beta.14
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/bin.js +5 -6
- package/package.json +7 -7
- package/lib/builder/XtsBuilder.d.ts +0 -18
- package/lib/builder/XtsBuilder.js +0 -94
- package/lib/starter/XtsStarter.d.ts +0 -9
- package/lib/starter/XtsStarter.js +0 -18
package/lib/bin.js
CHANGED
|
@@ -7,10 +7,8 @@ var _aiotpack = require("@aiot-toolkit/aiotpack");
|
|
|
7
7
|
var _commander = require("@aiot-toolkit/commander");
|
|
8
8
|
var _AndroidUxBuilder = _interopRequireDefault(require("./builder/AndroidUxBuilder"));
|
|
9
9
|
var _VelaUxBuilder = _interopRequireDefault(require("./builder/VelaUxBuilder"));
|
|
10
|
-
var _XtsBuilder = _interopRequireDefault(require("./builder/XtsBuilder"));
|
|
11
10
|
var _AndroidUxStart = _interopRequireDefault(require("./starter/AndroidUxStart"));
|
|
12
11
|
var _VelaUxStarter = _interopRequireDefault(require("./starter/VelaUxStarter"));
|
|
13
|
-
var _XtsStarter = _interopRequireDefault(require("./starter/XtsStarter"));
|
|
14
12
|
var _DeviceUtil = _interopRequireDefault(require("./utils/DeviceUtil"));
|
|
15
13
|
var _VelaAvdUtils = _interopRequireDefault(require("./utils/VelaAvdUtils"));
|
|
16
14
|
var _ZipUtil = _interopRequireDefault(require("@aiot-toolkit/aiotpack/lib/compiler/javascript/vela/utils/ZipUtil"));
|
|
@@ -38,10 +36,6 @@ const projectMapper = {
|
|
|
38
36
|
builder: _VelaUxBuilder.default,
|
|
39
37
|
starter: _VelaUxStarter.default
|
|
40
38
|
},
|
|
41
|
-
[_sharedUtils.ProjectType.VELA_XTS]: {
|
|
42
|
-
builder: _XtsBuilder.default,
|
|
43
|
-
starter: _XtsStarter.default
|
|
44
|
-
},
|
|
45
39
|
[_sharedUtils.ProjectType.ANDDROID_UX]: {
|
|
46
40
|
builder: _AndroidUxBuilder.default,
|
|
47
41
|
starter: _AndroidUxStart.default
|
|
@@ -64,6 +58,11 @@ function build(command, description) {
|
|
|
64
58
|
option.mode = command === 'release' ? _aiotpack.CompileMode.PRODUCTION : _aiotpack.CompileMode.DEVELOPMENT;
|
|
65
59
|
const projectPath = process.cwd();
|
|
66
60
|
await builder.build(projectPath, option);
|
|
61
|
+
if (process.env.TERM_PROGRAM !== 'aiot-ide') {
|
|
62
|
+
_sharedUtils.ColorConsole.warn('please use', {
|
|
63
|
+
word: 'AIoT-IDE: https://iot.mi.com/vela/quickapp/zh/guide/start/use-ide.html'
|
|
64
|
+
});
|
|
65
|
+
}
|
|
67
66
|
} catch (error) {
|
|
68
67
|
_sharedUtils.ColorConsole.error('Build Error:', {
|
|
69
68
|
word: error?.toString() || 'unknown error'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiot-toolkit",
|
|
3
|
-
"version": "2.0.5-beta.
|
|
3
|
+
"version": "2.0.5-beta.14",
|
|
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.5-beta.
|
|
26
|
-
"@aiot-toolkit/commander": "2.0.5-beta.
|
|
27
|
-
"@aiot-toolkit/emulator": "2.0.5-beta.
|
|
28
|
-
"@aiot-toolkit/shared-utils": "2.0.5-beta.
|
|
25
|
+
"@aiot-toolkit/aiotpack": "2.0.5-beta.14",
|
|
26
|
+
"@aiot-toolkit/commander": "2.0.5-beta.14",
|
|
27
|
+
"@aiot-toolkit/emulator": "2.0.5-beta.14",
|
|
28
|
+
"@aiot-toolkit/shared-utils": "2.0.5-beta.14",
|
|
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.5-beta.
|
|
32
|
+
"file-lane": "2.0.5-beta.14",
|
|
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": "63c6564afe9bedd9c034f03e8e457b6cfa6960ae"
|
|
47
47
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IParam } from '@aiot-toolkit/commander';
|
|
2
|
-
import IBuilder from './IBuilder';
|
|
3
|
-
export interface IBuilderOption {
|
|
4
|
-
watch?: boolean;
|
|
5
|
-
skip?: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* XtsBuilder
|
|
9
|
-
*/
|
|
10
|
-
declare class XtsBuilder implements IBuilder<IBuilderOption> {
|
|
11
|
-
static readonly PROJECT_TYPE = "xts quick app";
|
|
12
|
-
private fileLane?;
|
|
13
|
-
match(projectPath: string): boolean;
|
|
14
|
-
build(projectPath: string, options: IBuilderOption): Promise<void>;
|
|
15
|
-
dispose(): Promise<void>;
|
|
16
|
-
readonly params: IParam[];
|
|
17
|
-
}
|
|
18
|
-
export default XtsBuilder;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _aiotpack = require("@aiot-toolkit/aiotpack");
|
|
8
|
-
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
9
|
-
var _fileLane = require("file-lane");
|
|
10
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
-
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
/**
|
|
14
|
-
* XtsBuilder
|
|
15
|
-
*/
|
|
16
|
-
class XtsBuilder {
|
|
17
|
-
static PROJECT_TYPE = 'xts quick app';
|
|
18
|
-
match(projectPath) {
|
|
19
|
-
// app/app.xts 存在视为xts项目
|
|
20
|
-
return _fs.default.existsSync(_path.default.resolve(projectPath, 'app/app.xts'));
|
|
21
|
-
}
|
|
22
|
-
async build(projectPath, options) {
|
|
23
|
-
if (this.fileLane) {
|
|
24
|
-
// 已经在运行中,请先停止
|
|
25
|
-
throw new Error('already running, please stop first: builder.stop()');
|
|
26
|
-
}
|
|
27
|
-
const watch = options.watch || false;
|
|
28
|
-
_sharedUtils.ColorConsole.success('Start build...\n', {
|
|
29
|
-
word: 'ProjectPath: ',
|
|
30
|
-
style: _sharedUtils.ColorConsole.getStyle(_sharedUtils.Loglevel.SUCCESS)
|
|
31
|
-
}, projectPath, '\n', {
|
|
32
|
-
word: 'buildOptions: ',
|
|
33
|
-
style: _sharedUtils.ColorConsole.getStyle(_sharedUtils.Loglevel.SUCCESS)
|
|
34
|
-
}, JSON.stringify(options));
|
|
35
|
-
const compilerOptions = {
|
|
36
|
-
skip: _sharedUtils.StringUtil.string2arrayByComma(options.skip)
|
|
37
|
-
};
|
|
38
|
-
const config = new _aiotpack.XtsConfig(projectPath);
|
|
39
|
-
if (compilerOptions.skip?.includes('xts2ts')) {
|
|
40
|
-
_sharedUtils.ColorConsole.info("### skip compile xts to ts due to --skip ${compilerOptions?.skip.join(',')}");
|
|
41
|
-
const context = _fileLane.FileLaneUtil.createContext(config.output, projectPath);
|
|
42
|
-
const preWorks = config.beforeCompile || [];
|
|
43
|
-
for (let item of preWorks) {
|
|
44
|
-
try {
|
|
45
|
-
await item({
|
|
46
|
-
context,
|
|
47
|
-
config,
|
|
48
|
-
compilerOption: compilerOptions
|
|
49
|
-
});
|
|
50
|
-
} catch (error) {
|
|
51
|
-
// 报错 prework的item error
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const follWorks = config.afterCompile || [];
|
|
55
|
-
for (let item of follWorks) {
|
|
56
|
-
try {
|
|
57
|
-
await item.worker({
|
|
58
|
-
context,
|
|
59
|
-
config,
|
|
60
|
-
compilerOption: compilerOptions
|
|
61
|
-
});
|
|
62
|
-
} catch (error) {
|
|
63
|
-
// 报错 prework的item error
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
this.fileLane = new _fileLane.FileLane(config, projectPath, compilerOptions);
|
|
68
|
-
this.fileLane.start({
|
|
69
|
-
watch
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
async dispose() {
|
|
74
|
-
await this.fileLane?.dispose();
|
|
75
|
-
this.fileLane = undefined;
|
|
76
|
-
}
|
|
77
|
-
params = (() => [{
|
|
78
|
-
name: 'skip',
|
|
79
|
-
type: 'string',
|
|
80
|
-
description: `Can configure skip steps, comma separated, optional values: ${_aiotpack.skipList.join(',')}`,
|
|
81
|
-
validate(value) {
|
|
82
|
-
// TODO: validate 不起作用
|
|
83
|
-
const res = _sharedUtils.StringUtil.string2arrayByComma(value);
|
|
84
|
-
const unValid = res.find(r => {
|
|
85
|
-
return !_aiotpack.skipList.includes(r);
|
|
86
|
-
});
|
|
87
|
-
if (unValid) {
|
|
88
|
-
return `${unValid} is unvalidate, validate value are ${_aiotpack.skipList.join(',')}, Multiple values separated by commas`;
|
|
89
|
-
}
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
}])();
|
|
93
|
-
}
|
|
94
|
-
var _default = exports.default = XtsBuilder;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IParam } from '@aiot-toolkit/commander';
|
|
2
|
-
import XtsBuilder from '../builder/XtsBuilder';
|
|
3
|
-
import IStarter from './IStarter';
|
|
4
|
-
declare class XtsStarter extends IStarter {
|
|
5
|
-
builder: XtsBuilder;
|
|
6
|
-
params: IParam[];
|
|
7
|
-
start(projectPath: string, options: any): void;
|
|
8
|
-
}
|
|
9
|
-
export default XtsStarter;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _XtsBuilder = _interopRequireDefault(require("../builder/XtsBuilder"));
|
|
8
|
-
var _IStarter = _interopRequireDefault(require("./IStarter"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
class XtsStarter extends _IStarter.default {
|
|
11
|
-
builder = (() => new _XtsBuilder.default())();
|
|
12
|
-
params = [];
|
|
13
|
-
start(projectPath, options) {
|
|
14
|
-
console.log(projectPath, options);
|
|
15
|
-
throw new Error('Method not implemented.');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
var _default = exports.default = XtsStarter;
|