@wagq/wa-cli 0.6.50 → 0.6.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wagq/wa-cli",
3
- "version": "0.6.50",
3
+ "version": "0.6.52",
4
4
  "description": "wa的脚手架",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/config/command.js DELETED
@@ -1,180 +0,0 @@
1
- const init = require("../lib/init");
2
- const server = require("../lib/server");
3
- const xlsx2Config = require("../lib/locale/xlsx2Config");
4
- const asyncDaml = require("../lib/daml/async");
5
- const asyncDamlByApp = require("../lib/daml/asyncByApp");
6
- const batchUpdate = require("../lib/batchUpdate");
7
- const web2exe = require("../lib/exe");
8
- const skill = require("../lib/skill");
9
- const { generateIcon2Tsx } = require("../lib/generateIcon/tsx");
10
- const changesetDoc = require("../lib/changesetDoc");
11
- const vsSetting = require("../lib/vsSetting");
12
- const checkBranch = require("../lib/checkBranch");
13
- const clear = require("../lib/clear");
14
-
15
- const command = [
16
- {
17
- name: "daml",
18
- alias: "d",
19
- description: "同步低代码逻辑器文件",
20
- action: () => {
21
- asyncDaml();
22
- },
23
- },
24
- {
25
- name: "batchUpdate",
26
- alias: "bu",
27
- description: "批量升级依赖包,可以指定组织,只更新组织下的依赖",
28
- action: () => {
29
- batchUpdate();
30
- },
31
- },
32
- {
33
- name: "damls",
34
- description: `
35
- - 同步低码文件,
36
- - 可将appId,branchid,token,origin配置到~/.damlrc文件中,
37
- - 其中origin为域名,格式为低码应用的location.origin
38
- - 初次执行没有配置文件会自动创建`,
39
- alias: "da",
40
- action: () => {
41
- asyncDamlByApp();
42
- },
43
- },
44
- {
45
- name: "init",
46
- alias: "i",
47
- description: "项目初始化工具",
48
- action: (name) => {
49
- init(name);
50
- },
51
- },
52
- {
53
- name: "server [path]",
54
- alias: "s",
55
- description: "启动本地服务",
56
- action: server,
57
- options: {
58
- 端口: "-P, --port <port>",
59
- https: "-S, --https <boolean>",
60
- },
61
- positional: [
62
- {
63
- key: "path",
64
- option: {
65
- default: "dist",
66
- describe: "文件路径",
67
- type: "string",
68
- },
69
- },
70
- ],
71
- },
72
- {
73
- name: "xlsx2Config [path] [name] [ext]",
74
- alias: "l",
75
- description: "xlsx文件转多语言配置",
76
- positional: [
77
- {
78
- key: "path",
79
- option: {
80
- describe: "文件路径",
81
- type: "string",
82
- },
83
- },
84
- {
85
- key: "name",
86
- option: {
87
- describe: "xlsx文件名称",
88
- type: "string",
89
- },
90
- },
91
- {
92
- key: "ext",
93
- option: {
94
- describe: "转换文件格式(ts or json)",
95
- type: "string",
96
- },
97
- },
98
- ],
99
- action: xlsx2Config,
100
- },
101
- {
102
- name: "web2exe [name] [path] [icon]",
103
- alias: "we",
104
- description: "将网页打包成exe",
105
- positional: [
106
- {
107
- key: "name",
108
- option: {
109
- describe: "应用名称",
110
- type: "string",
111
- },
112
- },
113
- {
114
- key: "path",
115
- option: {
116
- describe: "文件路径",
117
- type: "string",
118
- },
119
- },
120
- ],
121
- action: web2exe,
122
- },
123
- {
124
- name: "skills",
125
- alias: "sk",
126
- description: "openskills指令快速导航",
127
- action: skill,
128
- },
129
- {
130
- name: "generateIcon2Tsx [svgPath]",
131
- alias: "gitsx",
132
- description: `
133
- - svg配置文件将生成在svg文件夹同级下的svgConfig中
134
- - txs将生成在svg文件夹统计下的icons中
135
- - 同时将所有icon导出到路径下index.ts文件中
136
- - 将svg文件生成为数据配置与TSX文件
137
- - 请谨遵 outline、multipleTone、fill 方式分类管理icon源文件,并规范icon命名后缀
138
- - like AuctionMenuMultipleTone.svg AuctionMenuMultipleTone.svg AddCircleOutlined.svg
139
- `,
140
- positional: [
141
- {
142
- key: "svgPath",
143
- option: {
144
- describe: "svg文件夹地址",
145
- type: "string",
146
- },
147
- },
148
- ],
149
- action: generateIcon2Tsx,
150
- },
151
- {
152
- name: "changesetDoc [mode]",
153
- alias: "chd",
154
- description: "包版本管理",
155
- action: changesetDoc,
156
- options: {
157
- registry: "-r, --registry <registry>",
158
- },
159
- },
160
- {
161
- name: "vsSetting",
162
- alias: "vs",
163
- description: "生成vscode配置文件",
164
- action: vsSetting,
165
- },
166
- {
167
- name: "checkBranch [target]",
168
- alias: "ckb",
169
- description: "检查当前分支",
170
- action: checkBranch,
171
- },
172
- {
173
- name: "clearLibrary",
174
- alias: "cle",
175
- description: "删除目录下node_modules与dist,如果有packages目录则继续下钻",
176
- action: clear,
177
- },
178
- ];
179
-
180
- module.exports = command;
package/config/lib.js DELETED
@@ -1,18 +0,0 @@
1
- const modeOptions = ["pnpm", "yarn", "npm"];
2
-
3
- const libBin = {
4
- pnpm: "pnpm i",
5
- yarn: "yarn",
6
- npm: "npm i",
7
- };
8
-
9
- const libQuestions = () => [
10
- {
11
- type: "list",
12
- name: "selectMode",
13
- message: `请选择依赖安装方式`,
14
- choices: modeOptions,
15
- },
16
- ];
17
-
18
- module.exports = { libQuestions, libBin };
@@ -1,21 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDbDCCAlSgAwIBAgIICN14YljjrUEwDQYJKoZIhvcNAQELBQAwgYoxCzAJBgNV
3
- BAYTAkNOMRMwEQYDVQQDDApleGFtcGxlLmNuMRAwDgYDVQQKDAdDb21wYW55MREw
4
- DwYDVQQLDAhEaXZpc2lvbjEOMAwGA1UECAwFQW5IdWkxDjAMBgNVBAcMBUhlRmVp
5
- MSEwHwYJKoZIhvcNAQkBFhJleGFtcGxlQGV4YW1wbGUuY24wHhcNMjUwNDEwMTkw
6
- MjAzWhcNMjgwNDEwMTkwMjAzWjBhMQswCQYDVQQGEwJDTjEVMBMGA1UEAwwMMTAu
7
- MTY3LjYuMTAzMQkwBwYDVQQKDAAxCTAHBgNVBAsMADEJMAcGA1UECAwAMQkwBwYD
8
- VQQHDAAxDzANBgkqhkiG9w0BCQEWADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
9
- AQoCggEBAI/OffZ12m7AARYRhtagVDpeT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3GrKoIrAoGBAKJf
22
- knxYXDZUiBfcAZUiIGDkGdDG2GWtPfqZlhoEYz7fYvrYF8H2W/SFMqRyVhlW4P15
23
- eA+bnM+quocAwbh8XwtJYX1esf+IAjKDEPPRsLagchwvO7TFjyDu4lrs+fGwQ57P
24
- cI2m/+ioknlie/IRkvaLR/CMAqCXkHTsIIx+k+jRAoGBAJ1O1GAeSeirJQe5qx/j
25
- GfgW5hF8TpKeHCOaGxd1Uey3YLsaknE1xzp5Oo6mCEFnyk5L922BjKTDIbhca7A0
26
- 9parcehx0OAZXW3rmZvMkV6wRXYLtpd6dRdPCrQk0AQWtgQT6Q9XsgErQXLvis6a
27
- FhJx5YJ9lKtPZv3Mqpto8w4z
28
- -----END RSA PRIVATE KEY-----
@@ -1,18 +0,0 @@
1
- const { execSync } = require("child_process");
2
- const log = require("../../utils/log");
3
- const { getPackageTxt } = require("../../utils/packages");
4
-
5
- const getupdateContent = async (prefix) => {
6
- let packageTxt = getPackageTxt();
7
- const reg = new RegExp(`"(${prefix}\/[\\w|-]+)".+,`, "g");
8
- packageTxt = packageTxt.replace(reg, (_, name) => {
9
- let version = execSync(`npm view ${name} version`).toString();
10
- version = version.substring(0, version.length - 1);
11
- log.info(`${name} => ${version}`);
12
- return `"${name}": "^${version}",`;
13
- });
14
-
15
- return packageTxt;
16
- };
17
-
18
- module.exports = getupdateContent;
@@ -1,20 +0,0 @@
1
- const { writePackageTxt } = require("../../utils/packages");
2
- const getupdateContent = require("./getUpdateLibs");
3
- const Prompt = require("inquirer");
4
-
5
- const batchUpdate = async () => {
6
- const quetionList = [
7
- {
8
- type: "input",
9
- name: "prefix",
10
- message: "请输入需要更新的包组织,如只更新@wagq,输入@wagq",
11
- default: "@wagq",
12
- },
13
- ];
14
-
15
- const { prefix } = await Prompt.default.prompt(quetionList);
16
- const packageContent = await getupdateContent(prefix);
17
- writePackageTxt(packageContent);
18
- };
19
-
20
- module.exports = batchUpdate;
@@ -1,55 +0,0 @@
1
- const { execSync } = require("child_process");
2
-
3
- const changesetDoc = (mode, argv) => {
4
- const registry = argv.registry ?? "https://registry.npmjs.org/";
5
- let bins = [];
6
- switch (mode) {
7
- case "dev":
8
- bins.push("echo 准备启动文档预览 @author: wa 1224362143@qq.com");
9
- bins.push("npx dumi dev");
10
- break;
11
- case "doc":
12
- bins.push("echo 准备构建文档 @author: wa 1224362143@qq.com");
13
- bins.push("npx dumi build");
14
- break;
15
- case "changeset":
16
- bins.push("npx changeset");
17
- break;
18
- case "ver":
19
- bins.push("npx changeset version");
20
- break;
21
- case "tBuild":
22
- bins.push("echo 准备打包 @author: wa 1224362143@qq.com");
23
- bins.push("npx turbo build");
24
- break;
25
- case "enterBeta":
26
- bins.push("echo 进入beta模式 @author: wa 1224362143@qq.com");
27
- bins.push("npx changeset pre enter beta");
28
- break;
29
- case "exitBeta":
30
- bins.push("echo 退出beta模式 @author: wa 1224362143@qq.com");
31
- bins.push("npx changeset pre exit");
32
- break;
33
- case "pub":
34
- bins.push("echo 准备发布正式包 @author: wa 1224362143@qq.com");
35
- bins.push(`npx changeset publish --registry=${registry}`);
36
- break;
37
- case "pubBeta":
38
- bins.push("echo 准备发布beta包 @author: wa 1224362143@qq.com");
39
- bins.push(`npx changeset publish --tag beta --registry=${registry}`);
40
- break;
41
- default:
42
- break;
43
- }
44
-
45
- if (bins.length > 0) {
46
- bins.forEach((bin) => {
47
- execSync(bin, {
48
- stdio: "inherit",
49
- cwd: process.cwd(),
50
- });
51
- });
52
- }
53
- };
54
-
55
- module.exports = changesetDoc;
@@ -1,23 +0,0 @@
1
- const { execSync } = require("child_process");
2
- const log = require("../../utils/log.js");
3
-
4
- const checkBranch = (target) => {
5
- try {
6
- const branch = execSync("git rev-parse --abbrev-ref HEAD", {
7
- encoding: "utf-8",
8
- }).trim();
9
-
10
- log.info(`当前分支 ${branch}`);
11
-
12
- if (branch !== target) {
13
- log.error(`错误: 请在 ${target} 分支上执行该脚本`);
14
- log.error(`当前分支: ${branch}`);
15
- process.exit(1);
16
- }
17
- } catch (error) {
18
- log.error(error);
19
- process.exit(1);
20
- }
21
- };
22
-
23
- module.exports = checkBranch;
@@ -1,35 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const log = require("../../utils/log.js");
4
-
5
- const cleanDir = (dirPath) => {
6
- if (fs.existsSync(dirPath)) {
7
- fs.rmSync(dirPath, { recursive: true, force: true });
8
- log.info(`Removed ${dirPath}`);
9
- }
10
- };
11
-
12
- const clear = (targetDir = process.cwd()) => {
13
- try {
14
- const packagesDir = path.join(targetDir, "packages");
15
-
16
- if (fs.existsSync(packagesDir)) {
17
- const dirs = fs.readdirSync(packagesDir, { withFileTypes: true });
18
- for (const dirent of dirs) {
19
- if (dirent.isDirectory()) {
20
- const dir = path.join(packagesDir, dirent.name);
21
- cleanDir(path.join(dir, "dist"));
22
- cleanDir(path.join(dir, "node_modules"));
23
- }
24
- }
25
- }
26
-
27
- cleanDir(path.join(targetDir, "node_modules"));
28
-
29
- log.info("💐 Clear done!");
30
- } catch (error) {
31
- log.error(error);
32
- }
33
- };
34
-
35
- module.exports = clear;
@@ -1,23 +0,0 @@
1
- const { promisify } = require("util");
2
- const ora = require("ora");
3
- const chalk = require("chalk");
4
- const download = promisify(require("download-git-repo"));
5
-
6
- const clone = async function (repo, dir, opotions = {}) {
7
- const process = ora(`开始下载 ${chalk.blue(repo)}`);
8
- process.start();
9
- process.color = "yellow";
10
- process.text = `正在下载..... ${chalk.yellow(repo)} `;
11
-
12
- try {
13
- await download(repo, dir, opotions);
14
- process.color = "green";
15
- process.succeed("下载成功");
16
- } catch (error) {
17
- process.color = "red";
18
- console.log(error);
19
- process.fail("下载失败");
20
- }
21
- };
22
-
23
- module.exports = clone;
package/lib/daml/async.js DELETED
@@ -1,105 +0,0 @@
1
- const fs = require("fs");
2
- const Prompt = require("inquirer");
3
- const log = require("../../utils/log");
4
- const string2Data = require("../../utils/string2Data");
5
-
6
- const typePath = {
7
- "逻辑编辑器": "actions.actionList",
8
- "变量编辑器": "dataSource.dataList",
9
- "变量与逻辑": "变量与逻辑"
10
- }
11
-
12
- const initQuestions = () => [
13
- {
14
- type: "input",
15
- name: "name",
16
- message: "请输入备注信息(会将所有逻辑编辑器文件保存在这个文件夹里,默认值是asyncData)",
17
- default: "asyncData"
18
- },
19
- {
20
- type: "list",
21
- name: "type",
22
- message: "请选择同步数据类型",
23
- choices: Reflect.ownKeys(typePath)
24
- }
25
- ];
26
-
27
- const getFiles = async () => {
28
- const fnFile = await fs.existsSync(
29
- `${process.cwd()}/scripts/asyncDamlFetch.js`
30
- );
31
- if (!fnFile) {
32
- const hasCatalogue = await fs.existsSync(`${process.cwd()}/scripts`);
33
- if(!hasCatalogue){
34
- await fs.mkdirSync("scripts", undefined, {
35
- cwd: process.cwd(),
36
- });
37
- }
38
- await fs.writeFileSync(`${process.cwd()}/scripts/asyncDamlFetch.js`, '')
39
- log.error("scripts/asyncDamlFetch.js文件不存在, 已为您创建scripts/asyncDamlFetch.js文件,请将您的逻辑编辑器代码复制到该文件中后再次执行")
40
- return;
41
- }
42
- const fetchDaml = await require(`${process.cwd()}/scripts/asyncDamlFetch.js`);
43
-
44
- const { name, type } = await Prompt.default.prompt(initQuestions());
45
- const exist = await fs.existsSync(name);
46
- if (!exist) {
47
- await fs.mkdirSync(String(name), undefined, {
48
- cwd: process.cwd(),
49
- });
50
- }
51
-
52
- fetchDaml()
53
- .then((res) => {
54
- return res.json();
55
- })
56
- .then((res) => {
57
- try{
58
- const daml = JSON.parse(res.data.daml);
59
- const pages = daml.app.subapps[0].actions.actionList || [];
60
- const variables = daml.app.subapps[0].dataSource.dataList || [];
61
-
62
- let asyncPage = false
63
- let asyncVariable = false
64
-
65
- switch (type) {
66
- case "逻辑编辑器":
67
- asyncPage = true
68
- break;
69
- case "变量编辑器":
70
- asyncVariable = true
71
- break;
72
- case "变量与逻辑":
73
- asyncPage = true
74
- asyncVariable = true
75
- break;
76
- }
77
- if(asyncPage) {
78
- pages.forEach(({ content, name: fileName }) => {
79
- fs.writeFileSync(`${name}/${fileName}.js`, content, {
80
- cwd: process.cwd(),
81
- });
82
- });
83
- }
84
- if(asyncVariable) {
85
- variables.forEach(({ key, value: variableValue }) => {
86
- fs.writeFileSync(`${name}/${key}.json`, JSON.stringify(variableValue, (key, value) => {
87
- if (typeof value === "string") {
88
- return string2Data(value);
89
- }
90
- return value;
91
- }, 2) , {
92
- cwd: process.cwd(),
93
- });
94
- });
95
- }
96
- }
97
- catch(err) {
98
- log.error("解析daml失败,请检查请求是否过期或无法访问")
99
- }
100
- }).catch(err => {
101
- log.error("请求daml失败,请检查daml是否过期或无法访问")
102
- });
103
- };
104
-
105
- module.exports = getFiles;