cloudcc-cli 1.6.0 → 1.6.2
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 +1147 -1128
- package/bin/cc.js +48 -48
- package/bin/plugin.js +5 -5
- package/bin/project.js +5 -5
- package/package.json +34 -34
- package/src/classes/create.js +43 -43
- package/src/classes/index.js +8 -8
- package/src/classes/publish.js +48 -47
- package/src/config/get.js +22 -0
- package/src/config/index.js +8 -0
- package/src/config/use.js +16 -0
- package/src/object/get.js +16 -0
- package/src/object/index.js +7 -0
- package/src/plugin/create.js +80 -80
- package/src/plugin/create1.js +66 -67
- package/src/plugin/index.js +8 -8
- package/src/plugin/publish.js +298 -305
- package/src/plugin/publish1.js +286 -293
- package/src/project/create.js +89 -89
- package/src/project/create1.js +111 -94
- package/src/project/index.js +7 -7
- package/src/recordType/get.js +16 -0
- package/src/recordType/index.js +7 -0
- package/src/script/create.js +33 -0
- package/src/script/index.js +8 -0
- package/src/script/publish.js +69 -0
- package/src/timer/create.js +29 -29
- package/src/timer/index.js +8 -8
- package/src/timer/publish.js +47 -47
- package/src/token/get.js +13 -0
- package/src/token/index.js +7 -0
- package/src/triggers/create.js +35 -35
- package/src/triggers/index.js +8 -8
- package/src/triggers/publish.js +51 -51
- package/template/Appvue +29 -29
- package/template/babelconfigjs +5 -5
- package/template/cloudcc-cli.configjs +1 -0
- package/template/demojava +14 -14
- package/template/gitignore +11 -0
- package/template/index.js +57 -52
- package/template/indexhtml +21 -21
- package/template/indexvue +34 -34
- package/template/javaconfigjson +2 -2
- package/template/mainjs +13 -13
- package/template/package-lockjson +12115 -12115
- package/template/packagejson +42 -46
- package/template/vueconfigjs +26 -26
- package/utils/checkVersion.js +105 -105
- package/utils/http.js +122 -122
- package/utils/utils.js +54 -44
package/src/timer/publish.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
// 检查cli版本更新功能
|
|
2
|
-
const { checkUpdate } = require("../../utils/checkVersion")
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path")
|
|
5
|
-
const chalk = require("chalk")
|
|
6
|
-
const { postNormal } = require("../../utils/http")
|
|
7
|
-
|
|
8
|
-
const { getBusToken } = require("../../utils/utils")
|
|
9
|
-
/**
|
|
10
|
-
* 发布文件
|
|
11
|
-
* @param {string} name 文件名称
|
|
12
|
-
*/
|
|
13
|
-
async function publish(name) {
|
|
14
|
-
let res = await checkUpdate();
|
|
15
|
-
if (!res) {
|
|
16
|
-
console.log();
|
|
17
|
-
console.log(chalk.green('发布中,请稍后...'));
|
|
18
|
-
console.log();
|
|
19
|
-
const timerPath = path.join(process.cwd(), `timer/${name}/`);
|
|
20
|
-
let classContent = fs.readFileSync(timerPath + `${name}.java`, 'utf8');
|
|
21
|
-
let configContent = JSON.parse(fs.readFileSync(timerPath + "config.json", 'utf8'));
|
|
22
|
-
// 获取token成功后,发布内容
|
|
23
|
-
if (await getBusToken()) {
|
|
24
|
-
let body = {
|
|
25
|
-
"id": configContent.id,
|
|
26
|
-
"name": name,
|
|
27
|
-
"version": configContent.version,
|
|
28
|
-
"source": encodeURI(classContent),
|
|
29
|
-
"folderId": "wgd"
|
|
30
|
-
}
|
|
31
|
-
let url = new URL(global.baseUrl).origin
|
|
32
|
-
let res = await postNormal(url + "/
|
|
33
|
-
if (res.result) {
|
|
34
|
-
console.log(chalk.green('发布成功!'));
|
|
35
|
-
console.log();
|
|
36
|
-
// 组件发布成功后,判断下配置文件是否有id,如果没有,那么将id存储到配置中
|
|
37
|
-
if (!configContent.id) {
|
|
38
|
-
configContent.id = res.data
|
|
39
|
-
fs.writeFileSync(path.join(timerPath, "config.json"), JSON.stringify(configContent))
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
console.log(chalk.red('发布失败:' + res.returnInfo));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
module.exports = publish;
|
|
1
|
+
// 检查cli版本更新功能
|
|
2
|
+
const { checkUpdate } = require("../../utils/checkVersion")
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path")
|
|
5
|
+
const chalk = require("chalk")
|
|
6
|
+
const { postNormal } = require("../../utils/http")
|
|
7
|
+
|
|
8
|
+
const { getBusToken } = require("../../utils/utils")
|
|
9
|
+
/**
|
|
10
|
+
* 发布文件
|
|
11
|
+
* @param {string} name 文件名称
|
|
12
|
+
*/
|
|
13
|
+
async function publish(name) {
|
|
14
|
+
let res = await checkUpdate();
|
|
15
|
+
if (!res) {
|
|
16
|
+
console.log();
|
|
17
|
+
console.log(chalk.green('发布中,请稍后...'));
|
|
18
|
+
console.log();
|
|
19
|
+
const timerPath = path.join(process.cwd(), `timer/${name}/`);
|
|
20
|
+
let classContent = fs.readFileSync(timerPath + `${name}.java`, 'utf8');
|
|
21
|
+
let configContent = JSON.parse(fs.readFileSync(timerPath + "config.json", 'utf8'));
|
|
22
|
+
// 获取token成功后,发布内容
|
|
23
|
+
if (await getBusToken()) {
|
|
24
|
+
let body = {
|
|
25
|
+
"id": configContent.id,
|
|
26
|
+
"name": name,
|
|
27
|
+
"version": configContent.version,
|
|
28
|
+
"source": encodeURI(classContent),
|
|
29
|
+
"folderId": "wgd"
|
|
30
|
+
}
|
|
31
|
+
let url = new URL(global.baseUrl).origin
|
|
32
|
+
let res = await postNormal(url + "/setup/api/ccPeak/save", body)
|
|
33
|
+
if (res.result) {
|
|
34
|
+
console.log(chalk.green('发布成功!'));
|
|
35
|
+
console.log();
|
|
36
|
+
// 组件发布成功后,判断下配置文件是否有id,如果没有,那么将id存储到配置中
|
|
37
|
+
if (!configContent.id) {
|
|
38
|
+
configContent.id = res.data
|
|
39
|
+
fs.writeFileSync(path.join(timerPath, "config.json"), JSON.stringify(configContent))
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
console.log(chalk.red('发布失败:' + res.returnInfo));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
module.exports = publish;
|
package/src/token/get.js
ADDED
package/src/triggers/create.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const { checkUpdate } = require("../../utils/checkVersion")
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const path = require("path")
|
|
4
|
-
const chalk = require("chalk")
|
|
5
|
-
/**
|
|
6
|
-
* 创建文件
|
|
7
|
-
* @param {string} name 文件名称
|
|
8
|
-
*/
|
|
9
|
-
async function create(name) {
|
|
10
|
-
let res = await checkUpdate();
|
|
11
|
-
if (!res) {
|
|
12
|
-
const triggersPath = path.join(process.cwd(), "triggers/" + name);
|
|
13
|
-
try {
|
|
14
|
-
fs.mkdirSync(triggersPath, { recursive: true })
|
|
15
|
-
const javaTmp = `System.out.print("hello CloudCC");`
|
|
16
|
-
fs.writeFileSync(path.join(triggersPath, name + ".java"), javaTmp)
|
|
17
|
-
fs.writeFileSync(path.join(triggersPath, "config.json"),
|
|
18
|
-
`{
|
|
19
|
-
"isactive":false,
|
|
20
|
-
"targetObjectId":"account",
|
|
21
|
-
"triggerTime":"beforeInsert",
|
|
22
|
-
"version":"3"
|
|
23
|
-
}`)
|
|
24
|
-
console.log()
|
|
25
|
-
console.log(chalk.green("创建成功:" + name))
|
|
26
|
-
console.log()
|
|
27
|
-
} catch (e) {
|
|
28
|
-
console.log()
|
|
29
|
-
console.log(chalk.red("创建失败:" + e))
|
|
30
|
-
console.log()
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
module.exports = create;
|
|
1
|
+
const { checkUpdate } = require("../../utils/checkVersion")
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path")
|
|
4
|
+
const chalk = require("chalk")
|
|
5
|
+
/**
|
|
6
|
+
* 创建文件
|
|
7
|
+
* @param {string} name 文件名称
|
|
8
|
+
*/
|
|
9
|
+
async function create(name) {
|
|
10
|
+
let res = await checkUpdate();
|
|
11
|
+
if (!res) {
|
|
12
|
+
const triggersPath = path.join(process.cwd(), "triggers/" + name);
|
|
13
|
+
try {
|
|
14
|
+
fs.mkdirSync(triggersPath, { recursive: true })
|
|
15
|
+
const javaTmp = `System.out.print("hello CloudCC");`
|
|
16
|
+
fs.writeFileSync(path.join(triggersPath, name + ".java"), javaTmp)
|
|
17
|
+
fs.writeFileSync(path.join(triggersPath, "config.json"),
|
|
18
|
+
`{
|
|
19
|
+
"isactive":false,
|
|
20
|
+
"targetObjectId":"account",
|
|
21
|
+
"triggerTime":"beforeInsert",
|
|
22
|
+
"version":"3"
|
|
23
|
+
}`)
|
|
24
|
+
console.log()
|
|
25
|
+
console.log(chalk.green("创建成功:" + name))
|
|
26
|
+
console.log()
|
|
27
|
+
} catch (e) {
|
|
28
|
+
console.log()
|
|
29
|
+
console.log(chalk.red("创建失败:" + e))
|
|
30
|
+
console.log()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = create;
|
package/src/triggers/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const cc = {}
|
|
2
|
-
cc.create = require("./create")
|
|
3
|
-
cc.publish = require("./publish")
|
|
4
|
-
function Classes(action,
|
|
5
|
-
cc[action](
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
module.exports = Classes;
|
|
1
|
+
const cc = {}
|
|
2
|
+
cc.create = require("./create")
|
|
3
|
+
cc.publish = require("./publish")
|
|
4
|
+
function Classes(action, argvs) {
|
|
5
|
+
cc[action](argvs[2])
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
module.exports = Classes;
|
package/src/triggers/publish.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
// 检查cli版本更新功能
|
|
2
|
-
const { checkUpdate } = require("../../utils/checkVersion")
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path")
|
|
5
|
-
const chalk = require("chalk")
|
|
6
|
-
const { postNormal } = require("../../utils/http")
|
|
7
|
-
const { getBusToken } = require("../../utils/utils")
|
|
8
|
-
/**
|
|
9
|
-
* 发布文件
|
|
10
|
-
* @param {string} name 文件名称
|
|
11
|
-
*/
|
|
12
|
-
async function publish(name) {
|
|
13
|
-
let res = await checkUpdate();
|
|
14
|
-
if (!res) {
|
|
15
|
-
console.log();
|
|
16
|
-
console.log(chalk.green('发布中,请稍后...'));
|
|
17
|
-
console.log();
|
|
18
|
-
const triggersPath = path.join(process.cwd(), `triggers/${name}/`);
|
|
19
|
-
let classContent = fs.readFileSync(triggersPath + `${name}.java`, 'utf8');
|
|
20
|
-
let configContent = JSON.parse(fs.readFileSync(triggersPath + "config.json", 'utf8'));
|
|
21
|
-
// 获取token成功后,发布内容
|
|
22
|
-
if (await getBusToken()) {
|
|
23
|
-
let body = {
|
|
24
|
-
"id": configContent.id,
|
|
25
|
-
"apiname": configContent.apiname,
|
|
26
|
-
"isactive": configContent.isactive,
|
|
27
|
-
"targetObjectId": configContent.targetObjectId,
|
|
28
|
-
"triggerTime": configContent.triggerTime,
|
|
29
|
-
"name": name,
|
|
30
|
-
"version": configContent.version,
|
|
31
|
-
"triggerSource": encodeURI(classContent),
|
|
32
|
-
"folderId": "wgd"
|
|
33
|
-
}
|
|
34
|
-
let url = new URL(global.baseUrl).origin
|
|
35
|
-
let res = await postNormal(url + "/
|
|
36
|
-
if (res.result) {
|
|
37
|
-
console.log(chalk.green('发布成功!'));
|
|
38
|
-
console.log();
|
|
39
|
-
// 组件发布成功后,判断下配置文件是否有id,如果没有,那么将id存储到配置中
|
|
40
|
-
if (!configContent.id) {
|
|
41
|
-
configContent.id = res.data.id
|
|
42
|
-
configContent.apiname = res.data.apiname
|
|
43
|
-
fs.writeFileSync(path.join(triggersPath, "config.json"), JSON.stringify(configContent))
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
console.log(chalk.red('发布失败:' + res.returnInfo));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
module.exports = publish;
|
|
1
|
+
// 检查cli版本更新功能
|
|
2
|
+
const { checkUpdate } = require("../../utils/checkVersion")
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path")
|
|
5
|
+
const chalk = require("chalk")
|
|
6
|
+
const { postNormal } = require("../../utils/http")
|
|
7
|
+
const { getBusToken } = require("../../utils/utils")
|
|
8
|
+
/**
|
|
9
|
+
* 发布文件
|
|
10
|
+
* @param {string} name 文件名称
|
|
11
|
+
*/
|
|
12
|
+
async function publish(name) {
|
|
13
|
+
let res = await checkUpdate();
|
|
14
|
+
if (!res) {
|
|
15
|
+
console.log();
|
|
16
|
+
console.log(chalk.green('发布中,请稍后...'));
|
|
17
|
+
console.log();
|
|
18
|
+
const triggersPath = path.join(process.cwd(), `triggers/${name}/`);
|
|
19
|
+
let classContent = fs.readFileSync(triggersPath + `${name}.java`, 'utf8');
|
|
20
|
+
let configContent = JSON.parse(fs.readFileSync(triggersPath + "config.json", 'utf8'));
|
|
21
|
+
// 获取token成功后,发布内容
|
|
22
|
+
if (await getBusToken()) {
|
|
23
|
+
let body = {
|
|
24
|
+
"id": configContent.id,
|
|
25
|
+
"apiname": configContent.apiname,
|
|
26
|
+
"isactive": configContent.isactive,
|
|
27
|
+
"targetObjectId": configContent.targetObjectId,
|
|
28
|
+
"triggerTime": configContent.triggerTime,
|
|
29
|
+
"name": name,
|
|
30
|
+
"version": configContent.version,
|
|
31
|
+
"triggerSource": encodeURI(classContent),
|
|
32
|
+
"folderId": "wgd"
|
|
33
|
+
}
|
|
34
|
+
let url = new URL(global.baseUrl).origin
|
|
35
|
+
let res = await postNormal(url + "/setup/api/triggerSetup/saveTrigger", body)
|
|
36
|
+
if (res.result) {
|
|
37
|
+
console.log(chalk.green('发布成功!'));
|
|
38
|
+
console.log();
|
|
39
|
+
// 组件发布成功后,判断下配置文件是否有id,如果没有,那么将id存储到配置中
|
|
40
|
+
if (!configContent.id) {
|
|
41
|
+
configContent.id = res.data.id
|
|
42
|
+
configContent.apiname = res.data.apiname
|
|
43
|
+
fs.writeFileSync(path.join(triggersPath, "config.json"), JSON.stringify(configContent))
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
console.log(chalk.red('发布失败:' + res.returnInfo));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
module.exports = publish;
|
package/template/Appvue
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="cc-container">
|
|
3
|
-
<div>Hello CloudCC</div>
|
|
4
|
-
<div>
|
|
5
|
-
<a href="https://cloudccone.feishu.cn/wiki/JZ7CwcRfriU8taknCKCcwKEmncd">
|
|
6
|
-
开发者文档</a
|
|
7
|
-
>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
export default {
|
|
14
|
-
name: "App",
|
|
15
|
-
};
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<style lang="scss" scoped>
|
|
19
|
-
html body {
|
|
20
|
-
padding: 0;
|
|
21
|
-
margin: 0;
|
|
22
|
-
height: 100vh;
|
|
23
|
-
width: 100%;
|
|
24
|
-
}
|
|
25
|
-
.cc-container {
|
|
26
|
-
text-align: center;
|
|
27
|
-
padding: 8px;
|
|
28
|
-
background: goldenrod;
|
|
29
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="cc-container">
|
|
3
|
+
<div>Hello CloudCC</div>
|
|
4
|
+
<div>
|
|
5
|
+
<a href="https://cloudccone.feishu.cn/wiki/JZ7CwcRfriU8taknCKCcwKEmncd">
|
|
6
|
+
开发者文档</a
|
|
7
|
+
>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: "App",
|
|
15
|
+
};
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<style lang="scss" scoped>
|
|
19
|
+
html body {
|
|
20
|
+
padding: 0;
|
|
21
|
+
margin: 0;
|
|
22
|
+
height: 100vh;
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
.cc-container {
|
|
26
|
+
text-align: center;
|
|
27
|
+
padding: 8px;
|
|
28
|
+
background: goldenrod;
|
|
29
|
+
}
|
|
30
30
|
</style>
|
package/template/babelconfigjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
presets: [
|
|
3
|
-
'@vue/cli-plugin-babel/preset'
|
|
4
|
-
]
|
|
5
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
presets: [
|
|
3
|
+
'@vue/cli-plugin-babel/preset'
|
|
4
|
+
]
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = { "use": "dev", "dev": { "username": "xxx", "secretKey": "xxx" } }
|
package/template/demojava
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
public class Test{
|
|
2
|
-
private CCServiceV3 cs;
|
|
3
|
-
private UserInfo userInfo;
|
|
4
|
-
|
|
5
|
-
public Test(UserInfo userInfo){
|
|
6
|
-
this.userInfo = userInfo;
|
|
7
|
-
cs = new CCServiceV3(userInfo);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
public String demo(String str){
|
|
12
|
-
str = "demo";
|
|
13
|
-
return str;
|
|
14
|
-
}
|
|
1
|
+
public class Test{
|
|
2
|
+
private CCServiceV3 cs;
|
|
3
|
+
private UserInfo userInfo;
|
|
4
|
+
|
|
5
|
+
public Test(UserInfo userInfo){
|
|
6
|
+
this.userInfo = userInfo;
|
|
7
|
+
cs = new CCServiceV3(userInfo);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
public String demo(String str){
|
|
12
|
+
str = "demo";
|
|
13
|
+
return str;
|
|
14
|
+
}
|
|
15
15
|
}
|
package/template/index.js
CHANGED
|
@@ -1,53 +1,58 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const chalk = require("chalk")
|
|
3
|
-
const path = require("path")
|
|
4
|
-
module.exports = function (creator, options, callback) {
|
|
5
|
-
const { name, description } = options;
|
|
6
|
-
|
|
7
|
-
const cwd = process.cwd();
|
|
8
|
-
|
|
9
|
-
const projectPath = path.join(cwd, name);
|
|
10
|
-
fs.mkdirSync(projectPath)
|
|
11
|
-
|
|
12
|
-
const src = path.join(projectPath, "src");
|
|
13
|
-
fs.mkdirSync(src)
|
|
14
|
-
|
|
15
|
-
const public = path.join(projectPath, "public");
|
|
16
|
-
fs.mkdirSync(public)
|
|
17
|
-
|
|
18
|
-
creator.copyTpl('
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
creator.copyTpl('
|
|
23
|
-
name, description
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
creator.copyTpl('
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
creator.copyTpl('
|
|
31
|
-
|
|
32
|
-
creator.copyTpl('
|
|
33
|
-
|
|
34
|
-
creator.copyTpl('
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
console.log(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
console.log(`${chalk.grey(
|
|
46
|
-
console.log(`${chalk.grey(`创建文件: ${name}/
|
|
47
|
-
|
|
48
|
-
console.log(`${chalk.grey(
|
|
49
|
-
console.log(`${chalk.grey(`创建文件: ${name}/
|
|
50
|
-
console.log(`${chalk.grey(`创建文件: ${name}/
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const chalk = require("chalk")
|
|
3
|
+
const path = require("path")
|
|
4
|
+
module.exports = function (creator, options, callback) {
|
|
5
|
+
const { name, description } = options;
|
|
6
|
+
|
|
7
|
+
const cwd = process.cwd();
|
|
8
|
+
|
|
9
|
+
const projectPath = path.join(cwd, name);
|
|
10
|
+
fs.mkdirSync(projectPath)
|
|
11
|
+
|
|
12
|
+
const src = path.join(projectPath, "src");
|
|
13
|
+
fs.mkdirSync(src)
|
|
14
|
+
|
|
15
|
+
const public = path.join(projectPath, "public");
|
|
16
|
+
fs.mkdirSync(public)
|
|
17
|
+
|
|
18
|
+
creator.copyTpl('cloudcc-cli.configjs', path.join(projectPath, "cloudcc-cli.config.js"))
|
|
19
|
+
|
|
20
|
+
creator.copyTpl('gitignore', path.join(projectPath, ".gitignore"))
|
|
21
|
+
|
|
22
|
+
creator.copyTpl('packagejson', path.join(projectPath, "package.json"), {
|
|
23
|
+
name, description
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
creator.copyTpl('package-lockjson', path.join(projectPath, "package-lock.json"), {
|
|
27
|
+
name, description
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
creator.copyTpl('vueconfigjs', path.join(projectPath, "vue.config.js"))
|
|
31
|
+
|
|
32
|
+
creator.copyTpl('babelconfigjs', path.join(projectPath, "babel.config.js"))
|
|
33
|
+
|
|
34
|
+
creator.copyTpl('mainjs', path.join(src, "main.js"))
|
|
35
|
+
|
|
36
|
+
creator.copyTpl('Appvue', path.join(src, "App.vue"))
|
|
37
|
+
|
|
38
|
+
creator.copyTpl('indexhtml', path.join(public, "index.html"))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
creator.fs.commit(() => {
|
|
42
|
+
console.log();
|
|
43
|
+
console.log(`${chalk.grey(`创建项目: ${name}`)} ${chalk.green('✔ ')}`);
|
|
44
|
+
|
|
45
|
+
console.log(`${chalk.grey(`创建目录: ${name}/public`)} ${chalk.green('✔ ')}`);
|
|
46
|
+
console.log(`${chalk.grey(`创建文件: ${name}/public/index.html`)} ${chalk.green('✔ ')}`);
|
|
47
|
+
|
|
48
|
+
console.log(`${chalk.grey(`创建目录: ${name}/src`)} ${chalk.green('✔ ')}`);
|
|
49
|
+
console.log(`${chalk.grey(`创建文件: ${name}/src/App.vue`)} ${chalk.green('✔ ')}`);
|
|
50
|
+
console.log(`${chalk.grey(`创建文件: ${name}/src/main.js`)} ${chalk.green('✔ ')}`);
|
|
51
|
+
|
|
52
|
+
console.log(`${chalk.grey(`创建文件: ${name}/babel.config.js`)} ${chalk.green('✔ ')}`);
|
|
53
|
+
console.log(`${chalk.grey(`创建文件: ${name}/package.json`)} ${chalk.green('✔ ')}`);
|
|
54
|
+
console.log(`${chalk.grey(`创建文件: ${name}/vue.config.js`)} ${chalk.green('✔ ')}`);
|
|
55
|
+
console.log(`${chalk.grey(`创建文件: ${name}/cloudcc-cli.config.js`)} ${chalk.green('✔ ')}`);
|
|
56
|
+
callback();
|
|
57
|
+
});
|
|
53
58
|
}
|
package/template/indexhtml
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
7
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
8
|
-
<title>
|
|
9
|
-
Cloudcc Plugin Dev
|
|
10
|
-
</title>
|
|
11
|
-
</head>
|
|
12
|
-
|
|
13
|
-
<body>
|
|
14
|
-
<noscript>
|
|
15
|
-
<strong>We're sorry but Cloudcc Plugin Dev doesn't work properly without JavaScript enabled.
|
|
16
|
-
Please enable it to continue.</strong>
|
|
17
|
-
</noscript>
|
|
18
|
-
<div id="app"></div>
|
|
19
|
-
<!-- built files will be auto injected -->
|
|
20
|
-
</body>
|
|
21
|
-
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
7
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
8
|
+
<title>
|
|
9
|
+
Cloudcc Plugin Dev
|
|
10
|
+
</title>
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
<noscript>
|
|
15
|
+
<strong>We're sorry but Cloudcc Plugin Dev doesn't work properly without JavaScript enabled.
|
|
16
|
+
Please enable it to continue.</strong>
|
|
17
|
+
</noscript>
|
|
18
|
+
<div id="app"></div>
|
|
19
|
+
<!-- built files will be auto injected -->
|
|
20
|
+
</body>
|
|
21
|
+
|
|
22
22
|
</html>
|
package/template/indexvue
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="cc-container">
|
|
3
|
-
<div>Hello CloudCC</div>
|
|
4
|
-
<div>
|
|
5
|
-
<a href="https://cloudccone.feishu.cn/wiki/JZ7CwcRfriU8taknCKCcwKEmncd">
|
|
6
|
-
开发者文档</a
|
|
7
|
-
>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
export default {
|
|
14
|
-
data() {
|
|
15
|
-
return {
|
|
16
|
-
componentInfo: {
|
|
17
|
-
// 组件唯一标识,全局唯一
|
|
18
|
-
component: "cloudcc-demo-01",
|
|
19
|
-
// 组件名称,在页面编辑器显示的名字
|
|
20
|
-
compName: "cloudcc-demo-01",
|
|
21
|
-
// 组件描述信息
|
|
22
|
-
compDesc: "组件描述信息",
|
|
23
|
-
},
|
|
24
|
-
isLock: false,
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
</script>
|
|
29
|
-
<style lang="scss" scoped>
|
|
30
|
-
.cc-container {
|
|
31
|
-
text-align: center;
|
|
32
|
-
padding: 8px;
|
|
33
|
-
background: goldenrod;
|
|
34
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="cc-container">
|
|
3
|
+
<div>Hello CloudCC</div>
|
|
4
|
+
<div>
|
|
5
|
+
<a href="https://cloudccone.feishu.cn/wiki/JZ7CwcRfriU8taknCKCcwKEmncd">
|
|
6
|
+
开发者文档</a
|
|
7
|
+
>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
data() {
|
|
15
|
+
return {
|
|
16
|
+
componentInfo: {
|
|
17
|
+
// 组件唯一标识,全局唯一
|
|
18
|
+
component: "cloudcc-demo-01",
|
|
19
|
+
// 组件名称,在页面编辑器显示的名字
|
|
20
|
+
compName: "cloudcc-demo-01",
|
|
21
|
+
// 组件描述信息
|
|
22
|
+
compDesc: "组件描述信息",
|
|
23
|
+
},
|
|
24
|
+
isLock: false,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
<style lang="scss" scoped>
|
|
30
|
+
.cc-container {
|
|
31
|
+
text-align: center;
|
|
32
|
+
padding: 8px;
|
|
33
|
+
background: goldenrod;
|
|
34
|
+
}
|
|
35
35
|
</style>
|