cloudcc-cli 1.8.2 → 1.8.4

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 CHANGED
@@ -1,3 +1,17 @@
1
+ # ReleaseV1.8.4
2
+ #### Release Date: 2025-1-24
3
+ #### Release Scope: Full
4
+ #### Release Content
5
+ * Optimization
6
+ * Add trigger timing directory
7
+
8
+ # ReleaseV1.8.3
9
+ #### Release Date: 2025-1-22
10
+ #### Release Scope: Full
11
+ #### Release Content
12
+ * Optimization
13
+ * Adjust the encoding
14
+
1
15
  # ReleaseV1.8.2
2
16
  #### Release Date: 2025-1-21
3
17
  #### Release Scope: Full
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "scripts": {
18
18
  "cc-pull": "git fetch --tags -f && git pull",
19
- "publish-lib": "npm publish --registry https://registry.npmjs.org && git add . && git commit -m '发布新版' && git push && curl https://npmmirror.com/sync/cloudcc-cli"
19
+ "publish-lib": "npm publish --registry https://registry.npmjs.org && git add . && git commit -m 'update version' && git push && curl https://npmmirror.com/sync/cloudcc-cli"
20
20
  },
21
21
  "dependencies": {
22
22
  "axios": "^0.21.4",
@@ -2,6 +2,7 @@ const { checkUpdate } = require("../../utils/checkVersion")
2
2
  const fs = require("fs");
3
3
  const path = require("path")
4
4
  const chalk = require("chalk")
5
+ const { getPackageJson } = require("../../utils/config.js")
5
6
 
6
7
  async function create(name) {
7
8
  let res = await checkUpdate();
@@ -9,8 +10,8 @@ async function create(name) {
9
10
  const classesPath = path.join(process.cwd(), "classes/" + name);
10
11
  try {
11
12
  fs.mkdirSync(classesPath, { recursive: true })
12
- const javaTmp =
13
- `// @SOURCE_CONTENT_START
13
+ const javaTmp =
14
+ `// @SOURCE_CONTENT_START
14
15
  public class ${name}{
15
16
  private UserInfo userInfo;
16
17
 
@@ -27,7 +28,7 @@ public class ${name}{
27
28
  // @SOURCE_CONTENT_END
28
29
  `
29
30
  fs.writeFileSync(path.join(classesPath, name + ".java"), javaTmp)
30
- fs.writeFileSync(path.join(classesPath, "config.json"), `{"name":"${name}","version":"3"}`)
31
+ fs.writeFileSync(path.join(classesPath, "config.json"), `{"name":"${name}","version":"${getPackageJson().extandVersion || '2'}"}`)
31
32
  console.log()
32
33
  console.log(chalk.green("Successfully Created:" + name))
33
34
  console.log()
@@ -23,8 +23,8 @@ async function publish(name) {
23
23
  let body = {
24
24
  "id": configContent.id,
25
25
  "name": name,
26
- "source": encodeURI(classContent),
27
- "version": configContent.version,
26
+ "source": encodeURIComponent(classContent),
27
+ "version": configContent.version || "2",
28
28
  "folderId": "wgd"
29
29
  }
30
30
  let res = await postNormal(global.setupSvc + "/api/ccfag/save", body)
@@ -2,6 +2,7 @@ const { checkUpdate } = require("../../utils/checkVersion")
2
2
  const fs = require("fs");
3
3
  const path = require("path")
4
4
  const chalk = require("chalk")
5
+ const { getPackageJson } = require("../../utils/config.js")
5
6
 
6
7
  async function create(name) {
7
8
  let res = await checkUpdate();
@@ -13,7 +14,7 @@ async function create(name) {
13
14
  System.out.print("hello World");
14
15
  // @SOURCE_CONTENT_END`
15
16
  fs.writeFileSync(path.join(timerPath, name + ".java"), javaTmp)
16
- fs.writeFileSync(path.join(timerPath, "config.json"), `{"name":"${name}","version":"3"}`)
17
+ fs.writeFileSync(path.join(timerPath, "config.json"), `{"name":"${name}","version":"${getPackageJson().extandVersion || '2'}"}`)
17
18
  console.log()
18
19
  console.log(chalk.green("Successfully Created:" + name))
19
20
  console.log()
@@ -25,8 +25,8 @@ async function publish(name) {
25
25
  let body = {
26
26
  "id": configContent.id,
27
27
  "name": name,
28
- "version": configContent.version,
29
- "source": encodeURI(classContent),
28
+ "version": configContent.version || "2",
29
+ "source": encodeURIComponent(classContent),
30
30
  "folderId": "wgd"
31
31
  }
32
32
  let res = await postNormal(global.setupSvc + "/api/ccPeak/save", body)
@@ -2,13 +2,15 @@ const { checkUpdate } = require("../../utils/checkVersion")
2
2
  const fs = require("fs");
3
3
  const path = require("path")
4
4
  const chalk = require("chalk")
5
+ const { getPackageJson } = require("../../utils/config.js")
5
6
 
6
7
  async function create(argvs) {
7
8
  let res = await checkUpdate();
8
9
  if (!res) {
9
10
  let body = JSON.parse(decodeURI(argvs[2]))
11
+ console.log(decodeURI(argvs[2]))
10
12
  const baseTriggersPath = path.join(process.cwd(), "triggers");
11
- const objectFolderPath = path.join(baseTriggersPath, `${body.schemetableName.toLowerCase()}`);
13
+ const objectFolderPath = path.join(baseTriggersPath, `${body.schemetableName.toLowerCase()}`, body.triggerTime);
12
14
  const triggersPath = path.join(objectFolderPath, body.name);
13
15
 
14
16
  try {
@@ -21,6 +23,7 @@ System.out.print("hello World");
21
23
  // @SOURCE_CONTENT_END`
22
24
 
23
25
  fs.writeFileSync(path.join(triggersPath, body.name + ".java"), javaTmp);
26
+ body.version = getPackageJson().extandVersion || "2";
24
27
  fs.writeFileSync(path.join(triggersPath, "config.json"), JSON.stringify(body));
25
28
  console.log();
26
29
  console.log(chalk.green("Successfully Created:" + body.name));
@@ -7,20 +7,20 @@ const { getBusToken } = require("../../utils/utils")
7
7
 
8
8
  async function publish(argvs) {
9
9
  let namePath = argvs[2]
10
- let name = namePath.split("/")[1]
10
+ let name = path.basename(namePath, '.java')
11
+ let dirPath = path.dirname(namePath) // 获取不包含文件名的目录路径
11
12
  let res = await checkUpdate();
12
13
  if (!res) {
13
14
  console.log();
14
15
  console.log(chalk.green('Posting, please wait...'));
15
16
  console.log();
16
- const triggersPath = path.join(process.cwd(), `triggers/${namePath}/`);
17
- let fullContent = fs.readFileSync(triggersPath + `${name}.java`, 'utf8');
17
+ let fullContent = fs.readFileSync(namePath, 'utf8');
18
18
 
19
19
  // 提取标记之间的内容
20
20
  const sourceMatch = fullContent.match(/\/\/ @SOURCE_CONTENT_START\n([\s\S]*?)\n\/\/ @SOURCE_CONTENT_END/);
21
21
  let classContent = sourceMatch ? sourceMatch[1] : fullContent;
22
22
 
23
- let configContent = JSON.parse(fs.readFileSync(triggersPath + "config.json", 'utf8'));
23
+ let configContent = JSON.parse(fs.readFileSync(path.join(dirPath, "config.json"), 'utf8'));
24
24
 
25
25
  if (await getBusToken()) {
26
26
  let body = {
@@ -30,8 +30,8 @@ async function publish(argvs) {
30
30
  "targetObjectId": configContent.targetObjectId,
31
31
  "triggerTime": configContent.triggerTime,
32
32
  "name": name,
33
- "version": configContent.version,
34
- "triggerSource": encodeURI(classContent),
33
+ "version": configContent.version || "2",
34
+ "triggerSource": encodeURIComponent(classContent),
35
35
  "folderId": "wgd"
36
36
  }
37
37
  let res = await postNormal(global.setupSvc + "/api/triggerSetup/saveTrigger", body)