cloudcc-cli 1.5.0 → 1.5.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 +9 -1
- package/bin/buildtag.js +1 -1
- package/bin/createPlugin.js +7 -0
- package/bin/publishh5.js +1 -1
- package/package.json +2 -1
- package/src/builderCreate.js +86 -0
- package/template/packagejson +5 -3
package/README.md
CHANGED
package/bin/buildtag.js
CHANGED
package/bin/publishh5.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcc-cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "cloudcc-cli",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudcc",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"bin": {
|
|
13
13
|
"cloudccCreate": "bin/create.js",
|
|
14
14
|
"cloudccBuild": "bin/build.js",
|
|
15
|
+
"cloudccCreatePlugin": "bin/createPlugin.js",
|
|
15
16
|
"cloudccPublic": "bin/publish.js",
|
|
16
17
|
"cloudccPublicH5": "bin/publishh5.js",
|
|
17
18
|
"cloudccBuildCCSDK": "bin/buildccsdk.js",
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const { exec } = require('child_process');
|
|
2
|
+
const { post } = require('../utils/http');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require("path")
|
|
5
|
+
const chalk = require("chalk")
|
|
6
|
+
const inquirer = require("inquirer")
|
|
7
|
+
// 检查cli版本更新功能
|
|
8
|
+
const { checkUpdate } = require("../utils/checkVersion")
|
|
9
|
+
const BaseUrl = "https://developer.apis.cloudcc.cn"
|
|
10
|
+
const axios = require("axios")
|
|
11
|
+
const temp = `<template>
|
|
12
|
+
<div class="cc-container">
|
|
13
|
+
<div>Hello CloudCC</div>
|
|
14
|
+
<div>
|
|
15
|
+
<a href="https://cloudccone.feishu.cn/wiki/JZ7CwcRfriU8taknCKCcwKEmncd">
|
|
16
|
+
开发者文档</a
|
|
17
|
+
>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
componentInfo: {
|
|
27
|
+
// 组件唯一标识,全局唯一
|
|
28
|
+
component: "cloudcc-demo-01",
|
|
29
|
+
// 组件名称,在页面编辑器显示的名字
|
|
30
|
+
compName: "cloudcc-demo-01",
|
|
31
|
+
// 组件描述信息
|
|
32
|
+
compDesc: "组件描述信息",
|
|
33
|
+
},
|
|
34
|
+
isLock: false,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
<style lang="scss" scoped>
|
|
40
|
+
.cc-container {
|
|
41
|
+
text-align: center;
|
|
42
|
+
padding: 8px;
|
|
43
|
+
background: goldenrod;
|
|
44
|
+
}
|
|
45
|
+
</style>`
|
|
46
|
+
/**
|
|
47
|
+
* 创建组件模板文件
|
|
48
|
+
*/
|
|
49
|
+
class Builder {
|
|
50
|
+
constructor() {
|
|
51
|
+
this.options = {
|
|
52
|
+
// 开发配置信息
|
|
53
|
+
devConsoleConfig: {
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
this.plugin = process.argv.splice(2)[0]
|
|
57
|
+
}
|
|
58
|
+
async init() {
|
|
59
|
+
let res = await checkUpdate();
|
|
60
|
+
if (!res) {
|
|
61
|
+
// 获得用户输入
|
|
62
|
+
let answers;
|
|
63
|
+
if (this.plugin) {
|
|
64
|
+
answers = { buildFileName: this.plugin + "/demo.vue" }
|
|
65
|
+
} else {
|
|
66
|
+
answers = await this.ask();
|
|
67
|
+
answers.buildFileName = "./plugin/" + answers.buildFileName
|
|
68
|
+
}
|
|
69
|
+
fs.writeFileSync(answers.buildFileName, temp);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 命令行交互
|
|
74
|
+
* @returns 结果
|
|
75
|
+
*/
|
|
76
|
+
ask() {
|
|
77
|
+
const prompt = [];
|
|
78
|
+
prompt.push({
|
|
79
|
+
type: "input",
|
|
80
|
+
name: "buildFileName",
|
|
81
|
+
message: "请输入文件名,如index.vue",
|
|
82
|
+
})
|
|
83
|
+
return inquirer.prompt(prompt)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
module.exports = Builder;
|
package/template/packagejson
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"description": "cloudcc-plugin-dev",
|
|
5
5
|
"devConsoleConfig": {
|
|
6
|
-
"username": "
|
|
7
|
-
"secretKey": "
|
|
6
|
+
"username": "xxx",
|
|
7
|
+
"secretKey": "xxxxx"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"serve": "vue-cli-service serve"
|
|
10
|
+
"serve": "vue-cli-service serve",
|
|
11
|
+
"build-plugin": "cloudccBuild",
|
|
12
|
+
"build-create-plugin": "cloudccCreatePlugin"
|
|
11
13
|
},
|
|
12
14
|
"dependencies": {
|
|
13
15
|
"element-ui": "2.15.12",
|