easy-soft-develop 2.1.6 → 2.1.13
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 +1 -0
- package/package.json +1 -1
- package/src/cliCollection/publish-to-npm.js +11 -3
- package/src/config/develop.initial.environment.js +47 -0
- package/src/project/initProject.js +11 -4
- package/src/templates/package.template.js +4 -2
- package/src/tools/initial.environment.js +9 -1
- package/types/config/develop.initial.environment.d.ts +2 -0
- package/types/templates/package.template.d.ts +1 -2
package/bin/cli.js
CHANGED
|
@@ -57,6 +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
61
|
.action((a, o) => {
|
|
61
62
|
publishToNpm.run(a, o);
|
|
62
63
|
});
|
package/package.json
CHANGED
|
@@ -13,13 +13,15 @@ const {
|
|
|
13
13
|
|
|
14
14
|
exports.run = function (s, o) {
|
|
15
15
|
const {
|
|
16
|
-
_optionValues: { packages },
|
|
16
|
+
_optionValues: { packages, opt },
|
|
17
17
|
} = o;
|
|
18
18
|
|
|
19
19
|
if (checkStringIsEmpty(packages)) {
|
|
20
20
|
exit();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
const useOpt = !!opt;
|
|
24
|
+
|
|
23
25
|
const packageList = packages.split(',');
|
|
24
26
|
|
|
25
27
|
promptInfo('publish public packages to npm');
|
|
@@ -30,10 +32,16 @@ exports.run = function (s, o) {
|
|
|
30
32
|
|
|
31
33
|
try {
|
|
32
34
|
promptInfo(
|
|
33
|
-
`package ${name}: npm publish --registry https://registry.npmjs.org
|
|
35
|
+
`package ${name}: npm publish --registry https://registry.npmjs.org/${
|
|
36
|
+
useOpt ? ' --opt' : ''
|
|
37
|
+
}`,
|
|
34
38
|
);
|
|
35
39
|
|
|
36
|
-
exec(
|
|
40
|
+
exec(
|
|
41
|
+
`npm publish --registry https://registry.npmjs.org/${
|
|
42
|
+
useOpt ? ' --opt' : ''
|
|
43
|
+
}`,
|
|
44
|
+
);
|
|
37
45
|
|
|
38
46
|
promptEmptyLine();
|
|
39
47
|
} catch (error) {
|
|
@@ -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(
|
|
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(${
|
|
98
|
+
"message": "chore(${packageName}): version",
|
|
96
99
|
"changelogPreset": "conventional-changelog-conventionalcommits"
|
|
97
100
|
},
|
|
98
101
|
"publish": {
|
|
99
102
|
"conventionalCommits": true,
|
|
100
|
-
"message": "chore(${
|
|
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(
|
|
288
|
+
createLernaConfigFile(name);
|
|
282
289
|
createPnpmWorkspaceFile();
|
|
283
290
|
|
|
284
291
|
createProjectFolder(name);
|
|
@@ -65,7 +65,8 @@ const globalChildPackageFile = {
|
|
|
65
65
|
fileContent: globalChildPackageFileContent,
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
function getGlobalMainPackageFileContent() {
|
|
69
|
+
return `${fileGlobalHeader}
|
|
69
70
|
const lintScript = {
|
|
70
71
|
'z:lint:staged': 'npx lint-staged',
|
|
71
72
|
'z:lint:staged:quiet': 'npx lint-staged --quiet',
|
|
@@ -165,12 +166,13 @@ module.exports = {
|
|
|
165
166
|
...ncuScript,
|
|
166
167
|
};
|
|
167
168
|
`;
|
|
169
|
+
}
|
|
168
170
|
|
|
169
171
|
const globalMainPackageFile = {
|
|
170
172
|
folderPath: `${folderPath}/template`,
|
|
171
173
|
fileName: 'main.content.js',
|
|
172
174
|
coverFile: true,
|
|
173
|
-
fileContent:
|
|
175
|
+
fileContent: getGlobalMainPackageFileContent(),
|
|
174
176
|
};
|
|
175
177
|
|
|
176
178
|
const customMainPackageFileContent = `${fileGlobalHeader}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const {
|
|
2
|
+
getDevelopInitialEnvironmentConfig,
|
|
3
|
+
} = require('../config/develop.initial.environment');
|
|
1
4
|
const { checkInCollection, checkStringIsEmpty, mkdirSync } = require('./meta');
|
|
2
5
|
const {
|
|
3
6
|
promptSuccess,
|
|
@@ -114,12 +117,17 @@ function adjustMainPackageJsonScript({ scripts }) {
|
|
|
114
117
|
testAllProjects.push(`npm run test:${name}`);
|
|
115
118
|
});
|
|
116
119
|
|
|
120
|
+
const developInitialEnvironmentConfig = getDevelopInitialEnvironmentConfig();
|
|
121
|
+
|
|
122
|
+
const publishWithOpt =
|
|
123
|
+
developInitialEnvironmentConfig.publishWithOpt || false;
|
|
124
|
+
|
|
117
125
|
packageJson.scripts = assignObject(
|
|
118
126
|
{
|
|
119
127
|
'z:build:all': 'echo please supplement build all packages commend',
|
|
120
128
|
'z:publish:npm-all': `easy-soft-develop publish --packages ${publishPackageNameList.join(
|
|
121
129
|
',',
|
|
122
|
-
)}`,
|
|
130
|
+
)}${publishWithOpt ? ' --opt' : ''}`,
|
|
123
131
|
},
|
|
124
132
|
globalScript,
|
|
125
133
|
originalScript || {},
|
|
@@ -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
|
|
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 {};
|