@wagq/wa-cli 0.6.23 → 0.6.24

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/config/command.js CHANGED
@@ -1,8 +1,9 @@
1
1
  const init = require("../lib/init");
2
2
  const server = require("../lib/server");
3
3
  const xlsx2Config = require("../lib/locale/xlsx2Config");
4
- const asyncDaml = require('../lib/daml/async')
5
- const asyncDamlByApp = require('../lib/daml/asyncByApp')
4
+ const asyncDaml = require("../lib/daml/async");
5
+ const asyncDamlByApp = require("../lib/daml/asyncByApp");
6
+ const batchUpdate = require("../lib/batchUpdate");
6
7
 
7
8
  const command = [
8
9
  {
@@ -13,6 +14,14 @@ const command = [
13
14
  asyncDaml();
14
15
  },
15
16
  },
17
+ {
18
+ name: "batchUpdate",
19
+ alias: "bu",
20
+ description: "批量升级依赖包,可以指定组织,只更新组织下的依赖",
21
+ action: () => {
22
+ batchUpdate();
23
+ },
24
+ },
16
25
  {
17
26
  name: "damls",
18
27
  description: `从应用同步所有页面的逻辑器与变量值,
@@ -23,8 +32,8 @@ const command = [
23
32
  appName为应用名称,也是你区分不同应用的标识,所有生成的文件都会放在appName文件夹下`,
24
33
  alias: "da",
25
34
  action: () => {
26
- asyncDamlByApp()
27
- }
35
+ asyncDamlByApp();
36
+ },
28
37
  },
29
38
  {
30
39
  name: "init",
@@ -0,0 +1,18 @@
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;
@@ -0,0 +1,20 @@
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wagq/wa-cli",
3
- "version": "0.6.23",
3
+ "version": "0.6.24",
4
4
  "description": "wa的脚手架",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,20 @@
1
+ const fs = require("fs");
2
+
3
+ const getPackageInfo = () => {
4
+ const packageJson = require("./package.json");
5
+ return packageJson;
6
+ };
7
+
8
+ const getPackageTxt = () => {
9
+ return fs.readFileSync("./package.json", "utf-8");
10
+ };
11
+
12
+ const writePackageTxt = (content) => {
13
+ return fs.writeFileSync("./package.json", content, "utf-8");
14
+ };
15
+
16
+ module.exports = {
17
+ getPackageInfo,
18
+ getPackageTxt,
19
+ writePackageTxt,
20
+ };