cloudcc-cli 1.9.0 → 1.9.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 CHANGED
@@ -1,3 +1,19 @@
1
+ # ReleaseV1.9.2
2
+ #### Release Date: 2025-2-11
3
+ #### Release Scope: Full
4
+ #### Release Content
5
+ * Optimization
6
+ * change javaContentRegular
7
+ * trigger add method name
8
+
9
+ # ReleaseV1.9.1
10
+ #### Release Date: 2025-2-10
11
+ #### Release Scope: Full
12
+ #### Release Content
13
+ * Optimization
14
+ * class add javaContentRegular
15
+ * change judge
16
+
1
17
  # ReleaseV1.9.0
2
18
  #### Release Date: 2025-2-10
3
19
  #### Release Scope: Full
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -4,7 +4,7 @@ const path = require("path")
4
4
  const chalk = require("chalk")
5
5
  const { postNormal } = require("../../utils/http")
6
6
 
7
- const { getBusToken } = require("../../utils/utils")
7
+ const { getBusToken, javaContentRegular } = require("../../utils/utils")
8
8
 
9
9
  async function publish(name) {
10
10
  let res = await checkUpdate();
@@ -15,7 +15,7 @@ async function publish(name) {
15
15
  const classPath = path.join(process.cwd(), `classes/${name}/`);
16
16
  let fullContent = fs.readFileSync(classPath + `${name}.java`, 'utf8');
17
17
 
18
- const sourceMatch = fullContent.match(/\/\/\s*@SOURCE_CONTENT_START\n([\s\S]*?)\n\/\/\s*@SOURCE_CONTENT_END/);
18
+ const sourceMatch = fullContent.match(javaContentRegular);
19
19
  let classContent = sourceMatch ? sourceMatch[1] : fullContent;
20
20
  let configContent = JSON.parse(fs.readFileSync(classPath + "config.json", 'utf8'));
21
21
 
@@ -4,7 +4,7 @@ const path = require("path")
4
4
  const chalk = require("chalk")
5
5
  const { postNormal } = require("../../utils/http")
6
6
 
7
- const { getBusToken } = require("../../utils/utils")
7
+ const { getBusToken, javaContentRegular } = require("../../utils/utils")
8
8
 
9
9
  async function pull(name) {
10
10
  let res = await checkUpdate();
@@ -26,9 +26,9 @@ async function pull(name) {
26
26
  let fullContent = fs.readFileSync(classPath + `${name}.java`, 'utf8');
27
27
 
28
28
  let newContent = '';
29
- if (fullContent) {
29
+ if (fullContent.includes("@SOURCE_CONTENT_START")) {
30
30
  newContent = fullContent.replace(
31
- /\/\/ @SOURCE_CONTENT_START\n[\s\S]*?\n\/\/ @SOURCE_CONTENT_END/,
31
+ javaContentRegular,
32
32
  `// @SOURCE_CONTENT_START\n${res.data.trigger.source}\n// @SOURCE_CONTENT_END`
33
33
  );
34
34
  } else {
@@ -12,7 +12,7 @@ async function create(name) {
12
12
  fs.mkdirSync(timerPath, { recursive: true })
13
13
 
14
14
  const javaTmp = `public class ${name} extends CCSchedule {
15
- public ${name}(){
15
+ public void demo(){
16
16
  // @SOURCE_CONTENT_START
17
17
  System.out.print("hello World");
18
18
  // @SOURCE_CONTENT_END
@@ -4,7 +4,7 @@ const path = require("path")
4
4
  const chalk = require("chalk")
5
5
  const { postNormal } = require("../../utils/http")
6
6
 
7
- const { getBusToken } = require("../../utils/utils")
7
+ const { getBusToken, javaContentRegular } = require("../../utils/utils")
8
8
 
9
9
  async function publish(name) {
10
10
  let res = await checkUpdate();
@@ -15,7 +15,7 @@ async function publish(name) {
15
15
  const timerPath = path.join(process.cwd(), `schedule/${name}/`);
16
16
  let fullContent = fs.readFileSync(timerPath + `${name}.java`, 'utf8');
17
17
 
18
- const sourceMatch = fullContent.match(/\/\/\s*@SOURCE_CONTENT_START([\s\S]*?)\/\/\s*@SOURCE_CONTENT_END/);
18
+ const sourceMatch = fullContent.match(javaContentRegular);
19
19
  let classContent = sourceMatch ? sourceMatch[1] : fullContent;
20
20
 
21
21
  let configContent = JSON.parse(fs.readFileSync(timerPath + "config.json", 'utf8'));
package/src/timer/pull.js CHANGED
@@ -4,7 +4,7 @@ const path = require("path")
4
4
  const chalk = require("chalk")
5
5
  const { postNormal } = require("../../utils/http")
6
6
 
7
- const { getBusToken } = require("../../utils/utils")
7
+ const { getBusToken, javaContentRegular } = require("../../utils/utils")
8
8
 
9
9
  async function pull(name) {
10
10
  let res = await checkUpdate();
@@ -28,9 +28,9 @@ async function pull(name) {
28
28
  let fullContent = fs.readFileSync(timerPath + `${name}.java`, 'utf8');
29
29
 
30
30
  let newContent = '';
31
- if (fullContent) {
31
+ if (fullContent.includes("@SOURCE_CONTENT_START")) {
32
32
  newContent = fullContent.replace(
33
- /\/\/\s*@SOURCE_CONTENT_START[\s\S]*?\/\/\s*@SOURCE_CONTENT_END/,
33
+ javaContentRegular,
34
34
  `// @SOURCE_CONTENT_START\n${res.data.trigger.source}\n// @SOURCE_CONTENT_END`
35
35
  );
36
36
  } else {
@@ -17,7 +17,7 @@ async function create(argvs) {
17
17
  fs.mkdirSync(triggersPath, { recursive: true });
18
18
 
19
19
  const javaTmp = `public class ${body.name} extends CCTrigger {
20
- public ${body.name}(){
20
+ public void demo(){
21
21
  // @SOURCE_CONTENT_START
22
22
  System.out.print("hello World");
23
23
  // @SOURCE_CONTENT_END
@@ -3,7 +3,7 @@ const fs = require("fs");
3
3
  const path = require("path")
4
4
  const chalk = require("chalk")
5
5
  const { postNormal } = require("../../utils/http")
6
- const { getBusToken } = require("../../utils/utils")
6
+ const { getBusToken ,javaContentRegular} = require("../../utils/utils")
7
7
 
8
8
  async function publish(argvs) {
9
9
  let namePath = argvs[2]
@@ -16,7 +16,7 @@ async function publish(argvs) {
16
16
  const triggersPath = path.join(process.cwd(), `triggers/${namePath}/`);
17
17
  let fullContent = fs.readFileSync(triggersPath + `${name}.java`, 'utf8');
18
18
 
19
- const sourceMatch = fullContent.match(/\/\/\s*@SOURCE_CONTENT_START([\s\S]*?)\/\/\s*@SOURCE_CONTENT_END/);
19
+ const sourceMatch = fullContent.match(javaContentRegular);
20
20
  let triggersContent = sourceMatch ? sourceMatch[1] : fullContent;
21
21
  let configContent = JSON.parse(fs.readFileSync(triggersPath + "config.json", 'utf8'));
22
22
 
@@ -3,7 +3,7 @@ const fs = require("fs");
3
3
  const path = require("path")
4
4
  const chalk = require("chalk")
5
5
  const { postNormal } = require("../../utils/http")
6
- const { getBusToken } = require("../../utils/utils")
6
+ const { getBusToken, javaContentRegular } = require("../../utils/utils")
7
7
 
8
8
  async function pull(argvs) {
9
9
  let namePath = argvs[2]
@@ -27,10 +27,9 @@ async function pull(argvs) {
27
27
 
28
28
  let fullContent = fs.readFileSync(triggersPath + `${name}.java`, 'utf8');
29
29
  let newContent = '';
30
-
31
- if (fullContent) {
30
+ if (fullContent.includes("@SOURCE_CONTENT_START")) {
32
31
  newContent = fullContent.replace(
33
- /\/\/\s*@SOURCE_CONTENT_START([\s\S]*?)\/\/\s*@SOURCE_CONTENT_END/,
32
+ javaContentRegular,
34
33
  `// @SOURCE_CONTENT_START\n${res.data.trigger.triggerSource}\n// @SOURCE_CONTENT_END`
35
34
  );
36
35
  } else {
@@ -33,6 +33,9 @@
33
33
  "parserOptions": {
34
34
  "parser": "babel-eslint"
35
35
  },
36
+ "globals": {
37
+ "$CCDK": "readonly"
38
+ },
36
39
  "rules": {}
37
40
  },
38
41
  "browserslist": [
package/utils/utils.js CHANGED
@@ -92,5 +92,7 @@ async function getBusToken(path = process.cwd()) {
92
92
  }
93
93
  return false;
94
94
  }
95
+ const javaContentRegular = /\/\/\s*@SOURCE_CONTENT_START\r?\n([\s\S]*?)\r?\n\s*\/\/\s*@SOURCE_CONTENT_END/
95
96
 
96
- module.exports = { getBusToken }
97
+
98
+ module.exports = { getBusToken, javaContentRegular }