cloudcc-cli 1.8.7 → 1.8.9

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.
Files changed (57) hide show
  1. package/README.md +1326 -1312
  2. package/bin/cc.js +49 -49
  3. package/bin/plugin.js +5 -5
  4. package/bin/project.js +5 -5
  5. package/core/core/ServiceResult.java +35 -35
  6. package/core/core/UserInfo.java +45 -45
  7. package/package.json +34 -34
  8. package/src/classes/create.js +43 -43
  9. package/src/classes/index.js +8 -8
  10. package/src/classes/publish.js +45 -45
  11. package/src/config/get.js +20 -20
  12. package/src/config/index.js +8 -8
  13. package/src/config/use.js +14 -14
  14. package/src/object/get.js +35 -35
  15. package/src/object/index.js +7 -7
  16. package/src/plugin/create.js +70 -70
  17. package/src/plugin/create1.js +58 -58
  18. package/src/plugin/index.js +8 -8
  19. package/src/plugin/publish.js +267 -267
  20. package/src/plugin/publish1.js +297 -297
  21. package/src/plugin/readme.md +6 -6
  22. package/src/project/create.js +83 -83
  23. package/src/project/create1.js +105 -105
  24. package/src/project/index.js +7 -7
  25. package/src/recordType/get.js +13 -13
  26. package/src/recordType/index.js +7 -7
  27. package/src/script/create.js +35 -35
  28. package/src/script/index.js +8 -8
  29. package/src/script/publish.js +71 -51
  30. package/src/timer/create.js +29 -29
  31. package/src/timer/index.js +8 -8
  32. package/src/timer/publish.js +47 -47
  33. package/src/token/get.js +11 -11
  34. package/src/token/index.js +7 -7
  35. package/src/triggers/create.js +39 -39
  36. package/src/triggers/index.js +8 -8
  37. package/src/triggers/publish.js +53 -53
  38. package/template/Appvue +24 -24
  39. package/template/babelconfigjs +5 -5
  40. package/template/demojava +14 -14
  41. package/template/gitignore +13 -13
  42. package/template/index.js +57 -57
  43. package/template/indexhtml +21 -21
  44. package/template/indexvue +29 -29
  45. package/template/javaconfigjson +2 -2
  46. package/template/mainjs +13 -13
  47. package/template/package-lockjson +13952 -13952
  48. package/template/packagejson +42 -42
  49. package/template/vueconfigjs +21 -21
  50. package/tool/branch/index.js +25 -25
  51. package/tool/checkLange/checkLang.js +68 -68
  52. package/tool/checkLange/clearLang.js +85 -85
  53. package/utils/cache.js +31 -31
  54. package/utils/checkVersion.js +107 -107
  55. package/utils/config.js +18 -18
  56. package/utils/http.js +123 -123
  57. package/utils/utils.js +95 -95
@@ -1,29 +1,29 @@
1
- const { checkUpdate } = require("../../utils/checkVersion")
2
- const fs = require("fs");
3
- const path = require("path")
4
- const chalk = require("chalk")
5
- const { getPackageJson } = require("../../utils/config.js")
6
-
7
- async function create(name) {
8
- let res = await checkUpdate();
9
- if (!res) {
10
- const timerPath = path.join(process.cwd(), "schedule/" + name);
11
- try {
12
- fs.mkdirSync(timerPath, { recursive: true })
13
- const javaTmp = `// @SOURCE_CONTENT_START
14
- System.out.print("hello World");
15
- // @SOURCE_CONTENT_END`
16
- fs.writeFileSync(path.join(timerPath, name + ".java"), javaTmp)
17
- fs.writeFileSync(path.join(timerPath, "config.json"), `{"name":"${name}","version":"${getPackageJson().extandVersion || '2'}"}`)
18
- console.log()
19
- console.log(chalk.green("Successfully Created:" + name))
20
- console.log()
21
- } catch (e) {
22
- console.log()
23
- console.log(chalk.red("Creation Failed:" + e))
24
- console.log()
25
- }
26
- }
27
- }
28
-
29
- 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
+ const { getPackageJson } = require("../../utils/config.js")
6
+
7
+ async function create(name) {
8
+ let res = await checkUpdate();
9
+ if (!res) {
10
+ const timerPath = path.join(process.cwd(), "schedule/" + name);
11
+ try {
12
+ fs.mkdirSync(timerPath, { recursive: true })
13
+ const javaTmp = `// @SOURCE_CONTENT_START
14
+ System.out.print("hello World");
15
+ // @SOURCE_CONTENT_END`
16
+ fs.writeFileSync(path.join(timerPath, name + ".java"), javaTmp)
17
+ fs.writeFileSync(path.join(timerPath, "config.json"), `{"name":"${name}","version":"${getPackageJson().extandVersion || '2'}"}`)
18
+ console.log()
19
+ console.log(chalk.green("Successfully Created:" + name))
20
+ console.log()
21
+ } catch (e) {
22
+ console.log()
23
+ console.log(chalk.red("Creation Failed:" + e))
24
+ console.log()
25
+ }
26
+ }
27
+ }
28
+
29
+ module.exports = create;
@@ -1,8 +1,8 @@
1
- const cc = {}
2
- cc.create = require("./create")
3
- cc.publish = require("./publish")
4
- function Timer(action, argvs) {
5
- cc[action](argvs[2])
6
- }
7
-
8
- module.exports = Timer;
1
+ const cc = {}
2
+ cc.create = require("./create")
3
+ cc.publish = require("./publish")
4
+ function Timer(action, argvs) {
5
+ cc[action](argvs[2])
6
+ }
7
+
8
+ module.exports = Timer;
@@ -1,47 +1,47 @@
1
- const { checkUpdate } = require("../../utils/checkVersion")
2
- const fs = require("fs");
3
- const path = require("path")
4
- const chalk = require("chalk")
5
- const { postNormal } = require("../../utils/http")
6
-
7
- const { getBusToken } = require("../../utils/utils")
8
-
9
- async function publish(name) {
10
- let res = await checkUpdate();
11
- if (!res) {
12
- console.log();
13
- console.log(chalk.green('Posting, please wait...'));
14
- console.log();
15
- const timerPath = path.join(process.cwd(), `schedule/${name}/`);
16
- let fullContent = fs.readFileSync(timerPath + `${name}.java`, 'utf8');
17
-
18
- // 提取标记之间的内容
19
- const sourceMatch = fullContent.match(/\/\/ @SOURCE_CONTENT_START\n([\s\S]*?)\n\/\/ @SOURCE_CONTENT_END/);
20
- let classContent = sourceMatch ? sourceMatch[1] : fullContent;
21
-
22
- let configContent = JSON.parse(fs.readFileSync(timerPath + "config.json", 'utf8'));
23
-
24
- if (await getBusToken()) {
25
- let body = {
26
- "id": configContent.id,
27
- "name": name,
28
- "version": configContent.version || "2",
29
- "source": encodeURIComponent(classContent),
30
- "folderId": "wgd"
31
- }
32
- let res = await postNormal(global.setupSvc + "/api/ccPeak/save", body)
33
- if (res.result) {
34
- console.log(chalk.green('Success!'));
35
- console.log();
36
-
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('Fail:' + res.returnInfo));
43
- }
44
- }
45
- }
46
- }
47
- module.exports = publish;
1
+ const { checkUpdate } = require("../../utils/checkVersion")
2
+ const fs = require("fs");
3
+ const path = require("path")
4
+ const chalk = require("chalk")
5
+ const { postNormal } = require("../../utils/http")
6
+
7
+ const { getBusToken } = require("../../utils/utils")
8
+
9
+ async function publish(name) {
10
+ let res = await checkUpdate();
11
+ if (!res) {
12
+ console.log();
13
+ console.log(chalk.green('Posting, please wait...'));
14
+ console.log();
15
+ const timerPath = path.join(process.cwd(), `schedule/${name}/`);
16
+ let fullContent = fs.readFileSync(timerPath + `${name}.java`, 'utf8');
17
+
18
+ // 提取标记之间的内容
19
+ const sourceMatch = fullContent.match(/\/\/ @SOURCE_CONTENT_START\n([\s\S]*?)\n\/\/ @SOURCE_CONTENT_END/);
20
+ let classContent = sourceMatch ? sourceMatch[1] : fullContent;
21
+
22
+ let configContent = JSON.parse(fs.readFileSync(timerPath + "config.json", 'utf8'));
23
+
24
+ if (await getBusToken()) {
25
+ let body = {
26
+ "id": configContent.id,
27
+ "name": name,
28
+ "version": configContent.version || "2",
29
+ "source": encodeURIComponent(classContent),
30
+ "folderId": "wgd"
31
+ }
32
+ let res = await postNormal(global.setupSvc + "/api/ccPeak/save", body)
33
+ if (res.result) {
34
+ console.log(chalk.green('Success!'));
35
+ console.log();
36
+
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('Fail:' + res.returnInfo));
43
+ }
44
+ }
45
+ }
46
+ }
47
+ module.exports = publish;
package/src/token/get.js CHANGED
@@ -1,11 +1,11 @@
1
- const { getBusToken } = require("../../utils/utils")
2
-
3
- async function get(path) {
4
- let token = await getBusToken(path)
5
- if (token) {
6
- console.log(token)
7
- return token;
8
- }
9
- }
10
-
11
- module.exports = get;
1
+ const { getBusToken } = require("../../utils/utils")
2
+
3
+ async function get(path) {
4
+ let token = await getBusToken(path)
5
+ if (token) {
6
+ console.log(token)
7
+ return token;
8
+ }
9
+ }
10
+
11
+ module.exports = get;
@@ -1,7 +1,7 @@
1
- const cc = {}
2
- cc.get = require("./get")
3
- function Token(action,argvs) {
4
- cc[action](argvs[2])
5
- }
6
-
7
- module.exports = Token;
1
+ const cc = {}
2
+ cc.get = require("./get")
3
+ function Token(action,argvs) {
4
+ cc[action](argvs[2])
5
+ }
6
+
7
+ module.exports = Token;
@@ -1,39 +1,39 @@
1
- const { checkUpdate } = require("../../utils/checkVersion")
2
- const fs = require("fs");
3
- const path = require("path")
4
- const chalk = require("chalk")
5
- const { getPackageJson } = require("../../utils/config.js")
6
-
7
- async function create(argvs) {
8
- let res = await checkUpdate();
9
- if (!res) {
10
- let body = JSON.parse(decodeURI(argvs[2]))
11
- const baseTriggersPath = path.join(process.cwd(), "triggers");
12
- const objectFolderPath = path.join(baseTriggersPath, `${body.schemetableName.toLowerCase()}`);
13
- const triggersPath = path.join(objectFolderPath, body.name);
14
-
15
- try {
16
- // 确保对象文件夹和触发器文件夹都存在
17
- fs.mkdirSync(objectFolderPath, { recursive: true });
18
- fs.mkdirSync(triggersPath, { recursive: true });
19
-
20
- const javaTmp = `// @SOURCE_CONTENT_START
21
- System.out.print("hello World");
22
- // @SOURCE_CONTENT_END`
23
-
24
- fs.writeFileSync(path.join(triggersPath, body.name + ".java"), javaTmp);
25
- body.version = getPackageJson().extandVersion || "2";
26
- body.isactive = true;
27
- fs.writeFileSync(path.join(triggersPath, "config.json"), JSON.stringify(body));
28
- console.log();
29
- console.log(chalk.green("Successfully Created:" + body.name));
30
- console.log();
31
- } catch (e) {
32
- console.log()
33
- console.log(chalk.red("Creation Failed:" + e))
34
- console.log()
35
- }
36
- }
37
- }
38
-
39
- 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
+ const { getPackageJson } = require("../../utils/config.js")
6
+
7
+ async function create(argvs) {
8
+ let res = await checkUpdate();
9
+ if (!res) {
10
+ let body = JSON.parse(decodeURI(argvs[2]))
11
+ const baseTriggersPath = path.join(process.cwd(), "triggers");
12
+ const objectFolderPath = path.join(baseTriggersPath, `${body.schemetableName.toLowerCase()}`);
13
+ const triggersPath = path.join(objectFolderPath, body.name);
14
+
15
+ try {
16
+ // 确保对象文件夹和触发器文件夹都存在
17
+ fs.mkdirSync(objectFolderPath, { recursive: true });
18
+ fs.mkdirSync(triggersPath, { recursive: true });
19
+
20
+ const javaTmp = `// @SOURCE_CONTENT_START
21
+ System.out.print("hello World");
22
+ // @SOURCE_CONTENT_END`
23
+
24
+ fs.writeFileSync(path.join(triggersPath, body.name + ".java"), javaTmp);
25
+ body.version = getPackageJson().extandVersion || "2";
26
+ body.isactive = true;
27
+ fs.writeFileSync(path.join(triggersPath, "config.json"), JSON.stringify(body));
28
+ console.log();
29
+ console.log(chalk.green("Successfully Created:" + body.name));
30
+ console.log();
31
+ } catch (e) {
32
+ console.log()
33
+ console.log(chalk.red("Creation Failed:" + e))
34
+ console.log()
35
+ }
36
+ }
37
+ }
38
+
39
+ module.exports = create;
@@ -1,8 +1,8 @@
1
- const cc = {}
2
- cc.create = require("./create")
3
- cc.publish = require("./publish")
4
- function Classes(action, argvs) {
5
- cc[action](argvs)
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)
6
+ }
7
+
8
+ module.exports = Classes;
@@ -1,53 +1,53 @@
1
- const { checkUpdate } = require("../../utils/checkVersion")
2
- const fs = require("fs");
3
- const path = require("path")
4
- const chalk = require("chalk")
5
- const { postNormal } = require("../../utils/http")
6
- const { getBusToken } = require("../../utils/utils")
7
-
8
- async function publish(argvs) {
9
- let namePath = argvs[2]
10
- let name = namePath.split("/")[1]
11
- let res = await checkUpdate();
12
- if (!res) {
13
- console.log();
14
- console.log(chalk.green('Posting, please wait...'));
15
- console.log();
16
- const triggersPath = path.join(process.cwd(), `triggers/${namePath}/`);
17
- let fullContent = fs.readFileSync(triggersPath + `${name}.java`, 'utf8');
18
-
19
- // 提取标记之间的内容
20
- const sourceMatch = fullContent.match(/\/\/ @SOURCE_CONTENT_START\n([\s\S]*?)\n\/\/ @SOURCE_CONTENT_END/);
21
- let classContent = sourceMatch ? sourceMatch[1] : fullContent;
22
-
23
- let configContent = JSON.parse(fs.readFileSync(triggersPath + "config.json", 'utf8'));
24
-
25
- if (await getBusToken()) {
26
- let body = {
27
- "id": configContent.id,
28
- "apiname": configContent.apiname,
29
- "isactive": configContent.isactive,
30
- "targetObjectId": configContent.targetObjectId,
31
- "triggerTime": configContent.triggerTime,
32
- "name": name,
33
- "version": configContent.version || "2",
34
- "triggerSource": encodeURIComponent(classContent),
35
- "folderId": "wgd"
36
- }
37
- let res = await postNormal(global.setupSvc + "/api/triggerSetup/saveTrigger", body)
38
- if (res.result) {
39
- console.log(chalk.green('Success!'));
40
- console.log();
41
-
42
- if (!configContent.id) {
43
- configContent.id = res.data.id
44
- configContent.apiname = res.data.apiname
45
- fs.writeFileSync(path.join(triggersPath, "config.json"), JSON.stringify(configContent))
46
- }
47
- } else {
48
- console.log(chalk.red('Fail:' + res.returnInfo));
49
- }
50
- }
51
- }
52
- }
53
- module.exports = publish;
1
+ const { checkUpdate } = require("../../utils/checkVersion")
2
+ const fs = require("fs");
3
+ const path = require("path")
4
+ const chalk = require("chalk")
5
+ const { postNormal } = require("../../utils/http")
6
+ const { getBusToken } = require("../../utils/utils")
7
+
8
+ async function publish(argvs) {
9
+ let namePath = argvs[2]
10
+ let name = namePath.split("/")[1]
11
+ let res = await checkUpdate();
12
+ if (!res) {
13
+ console.log();
14
+ console.log(chalk.green('Posting, please wait...'));
15
+ console.log();
16
+ const triggersPath = path.join(process.cwd(), `triggers/${namePath}/`);
17
+ let fullContent = fs.readFileSync(triggersPath + `${name}.java`, 'utf8');
18
+
19
+ // 提取标记之间的内容
20
+ const sourceMatch = fullContent.match(/\/\/ @SOURCE_CONTENT_START\n([\s\S]*?)\n\/\/ @SOURCE_CONTENT_END/);
21
+ let classContent = sourceMatch ? sourceMatch[1] : fullContent;
22
+
23
+ let configContent = JSON.parse(fs.readFileSync(triggersPath + "config.json", 'utf8'));
24
+
25
+ if (await getBusToken()) {
26
+ let body = {
27
+ "id": configContent.id,
28
+ "apiname": configContent.apiname,
29
+ "isactive": configContent.isactive,
30
+ "targetObjectId": configContent.targetObjectId,
31
+ "triggerTime": configContent.triggerTime,
32
+ "name": name,
33
+ "version": configContent.version || "2",
34
+ "triggerSource": encodeURIComponent(classContent),
35
+ "folderId": "wgd"
36
+ }
37
+ let res = await postNormal(global.setupSvc + "/api/triggerSetup/saveTrigger", body)
38
+ if (res.result) {
39
+ console.log(chalk.green('Success!'));
40
+ console.log();
41
+
42
+ if (!configContent.id) {
43
+ configContent.id = res.data.id
44
+ configContent.apiname = res.data.apiname
45
+ fs.writeFileSync(path.join(triggersPath, "config.json"), JSON.stringify(configContent))
46
+ }
47
+ } else {
48
+ console.log(chalk.red('Fail:' + res.returnInfo));
49
+ }
50
+ }
51
+ }
52
+ }
53
+ module.exports = publish;
package/template/Appvue CHANGED
@@ -1,25 +1,25 @@
1
- <template>
2
- <div class="cc-container">
3
- <div>hello World</div>
4
- </div>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- name: "App",
10
- };
11
- </script>
12
-
13
- <style lang="scss" scoped>
14
- html body {
15
- padding: 0;
16
- margin: 0;
17
- height: 100vh;
18
- width: 100%;
19
- }
20
- .cc-container {
21
- text-align: center;
22
- padding: 8px;
23
- background: goldenrod;
24
- }
1
+ <template>
2
+ <div class="cc-container">
3
+ <div>hello World</div>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "App",
10
+ };
11
+ </script>
12
+
13
+ <style lang="scss" scoped>
14
+ html body {
15
+ padding: 0;
16
+ margin: 0;
17
+ height: 100vh;
18
+ width: 100%;
19
+ }
20
+ .cc-container {
21
+ text-align: center;
22
+ padding: 8px;
23
+ background: goldenrod;
24
+ }
25
25
  </style>
@@ -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
+ }
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
  }
@@ -1,14 +1,14 @@
1
- # Editor directories and files
2
- .idea
3
- .vscode
4
- *.suo
5
- *.ntvs*
6
- *.njsproj
7
- *.sln
8
- .cloudcc-cache.json
9
- .temp
10
- .cache
11
- .idea
12
- ./build
13
- .DS_Store
1
+ # Editor directories and files
2
+ .idea
3
+ .vscode
4
+ *.suo
5
+ *.ntvs*
6
+ *.njsproj
7
+ *.sln
8
+ .cloudcc-cache.json
9
+ .temp
10
+ .cache
11
+ .idea
12
+ ./build
13
+ .DS_Store
14
14
  node_modules/
package/template/index.js CHANGED
@@ -1,58 +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('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(`Create project: ${name}`)} ${chalk.green('✔ ')}`);
44
-
45
- console.log(`${chalk.grey(`Create directory: ${name}/public`)} ${chalk.green('✔ ')}`);
46
- console.log(`${chalk.grey(`Create file: ${name}/public/index.html`)} ${chalk.green('✔ ')}`);
47
-
48
- console.log(`${chalk.grey(`Create file: ${name}/src`)} ${chalk.green('✔ ')}`);
49
- console.log(`${chalk.grey(`Create file: ${name}/src/App.vue`)} ${chalk.green('✔ ')}`);
50
- console.log(`${chalk.grey(`Create file: ${name}/src/main.js`)} ${chalk.green('✔ ')}`);
51
-
52
- console.log(`${chalk.grey(`Create file: ${name}/babel.config.js`)} ${chalk.green('✔ ')}`);
53
- console.log(`${chalk.grey(`Create file: ${name}/package.json`)} ${chalk.green('✔ ')}`);
54
- console.log(`${chalk.grey(`Create file: ${name}/vue.config.js`)} ${chalk.green('✔ ')}`);
55
- console.log(`${chalk.grey(`Create file: ${name}/cloudcc-cli.config.js`)} ${chalk.green('✔ ')}`);
56
- callback();
57
- });
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(`Create project: ${name}`)} ${chalk.green('✔ ')}`);
44
+
45
+ console.log(`${chalk.grey(`Create directory: ${name}/public`)} ${chalk.green('✔ ')}`);
46
+ console.log(`${chalk.grey(`Create file: ${name}/public/index.html`)} ${chalk.green('✔ ')}`);
47
+
48
+ console.log(`${chalk.grey(`Create file: ${name}/src`)} ${chalk.green('✔ ')}`);
49
+ console.log(`${chalk.grey(`Create file: ${name}/src/App.vue`)} ${chalk.green('✔ ')}`);
50
+ console.log(`${chalk.grey(`Create file: ${name}/src/main.js`)} ${chalk.green('✔ ')}`);
51
+
52
+ console.log(`${chalk.grey(`Create file: ${name}/babel.config.js`)} ${chalk.green('✔ ')}`);
53
+ console.log(`${chalk.grey(`Create file: ${name}/package.json`)} ${chalk.green('✔ ')}`);
54
+ console.log(`${chalk.grey(`Create file: ${name}/vue.config.js`)} ${chalk.green('✔ ')}`);
55
+ console.log(`${chalk.grey(`Create file: ${name}/cloudcc-cli.config.js`)} ${chalk.green('✔ ')}`);
56
+ callback();
57
+ });
58
58
  }