easy-soft-develop 2.0.139 → 2.0.147

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
@@ -7,7 +7,7 @@ const createAssistScripts = require('../src/cliCollection/create-assist-scripts.
7
7
  const checkAllPackageVersion = require('../src/cliCollection/check-all-package-version');
8
8
  const updateAllPackageVersion = require('../src/cliCollection/update-all-package-version');
9
9
  const sleep = require('../src/cliCollection/sleep');
10
- const publish = require('../src/cliCollection/publish');
10
+ const publishToNpm = require('../src/cliCollection/publish-to-npm');
11
11
  const commitRefresh = require('../src/cliCollection/commit-refresh');
12
12
  const createLernaProject = require('../src/cliCollection/create-lerna-project');
13
13
  const clearAllDependence = require('../src/cliCollection/clear-all-dependence');
@@ -53,9 +53,10 @@ program
53
53
 
54
54
  program
55
55
  .command('publish')
56
- .description('publish to npm by script "z:publish:npm-all"')
57
- .action(() => {
58
- publish.run();
56
+ .description('publish public packages to npm')
57
+ .option('--packages <string>', 'the packages will publish')
58
+ .action((a, o) => {
59
+ publishToNpm.run(a, o);
59
60
  });
60
61
 
61
62
  program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-soft-develop",
3
- "version": "2.0.139",
3
+ "version": "2.0.147",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/kityandhero/easy-soft-develop#readme",
6
6
  "bugs": {
@@ -33,8 +33,8 @@
33
33
  "cz": "cz",
34
34
  "postcz": "git push",
35
35
  "publish:npm": "npm run publish:patch:npm",
36
- "prepublish:patch:npm": "npm run cz&& npm version patch && npm run change:npm:registry:npm",
37
- "publish:patch:npm": "npm publish",
36
+ "prepublish:patch:npm": "npm run cz&& npm version patch",
37
+ "publish:patch:npm": "npm publish --registry https://registry.npmjs.org/",
38
38
  "postpublish:patch:npm": "npm run change:npm:registry:local",
39
39
  "test:bin:check-all-package-version": "node ./bin/cli.js check-all-package-version",
40
40
  "test:bin:commit-refresh": "node ./bin/cli.js commit-refresh",
@@ -0,0 +1,48 @@
1
+ const { loopPackage } = require('../tools/package.tools');
2
+ const {
3
+ exit,
4
+ exec,
5
+ promptInfo,
6
+ promptSuccess,
7
+ promptError,
8
+ cd,
9
+ checkStringIsEmpty,
10
+ checkInCollection,
11
+ promptEmptyLine,
12
+ } = require('../tools/meta');
13
+
14
+ exports.run = function (s, o) {
15
+ const {
16
+ _optionValues: { packages },
17
+ } = o;
18
+
19
+ if (checkStringIsEmpty(packages)) {
20
+ exit();
21
+ }
22
+
23
+ const packageList = packages.split(',');
24
+
25
+ promptInfo('publish public packages to npm');
26
+
27
+ loopPackage(({ name, absolutePath }) => {
28
+ if (checkInCollection(packageList, name)) {
29
+ cd(absolutePath);
30
+
31
+ try {
32
+ promptInfo(
33
+ `package ${name}: npm publish --registry https://registry.npmjs.org/`,
34
+ );
35
+
36
+ exec(`npm publish --registry https://registry.npmjs.org/`);
37
+
38
+ promptEmptyLine();
39
+ } catch (error) {
40
+ promptError(error);
41
+ }
42
+ }
43
+ });
44
+
45
+ promptSuccess('publish complete');
46
+
47
+ exit();
48
+ };
@@ -82,10 +82,9 @@ const toolsScript = {
82
82
  const publishScript = {
83
83
  changelog:
84
84
  'lerna version --conventional-commits --no-push --no-git-tag-version',
85
- 'z:publish-npm-all': 'npx easy-soft-develop publish',
86
85
  'prez:publish:lerna': 'npm run z:change:npm:registry:npm',
87
86
  'z:publish:lerna': 'lerna updated && npm run z:lerna:publish',
88
- 'postz:publish:lerna': 'npm run z:change:npm:registry:local && npm run z:publish-npm-all',
87
+ 'postz:publish:lerna': 'npm run z:change:npm:registry:local && npm run z:publish:npm-all',
89
88
  'prez:publish:build': 'npm run z:install && npm run cz && npm run z:build:all',
90
89
  'z:publish:build': 'npm run z:publish:lerna',
91
90
  };
@@ -82,10 +82,18 @@ function adjustMainPackageJsonScript({ scripts }) {
82
82
  }
83
83
  });
84
84
 
85
+ const publishPackageNameList = [];
86
+
87
+ loopPackage(({ name }) => {
88
+ publishPackageNameList.push(name);
89
+ });
90
+
85
91
  packageJson.scripts = assignObject(
86
92
  {
87
93
  'z:build:all': 'echo please supplement build all packages commend',
88
- 'z:publish:npm-all': 'echo please supplement publish to npm commend',
94
+ 'z:publish:npm-all': `npx easy-soft-develop publish --packages ${publishPackageNameList.join(
95
+ ',',
96
+ )}`,
89
97
  },
90
98
  globalScript,
91
99
  originalScript || {},
@@ -0,0 +1 @@
1
+ export function run(s: any, o: any): void;
@@ -1,9 +0,0 @@
1
- const { exit, exec } = require('../tools/meta');
2
-
3
- exports.run = function () {
4
- exec('npm run npm run z:change:npm:registry:npm');
5
- exec(`npm run z:publish:npm-all`);
6
- exec('npm run npm run z:change:npm:registry:local');
7
-
8
- exit();
9
- };