@wagq/wa-cli 0.5.10-beta.0 → 0.5.11

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 (2) hide show
  1. package/lib/daml/async.js +20 -7
  2. package/package.json +1 -1
package/lib/daml/async.js CHANGED
@@ -3,7 +3,7 @@ const Prompt = require("inquirer");
3
3
  const log = require("../../utils/log");
4
4
 
5
5
  const typePath = {
6
- "逻辑编辑器": "actions.actionList ",
6
+ "逻辑编辑器": "actions.actionList",
7
7
  "变量编辑器": "dataSource.dataList"
8
8
  }
9
9
 
@@ -26,16 +26,14 @@ const getFiles = async () => {
26
26
  `${process.cwd()}/scripts/asyncDamlFetch.js`
27
27
  );
28
28
  if (!fnFile) {
29
- log.error("scripts/asyncDamlFetch.js文件不存在")
30
29
  const hasCatalogue = await fs.existsSync(`${process.cwd()}/scripts`);
31
- log.info(hasCatalogue)
32
30
  if(!hasCatalogue){
33
31
  await fs.mkdirSync("scripts", undefined, {
34
32
  cwd: process.cwd(),
35
33
  });
36
34
  }
37
- await fs.writeFileSync(`${process.cwd()}/scripts/asyncDamlFetch.js`)
38
- log.info("已为您创建scripts/asyncDamlFetch.js文件,请将您的逻辑编辑器代码复制到该文件中后再次执行")
35
+ await fs.writeFileSync(`${process.cwd()}/scripts/asyncDamlFetch.js`, '')
36
+ log.error("scripts/asyncDamlFetch.js文件不存在, 已为您创建scripts/asyncDamlFetch.js文件,请将您的逻辑编辑器代码复制到该文件中后再次执行")
39
37
  return;
40
38
  }
41
39
  const fetchDaml = await require(`${process.cwd()}/scripts/asyncDamlFetch.js`);
@@ -54,8 +52,23 @@ const getFiles = async () => {
54
52
  })
55
53
  .then((res) => {
56
54
  const daml = JSON.parse(res.data.daml);
57
- const dataPath = typePath[type];
58
- const pages = daml.app.subapps[0][dataPath];
55
+ const pages = daml.app.subapps[0].actions.actionList;
56
+ const variables = daml.app.subapps[0].dataSource.dataList;
57
+ switch (type) {
58
+ case "逻辑编辑器":
59
+ pages.forEach(({ content, name: fileName }) => {
60
+ fs.writeFileSync(`${name}/${fileName}.js`, content, {
61
+ cwd: process.cwd(),
62
+ });
63
+ });
64
+ break;
65
+ case "变量编辑器":
66
+ variables.forEach(({ key, value: variableValue }) => {
67
+ fs.writeFileSync(`${name}/${key}.js`, variableValue, {
68
+ cwd: process.cwd(),
69
+ });
70
+ });
71
+ }
59
72
 
60
73
  pages.forEach(({ content, name: fileName }) => {
61
74
  fs.writeFileSync(`${name}/${fileName}.js`, content, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wagq/wa-cli",
3
- "version": "0.5.10-beta.0",
3
+ "version": "0.5.11",
4
4
  "description": "wa的脚手架",
5
5
  "main": "index.js",
6
6
  "scripts": {