easy-soft-develop 2.1.13 → 2.1.14

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/bin/cli.js CHANGED
@@ -57,7 +57,7 @@ program
57
57
  .command('publish')
58
58
  .description('publish public packages to npm')
59
59
  .option('--packages <string>', 'the packages will publish')
60
- .requiredOption('--opt <string>', 'use npm one-time password', false)
60
+ .option('--opt <boolean>', 'use npm one-time password', false)
61
61
  .action((a, o) => {
62
62
  publishToNpm.run(a, o);
63
63
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-soft-develop",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/kityandhero/easy-soft-develop#readme",
6
6
  "bugs": {
@@ -29,9 +29,9 @@
29
29
  "commitlint": "npx commitlint --edit",
30
30
  "test:bin:check-all-package-version": "node ./bin/cli.js check-all-package-version",
31
31
  "test:bin:code": "node ./bin/cli.js code --dataPath ./develop/generatorCodeSource/code.json",
32
- "test:bin:commit-refresh": "node ./bin/cli.js commit-refresh",
33
32
  "test:bin:create-assist-scripts": "node ./bin/cli.js create-assist-scripts",
34
33
  "test:bin:create-lerna-project": "node ./bin/cli.js create-lerna-project",
34
+ "test:bin:publish": "node ./bin/cli.js publish --packages ss --opt true",
35
35
  "test:bin:sleep": "node ./bin/cli.js sleep --second 2 --showInfo true",
36
36
  "test:bin:update-all-package-version": "node ./bin/cli.js update-all-package-version",
37
37
  "test:commitRefresh": "node ./test/commitRefresh.test.js",
@@ -61,6 +61,7 @@
61
61
  "commander": "^10.0.0",
62
62
  "download": "^8.0.0",
63
63
  "download-git-repo": "^3.0.2",
64
+ "enquirer": "^2.3.6",
64
65
  "fs-extra": "^11.1.1",
65
66
  "hpagent": "^1.2.0",
66
67
  "ping": "^0.4.4",
@@ -1,3 +1,5 @@
1
+ const { prompt: promptAssist } = require('enquirer');
2
+
1
3
  const { loopPackage } = require('../tools/package.tools');
2
4
  const {
3
5
  exit,
@@ -11,17 +13,11 @@ const {
11
13
  promptEmptyLine,
12
14
  } = require('../tools/meta');
13
15
 
14
- exports.run = function (s, o) {
15
- const {
16
- _optionValues: { packages, opt },
17
- } = o;
18
-
16
+ function publishToNpm(packages, o, useOpt, opt) {
19
17
  if (checkStringIsEmpty(packages)) {
20
18
  exit();
21
19
  }
22
20
 
23
- const useOpt = !!opt;
24
-
25
21
  const packageList = packages.split(',');
26
22
 
27
23
  promptInfo('publish public packages to npm');
@@ -33,13 +29,13 @@ exports.run = function (s, o) {
33
29
  try {
34
30
  promptInfo(
35
31
  `package ${name}: npm publish --registry https://registry.npmjs.org/${
36
- useOpt ? ' --opt' : ''
32
+ useOpt ? ` --opt ${opt}` : ''
37
33
  }`,
38
34
  );
39
35
 
40
36
  exec(
41
37
  `npm publish --registry https://registry.npmjs.org/${
42
- useOpt ? ' --opt' : ''
38
+ useOpt ? ` --opt ${opt}` : ''
43
39
  }`,
44
40
  );
45
41
 
@@ -53,4 +49,24 @@ exports.run = function (s, o) {
53
49
  promptSuccess('publish complete');
54
50
 
55
51
  exit();
52
+ }
53
+
54
+ exports.run = async function (s, o) {
55
+ const { packages, opt: useOpt } = s;
56
+
57
+ const useOptAdjust = !!useOpt;
58
+
59
+ if (!useOptAdjust) {
60
+ publishToNpm(packages, o, useOptAdjust, '');
61
+
62
+ return;
63
+ }
64
+
65
+ const { opt } = await promptAssist({
66
+ type: 'input',
67
+ name: 'opt',
68
+ message: 'input npm one-time password',
69
+ });
70
+
71
+ publishToNpm(packages, o, useOptAdjust, opt);
56
72
  };
@@ -1 +1 @@
1
- export function run(s: any, o: any): void;
1
+ export function run(s: any, o: any): Promise<void>;