easy-soft-develop 2.1.5 → 2.1.12

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": "easy-soft-develop",
3
- "version": "2.1.5",
3
+ "version": "2.1.12",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/kityandhero/easy-soft-develop#readme",
6
6
  "bugs": {
@@ -0,0 +1,47 @@
1
+ const {
2
+ writeJsonFileSync,
3
+ readJsonFileSync,
4
+ existFileSync,
5
+ mkdirSync,
6
+ } = require('../tools/meta');
7
+
8
+ const developInitialEnvironment = {
9
+ publishWithOpt: false,
10
+ };
11
+
12
+ const developInitialEnvironmentConfigFilePath =
13
+ './develop/config/develop.initial.environment.json';
14
+
15
+ function createDevelopInitialEnvironmentConfigFile() {
16
+ mkdirSync(`./develop`);
17
+
18
+ mkdirSync(`./develop/config`);
19
+
20
+ writeJsonFileSync(
21
+ developInitialEnvironmentConfigFilePath,
22
+ developInitialEnvironment,
23
+ {
24
+ coverFile: false,
25
+ },
26
+ );
27
+ }
28
+
29
+ function getDevelopInitialEnvironmentConfig() {
30
+ const developInitialEnvironmentConfigFileExist = existFileSync(
31
+ developInitialEnvironmentConfigFilePath,
32
+ );
33
+
34
+ if (!developInitialEnvironmentConfigFileExist) {
35
+ createDevelopInitialEnvironmentConfigFile();
36
+ }
37
+
38
+ return {
39
+ ...developInitialEnvironment,
40
+ ...readJsonFileSync(developInitialEnvironmentConfigFilePath),
41
+ };
42
+ }
43
+
44
+ module.exports = {
45
+ createDevelopInitialEnvironmentConfigFile,
46
+ getDevelopInitialEnvironmentConfig,
47
+ };
@@ -25,6 +25,9 @@ const {
25
25
  getMainDevelopPackages,
26
26
  getProjectDevelopPackages,
27
27
  } = require('../tools/package.dependence');
28
+ const {
29
+ createDevelopInitialEnvironmentConfigFile,
30
+ } = require('../config/develop.initial.environment');
28
31
 
29
32
  function createLernaProjectFolder(name) {
30
33
  mkdirSync(`./${name}`);
@@ -79,7 +82,7 @@ function createPnpmWorkspaceFile() {
79
82
  }
80
83
  }
81
84
 
82
- function createLernaConfigFile(lernaName) {
85
+ function createLernaConfigFile(packageName) {
83
86
  const content = `{
84
87
  "packages": ["packages/*"],
85
88
  "version": "independent",
@@ -92,12 +95,12 @@ function createLernaConfigFile(lernaName) {
92
95
  },
93
96
  "version": {
94
97
  "conventionalCommits": true,
95
- "message": "chore(${lernaName}): version",
98
+ "message": "chore(${packageName}): version",
96
99
  "changelogPreset": "conventional-changelog-conventionalcommits"
97
100
  },
98
101
  "publish": {
99
102
  "conventionalCommits": true,
100
- "message": "chore(${lernaName}): publish",
103
+ "message": "chore(${packageName}): publish",
101
104
  "changelogPreset": "conventional-changelog-conventionalcommits"
102
105
  }
103
106
  }
@@ -218,6 +221,10 @@ function createVscode() {
218
221
  function initialEnvironment() {
219
222
  mkdirSync(`./develop`);
220
223
 
224
+ mkdirSync(`./develop/config`);
225
+
226
+ createDevelopInitialEnvironmentConfigFile();
227
+
221
228
  promptSuccess(`step *: config environment`);
222
229
 
223
230
  promptEmptyLine();
@@ -278,7 +285,7 @@ function createLernaProject(name) {
278
285
  }
279
286
 
280
287
  createLernaPackageJsonFile(lernaName);
281
- createLernaConfigFile(lernaName);
288
+ createLernaConfigFile(name);
282
289
  createPnpmWorkspaceFile();
283
290
 
284
291
  createProjectFolder(name);
@@ -1,3 +1,6 @@
1
+ const {
2
+ getDevelopInitialEnvironmentConfig,
3
+ } = require('../config/develop.initial.environment');
1
4
  const { fileGlobalHeader } = require('./template.config');
2
5
 
3
6
  const folderPath = './develop/config/package';
@@ -65,7 +68,13 @@ const globalChildPackageFile = {
65
68
  fileContent: globalChildPackageFileContent,
66
69
  };
67
70
 
68
- const globalMainPackageFileContent = `${fileGlobalHeader}
71
+ function getGlobalMainPackageFileContent() {
72
+ const developInitialEnvironmentConfig = getDevelopInitialEnvironmentConfig();
73
+
74
+ const publishWithOpt =
75
+ developInitialEnvironmentConfig.publishWithOpt || false;
76
+
77
+ return `${fileGlobalHeader}
69
78
  const lintScript = {
70
79
  'z:lint:staged': 'npx lint-staged',
71
80
  'z:lint:staged:quiet': 'npx lint-staged --quiet',
@@ -106,7 +115,7 @@ const environmentScript = {
106
115
  };
107
116
 
108
117
  const lernaScript = {
109
- 'z:lerna:publish': 'lerna publish --yes',
118
+ 'z:lerna:publish': 'lerna publish --yes${publishWithOpt ? ' --otp' : ''}',
110
119
  'z:lerna:bootstrap':
111
120
  'npm run z:clean && npm run z:husky:install && git pull && npm run z:install',
112
121
  };
@@ -165,12 +174,13 @@ module.exports = {
165
174
  ...ncuScript,
166
175
  };
167
176
  `;
177
+ }
168
178
 
169
179
  const globalMainPackageFile = {
170
180
  folderPath: `${folderPath}/template`,
171
181
  fileName: 'main.content.js',
172
182
  coverFile: true,
173
- fileContent: globalMainPackageFileContent,
183
+ fileContent: getGlobalMainPackageFileContent(),
174
184
  };
175
185
 
176
186
  const customMainPackageFileContent = `${fileGlobalHeader}
@@ -0,0 +1,2 @@
1
+ export function createDevelopInitialEnvironmentConfigFile(): void;
2
+ export function getDevelopInitialEnvironmentConfig(): any;
@@ -11,7 +11,7 @@ export namespace globalMainPackageFile {
11
11
  export { fileName_1 as fileName };
12
12
  const coverFile_1: boolean;
13
13
  export { coverFile_1 as coverFile };
14
- export { globalMainPackageFileContent as fileContent };
14
+ export const fileContent: string;
15
15
  }
16
16
  export namespace customMainPackageFile {
17
17
  const folderPath_2: string;
@@ -32,7 +32,6 @@ export namespace customChildPackageFile {
32
32
  export { customChildPackageFileContent as fileContent };
33
33
  }
34
34
  declare const globalChildPackageFileContent: string;
35
- declare const globalMainPackageFileContent: string;
36
35
  declare const customMainPackageFileContent: string;
37
36
  declare const customChildPackageFileContent: string;
38
37
  export {};