create-aiot 2.0.2-beta.17 → 2.0.2-beta.19
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 +26 -26
- package/lib/interface/IProjectParam.d.ts +9 -0
- package/lib/template/template.json +27 -27
- package/lib/template/ux/android-demo/README.md +25 -25
- package/lib/template/ux/android-demo/_gitignore +4 -4
- package/lib/template/ux/android-demo/package.json +17 -17
- package/lib/template/ux/android-demo/src/CardDemo/index.ux +24 -24
- package/lib/template/ux/android-demo/src/Demo/index.ux +48 -48
- package/lib/template/ux/android-demo/src/DemoDetail/index.ux +27 -27
- package/lib/template/ux/android-demo/src/app.ux +14 -14
- package/lib/template/ux/android-demo/src/global.js +34 -34
- package/lib/template/ux/android-demo/src/manifest.json +56 -56
- package/lib/template/ux/android-demo/src/sitemap.json +4 -4
- package/lib/template/ux/vela-demo/README.md +25 -25
- package/lib/template/ux/vela-demo/_gitignore +4 -4
- package/lib/template/ux/vela-demo/package.json +18 -18
- package/lib/template/ux/vela-demo/src/app.ux +9 -9
- package/lib/template/ux/vela-demo/src/manifest.json +31 -31
- package/lib/template/ux/vela-demo/src/pages/detail/detail.ux +25 -25
- package/lib/template/ux/vela-demo/src/pages/index/index.ux +49 -49
- package/lib/template/xts/app-package-name/_gitignore +3 -3
- package/lib/template/xts/app-package-name/app/app.xts +16 -16
- package/lib/template/xts/app-package-name/app/manifest.json +68 -68
- package/lib/template/xts/aspect1/config.json +8 -8
- package/lib/template/xts/aspect1/src/aspect.xts +16 -16
- package/lib/template/xts/aspect1/src/manifest.json +21 -21
- package/lib/template/xts/aspect1/src/pages/Home.xts +34 -34
- package/lib/utils/TemplateUtil.d.ts +25 -2
- package/lib/utils/TemplateUtil.js +19 -3
- package/package.json +4 -4
|
@@ -1,35 +1,35 @@
|
|
|
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
|
-
|
|
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
35
|
}
|
|
@@ -11,10 +11,33 @@ declare class TemplateUtil {
|
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
13
|
static validateProjectName(value: string): boolean | string;
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* 创建项目
|
|
16
|
+
* @param param
|
|
17
|
+
* @param keywords
|
|
18
|
+
* @param plugins
|
|
19
|
+
* @param cwd
|
|
20
|
+
*/
|
|
21
|
+
static createProject(param: IProjectParam,
|
|
22
|
+
/**
|
|
23
|
+
* 要替换的词语
|
|
24
|
+
*/
|
|
25
|
+
keywords?: {
|
|
26
|
+
/**
|
|
27
|
+
* [原词]:新词
|
|
28
|
+
*/
|
|
15
29
|
data: Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* 是否对 path文件 执行替换操作
|
|
32
|
+
* @param path
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
16
35
|
includes?: (path: string) => boolean;
|
|
17
|
-
}, plugins?: ((projectPath: string, param: IProjectParam) => Promise<void>)[]
|
|
36
|
+
}, plugins?: ((projectPath: string, param: IProjectParam) => Promise<void>)[],
|
|
37
|
+
/**
|
|
38
|
+
* 项目根目录,默认为 process.cwd()
|
|
39
|
+
*/
|
|
40
|
+
cwd?: string): Promise<void>;
|
|
18
41
|
/**
|
|
19
42
|
* 修改_gitignore为.gitignore
|
|
20
43
|
*/
|
|
@@ -48,19 +48,35 @@ class TemplateUtil {
|
|
|
48
48
|
}
|
|
49
49
|
return true;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* 创建项目
|
|
53
|
+
* @param param
|
|
54
|
+
* @param keywords
|
|
55
|
+
* @param plugins
|
|
56
|
+
* @param cwd
|
|
57
|
+
*/
|
|
58
|
+
static createProject(param,
|
|
59
|
+
/**
|
|
60
|
+
* 要替换的词语
|
|
61
|
+
*/
|
|
62
|
+
keywords, plugins,
|
|
63
|
+
/**
|
|
64
|
+
* 项目根目录,默认为 process.cwd()
|
|
65
|
+
*/
|
|
66
|
+
cwd) {
|
|
52
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
68
|
const { name, template, aspect } = param;
|
|
69
|
+
const usedCwd = cwd || process.cwd();
|
|
54
70
|
// 获取项目名称和绝对路径,如果存在,则再次输入
|
|
55
71
|
let projectName = name;
|
|
56
|
-
let projectAbsolutePath = path_1.default.join(
|
|
72
|
+
let projectAbsolutePath = path_1.default.join(usedCwd, projectName);
|
|
57
73
|
while (fs_extra_1.default.existsSync(projectAbsolutePath)) {
|
|
58
74
|
shared_utils_1.ColorConsole.warn(`${projectAbsolutePath} exists. `);
|
|
59
75
|
projectName = yield (0, prompts_1.input)({
|
|
60
76
|
message: 'please new project name',
|
|
61
77
|
validate: this.validateProjectName
|
|
62
78
|
});
|
|
63
|
-
projectAbsolutePath = path_1.default.join(
|
|
79
|
+
projectAbsolutePath = path_1.default.join(usedCwd, projectName);
|
|
64
80
|
}
|
|
65
81
|
fs_extra_1.default.mkdirSync(projectAbsolutePath);
|
|
66
82
|
// 复制模板
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-aiot",
|
|
3
|
-
"version": "2.0.2-beta.
|
|
3
|
+
"version": "2.0.2-beta.19",
|
|
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.2-beta.
|
|
27
|
-
"@aiot-toolkit/shared-utils": "2.0.2-beta.
|
|
26
|
+
"@aiot-toolkit/commander": "2.0.2-beta.19",
|
|
27
|
+
"@aiot-toolkit/shared-utils": "2.0.2-beta.19",
|
|
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": "7c6ed600fe84ee9de9b00c6e95dfabf3bfb3ad65"
|
|
35
35
|
}
|