create-aiot 2.0.5-beta.13 → 2.0.5-beta.15
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 +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -44
- package/lib/template/template.json +0 -10
- package/lib/utils/TemplateUtil.js +1 -5
- package/package.json +4 -4
- package/lib/template/xts/app-package-name/_gitignore +0 -4
- package/lib/template/xts/app-package-name/app/app.xts +0 -17
- package/lib/template/xts/app-package-name/app/manifest.json +0 -68
- package/lib/template/xts/app-package-name/app/resources/icon.png +0 -0
- package/lib/template/xts/aspect1/config.json +0 -8
- package/lib/template/xts/aspect1/src/aspect.xts +0 -17
- package/lib/template/xts/aspect1/src/manifest.json +0 -21
- package/lib/template/xts/aspect1/src/pages/Home.xts +0 -35
- package/lib/template/xts/aspect1/src/resources/logo.png +0 -0
- package/lib/utils/xts/XtsTemplateUtil.d.ts +0 -9
- package/lib/utils/xts/XtsTemplateUtil.js +0 -42
package/lib/bin.js
CHANGED
|
@@ -20,7 +20,7 @@ async function main() {
|
|
|
20
20
|
name: 'create-aiot',
|
|
21
21
|
description: 'create aiot project',
|
|
22
22
|
version: require('../package.json').version,
|
|
23
|
-
commandList: [await (0, _.
|
|
23
|
+
commandList: [await (0, _.getUxCreateCommand)()]
|
|
24
24
|
};
|
|
25
25
|
_commander.Command.registeProgram(config);
|
|
26
26
|
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getCrerateXtsCommand = getCrerateXtsCommand;
|
|
7
6
|
exports.getUxCreateCommand = getUxCreateCommand;
|
|
8
7
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
9
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
@@ -83,47 +82,4 @@ async function getUxCreateCommand() {
|
|
|
83
82
|
createAction(option, 'ux');
|
|
84
83
|
}
|
|
85
84
|
};
|
|
86
|
-
}
|
|
87
|
-
async function getCrerateXtsCommand() {
|
|
88
|
-
const templateList = await _TemplateUtil.default.requestTemplateList('xts');
|
|
89
|
-
return {
|
|
90
|
-
name: 'xts',
|
|
91
|
-
description: 'create xts template project',
|
|
92
|
-
paramList: [{
|
|
93
|
-
name: 'template',
|
|
94
|
-
description: 'prject template',
|
|
95
|
-
type: 'select',
|
|
96
|
-
enableInquirer: true,
|
|
97
|
-
choices: templateList.map(item => {
|
|
98
|
-
return {
|
|
99
|
-
value: item.name,
|
|
100
|
-
description: item.description
|
|
101
|
-
};
|
|
102
|
-
})
|
|
103
|
-
}, {
|
|
104
|
-
name: 'name',
|
|
105
|
-
description: 'poject name',
|
|
106
|
-
enableInquirer: true,
|
|
107
|
-
defaultValue: 'xts-project',
|
|
108
|
-
type: 'string',
|
|
109
|
-
validate(value) {
|
|
110
|
-
return _TemplateUtil.default.validateProjectName(value);
|
|
111
|
-
}
|
|
112
|
-
}, {
|
|
113
|
-
name: 'packageName',
|
|
114
|
-
description: 'package name',
|
|
115
|
-
enableInquirer: true,
|
|
116
|
-
defaultValue: 'xts.app.test',
|
|
117
|
-
type: 'string'
|
|
118
|
-
}, {
|
|
119
|
-
name: 'aspect',
|
|
120
|
-
type: 'string',
|
|
121
|
-
defaultValue: 'aspect1',
|
|
122
|
-
description: 'Do you need to create some aspect, with multiple aspect names separated by commas',
|
|
123
|
-
enableInquirer: true
|
|
124
|
-
}],
|
|
125
|
-
action: option => {
|
|
126
|
-
createAction(option, 'xts');
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
85
|
}
|
|
@@ -9,7 +9,6 @@ var _prompts = require("@inquirer/prompts");
|
|
|
9
9
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
|
11
11
|
var _Common = _interopRequireDefault(require("./Common"));
|
|
12
|
-
var _XtsTemplateUtil = _interopRequireDefault(require("./xts/XtsTemplateUtil"));
|
|
13
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
const json = require('../template/template.json');
|
|
15
14
|
/**
|
|
@@ -62,8 +61,7 @@ class TemplateUtil {
|
|
|
62
61
|
cwd) {
|
|
63
62
|
const {
|
|
64
63
|
name,
|
|
65
|
-
template
|
|
66
|
-
aspect
|
|
64
|
+
template
|
|
67
65
|
} = param;
|
|
68
66
|
const usedCwd = cwd || process.cwd();
|
|
69
67
|
|
|
@@ -104,8 +102,6 @@ class TemplateUtil {
|
|
|
104
102
|
keywords['data']['toolkitVersion'] = require('../../package.json').version;
|
|
105
103
|
_Common.default.performReplace(keywords, projectAbsolutePath);
|
|
106
104
|
}
|
|
107
|
-
// xts项目-处理aspect内容
|
|
108
|
-
aspect && _XtsTemplateUtil.default.createAspect(projectAbsolutePath, aspect);
|
|
109
105
|
|
|
110
106
|
// 执行插件
|
|
111
107
|
if (plugins) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-aiot",
|
|
3
|
-
"version": "2.0.5-beta.
|
|
3
|
+
"version": "2.0.5-beta.15",
|
|
4
4
|
"description": "An easy way to start aiot project",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"test": "node ./__tests__/create-aiot.test.js"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@aiot-toolkit/commander": "2.0.5-beta.
|
|
27
|
-
"@aiot-toolkit/shared-utils": "2.0.5-beta.
|
|
26
|
+
"@aiot-toolkit/commander": "2.0.5-beta.15",
|
|
27
|
+
"@aiot-toolkit/shared-utils": "2.0.5-beta.15",
|
|
28
28
|
"@inquirer/prompts": "^3.0.3",
|
|
29
29
|
"fs-extra": "^11.2.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/fs-extra": "^11.0.4"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "6e39bae7f788a36a777e08545d862b87fab26a9b"
|
|
35
35
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
app MainApp {
|
|
2
|
-
onCreate(intent: RouteInfo) {
|
|
3
|
-
console.log('App onCreate.')
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
onForeground() {
|
|
7
|
-
console.log('App onForeground.')
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
onBackground() {
|
|
11
|
-
console.log('App onBackground.')
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
onDestroy() {
|
|
15
|
-
console.log('App onDestroy.')
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"package": "{{packageName}}",
|
|
3
|
-
"name": "{{appName}}",
|
|
4
|
-
"icon": "/$app_resource/icon.png",
|
|
5
|
-
"versionName": "1.0.0",
|
|
6
|
-
"versionCode": 1,
|
|
7
|
-
"minPlatformVersion": 1000,
|
|
8
|
-
"features": [
|
|
9
|
-
{
|
|
10
|
-
"name": "system.shortcut"
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"config": {
|
|
14
|
-
"logLevel": "log",
|
|
15
|
-
"network": {
|
|
16
|
-
"connectTimeout": 10000,
|
|
17
|
-
"readTimeout": 10000,
|
|
18
|
-
"writeTimeout": 10000
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"display": {
|
|
22
|
-
"backgroundColor": "#ffffff",
|
|
23
|
-
"fullScreen": false,
|
|
24
|
-
"titleBar": true,
|
|
25
|
-
"titleBarBackgroundColor": "#000000",
|
|
26
|
-
"titleBarTextColor": "#fffff",
|
|
27
|
-
"statusBarImmersive": false,
|
|
28
|
-
"statusBarTextStyle": "auto",
|
|
29
|
-
"statusBarBackgroundColor": "#000000",
|
|
30
|
-
"themeMode": -1
|
|
31
|
-
},
|
|
32
|
-
"trustedSslDomains": ["www.quickapp.cn", "m.quickapp.cn"],
|
|
33
|
-
"router": {
|
|
34
|
-
"aspects": {
|
|
35
|
-
"home": [
|
|
36
|
-
{
|
|
37
|
-
"path": "aspect1",
|
|
38
|
-
"devices": ["phone", "pad"],
|
|
39
|
-
"autoStart": true
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"rules": {
|
|
45
|
-
"screenRule1": {
|
|
46
|
-
"screenWidth": {
|
|
47
|
-
"operator": "include",
|
|
48
|
-
"values": ["100", "200"]
|
|
49
|
-
},
|
|
50
|
-
"screenShape": {
|
|
51
|
-
"operator": "include",
|
|
52
|
-
"values": ["rect"]
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
"screenRule2": {
|
|
56
|
-
"screenWidth": {
|
|
57
|
-
"operator": "exclude",
|
|
58
|
-
"values": ["800", "400"]
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"circleRule": {
|
|
62
|
-
"screenShape": {
|
|
63
|
-
"operator": "include",
|
|
64
|
-
"values": ["circle"]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
Binary file
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
vaspect MainAspect {
|
|
2
|
-
onCreate(intent: RouteInfo) {
|
|
3
|
-
console.log('MainAspect onCreate.')
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
onShow() {
|
|
7
|
-
console.log('MainAspect onShow.')
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
onHide() {
|
|
11
|
-
console.log('MainAspect onHide.')
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
onDestroy() {
|
|
15
|
-
console.log('MainAspect onDestroy.')
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{aspectName}}",
|
|
3
|
-
"versionName": "1.9.1",
|
|
4
|
-
"versionCode": 10900001,
|
|
5
|
-
"description": "主模块",
|
|
6
|
-
"icon": "$file:logo.png",
|
|
7
|
-
"logLevel": "log",
|
|
8
|
-
"router": {
|
|
9
|
-
"entry": "Home",
|
|
10
|
-
"pages": {
|
|
11
|
-
"Home": {
|
|
12
|
-
"path": "pages/Home"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"features": [
|
|
17
|
-
{
|
|
18
|
-
"name": "system.shortcut"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
@Main
|
|
2
|
-
component Home {
|
|
3
|
-
@State message: string = 'Hello World'
|
|
4
|
-
|
|
5
|
-
onShow() {
|
|
6
|
-
console.log('home--onShow')
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
render() {
|
|
10
|
-
Row() {
|
|
11
|
-
Column() {
|
|
12
|
-
Text(this.message)
|
|
13
|
-
.color('#000000')
|
|
14
|
-
.fontSize('15px')
|
|
15
|
-
.fontWeight('bold')
|
|
16
|
-
Button('click')
|
|
17
|
-
.width('220px')
|
|
18
|
-
.height('80px')
|
|
19
|
-
.marginTop('20px')
|
|
20
|
-
.onClick((params?: PlainObject) => {
|
|
21
|
-
this.changeMessage()
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
.width('100%')
|
|
25
|
-
.alignItems('center')
|
|
26
|
-
.justifyContent('center')
|
|
27
|
-
}
|
|
28
|
-
.height('100%')
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
changeMessage() {
|
|
32
|
-
this.setState({ message: 'Hello Tomorrow' })
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
Binary file
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
9
|
-
var _Common = _interopRequireDefault(require("../Common"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
class XtsTemplateUtil {
|
|
12
|
-
/**
|
|
13
|
-
* xts项目-处理aspect内容
|
|
14
|
-
* @param projectAbsolutePath
|
|
15
|
-
* @param aspect
|
|
16
|
-
*/
|
|
17
|
-
static createAspect(projectAbsolutePath, aspect) {
|
|
18
|
-
// 按照逗号分割字符串,且去掉空格
|
|
19
|
-
const aspects = aspect.replace(' ', '').split(',');
|
|
20
|
-
const aspectAbsolutePath = _path.default.join(__dirname, '../../template', 'xts', 'aspect1');
|
|
21
|
-
// 循环生成自定义aspect
|
|
22
|
-
aspects.map(aspectItem => {
|
|
23
|
-
const targetAspectPath = _path.default.join(projectAbsolutePath, aspectItem);
|
|
24
|
-
_fsExtra.default.copySync(aspectAbsolutePath, targetAspectPath);
|
|
25
|
-
// 替换关键字
|
|
26
|
-
_Common.default.performReplace({
|
|
27
|
-
data: {
|
|
28
|
-
aspectName: aspectItem
|
|
29
|
-
},
|
|
30
|
-
includes: path => {
|
|
31
|
-
const stats = _fsExtra.default.statSync(path);
|
|
32
|
-
if (stats.isDirectory()) {
|
|
33
|
-
return ['src'].includes(_path.default.basename(path));
|
|
34
|
-
} else {
|
|
35
|
-
return ['.json', '.ux'].includes(_path.default.extname(path));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}, targetAspectPath);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
var _default = exports.default = XtsTemplateUtil;
|