easy-soft-develop 2.0.82 → 2.0.110
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 +1 -1
- package/src/cliCollection/update-package-from-package.js +9 -141
- package/src/index.js +8 -4
- package/src/templates/eslint.template.js +330 -68
- package/src/templates/package.template.js +25 -10
- package/src/templates/prettier.template.js +0 -1
- package/src/tools/develop.file.js +84 -5
- package/src/tools/initial.environment.js +6 -6
- package/src/tools/package.script.js +4 -7
- package/src/tools/update.package.from.package.js +153 -0
package/package.json
CHANGED
|
@@ -1,149 +1,17 @@
|
|
|
1
|
-
const download = require('download');
|
|
2
|
-
const agent = require('hpagent');
|
|
3
|
-
|
|
4
1
|
const {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
promptError,
|
|
8
|
-
promptWarn,
|
|
9
|
-
exit,
|
|
10
|
-
readJsonFileSync,
|
|
11
|
-
resolvePath,
|
|
12
|
-
writeJsonFileSync,
|
|
13
|
-
checkStringIsEmpty,
|
|
14
|
-
} = require('../tools/meta');
|
|
15
|
-
|
|
16
|
-
const { HttpsProxyAgent } = agent;
|
|
17
|
-
|
|
18
|
-
function handlePackage({ packageFilePath, packageTempPath }) {
|
|
19
|
-
promptSuccess(`referential package.json :${packageTempPath}`);
|
|
20
|
-
|
|
21
|
-
const packageProjectPath = resolvePath(packageFilePath);
|
|
22
|
-
|
|
23
|
-
const packageJsonTemp = readJsonFileSync(packageTempPath);
|
|
24
|
-
|
|
25
|
-
const packageJsonTarget = readJsonFileSync(packageProjectPath);
|
|
26
|
-
|
|
27
|
-
const dependencies = packageJsonTemp.dependencies;
|
|
28
|
-
const devDependencies = packageJsonTemp.devDependencies;
|
|
29
|
-
|
|
30
|
-
packageJsonTarget.dependencies = dependencies;
|
|
31
|
-
packageJsonTarget.devDependencies = devDependencies;
|
|
32
|
-
|
|
33
|
-
writeJsonFileSync(packageProjectPath, packageJsonTarget, { coverFile: true });
|
|
34
|
-
|
|
35
|
-
promptSuccess(`update package.json success!`);
|
|
36
|
-
|
|
37
|
-
promptLine();
|
|
38
|
-
|
|
39
|
-
exit();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function handleTempPackagePath({ agent, localFile, packageUrl, repo }) {
|
|
43
|
-
let packageTempPath = '';
|
|
44
|
-
|
|
45
|
-
if (localFile) {
|
|
46
|
-
promptSuccess(`use local referential package.json`);
|
|
47
|
-
|
|
48
|
-
promptSuccess(`file path: ${localFile}`);
|
|
49
|
-
|
|
50
|
-
promptLine();
|
|
51
|
-
|
|
52
|
-
packageTempPath = resolvePath(localFile);
|
|
53
|
-
} else {
|
|
54
|
-
promptSuccess(`try ${repo} repo`);
|
|
55
|
-
|
|
56
|
-
if (agent) {
|
|
57
|
-
promptSuccess(`agent: ${agent}`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
promptSuccess(`${repo} repo: ${packageUrl}`);
|
|
61
|
-
|
|
62
|
-
await download(packageUrl, resolvePath(`./temp`), {
|
|
63
|
-
...(agent
|
|
64
|
-
? {
|
|
65
|
-
agent: {
|
|
66
|
-
https: new HttpsProxyAgent({
|
|
67
|
-
keepAlive: true,
|
|
68
|
-
keepAliveMsecs: 1000,
|
|
69
|
-
maxSockets: 256,
|
|
70
|
-
maxFreeSockets: 256,
|
|
71
|
-
scheduling: 'lifo',
|
|
72
|
-
proxy: agent,
|
|
73
|
-
}),
|
|
74
|
-
},
|
|
75
|
-
}
|
|
76
|
-
: {}),
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
promptSuccess(`use ${repo} repo success!`);
|
|
80
|
-
|
|
81
|
-
packageTempPath = resolvePath(`./temp/package.json`);
|
|
82
|
-
|
|
83
|
-
promptSuccess(`packageTempPath: ${packageTempPath}`);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return packageTempPath;
|
|
87
|
-
}
|
|
2
|
+
updatePackageFromPackage,
|
|
3
|
+
} = require('../tools/update.package.from.package');
|
|
88
4
|
|
|
89
5
|
exports.run = async function (s, o) {
|
|
90
6
|
const {
|
|
91
7
|
_optionValues: { path, primaryRemoteUrl, spareRemoteUrl, agent, localFile },
|
|
92
8
|
} = o;
|
|
93
9
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
promptSuccess(`prepare to update package.json: `);
|
|
103
|
-
|
|
104
|
-
promptLine();
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
packageTempPath = await handleTempPackagePath({
|
|
108
|
-
agent,
|
|
109
|
-
localFile,
|
|
110
|
-
packageUrl: primaryRemoteUrl,
|
|
111
|
-
repo: 'github',
|
|
112
|
-
});
|
|
113
|
-
} catch (error) {
|
|
114
|
-
if (checkStringIsEmpty(primaryRemoteUrl)) {
|
|
115
|
-
promptError('please input spare remote package.json url');
|
|
116
|
-
|
|
117
|
-
exit();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
promptLine();
|
|
121
|
-
|
|
122
|
-
promptWarn(
|
|
123
|
-
`use github repo failure! switch to gitee, gitee repo possible update delay.`,
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
promptLine();
|
|
127
|
-
|
|
128
|
-
try {
|
|
129
|
-
packageTempPath = await handleTempPackagePath({
|
|
130
|
-
agent: '',
|
|
131
|
-
localFile,
|
|
132
|
-
packageUrl: spareRemoteUrl,
|
|
133
|
-
repo: 'gitee',
|
|
134
|
-
});
|
|
135
|
-
} catch (error) {
|
|
136
|
-
promptLine();
|
|
137
|
-
|
|
138
|
-
promptError(error);
|
|
139
|
-
|
|
140
|
-
promptLine();
|
|
141
|
-
|
|
142
|
-
promptWarn('download error, please check network');
|
|
143
|
-
|
|
144
|
-
exit();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
handlePackage(path, packageTempPath);
|
|
10
|
+
await updatePackageFromPackage({
|
|
11
|
+
path,
|
|
12
|
+
primaryRemoteUrl,
|
|
13
|
+
spareRemoteUrl,
|
|
14
|
+
agent,
|
|
15
|
+
localFile,
|
|
16
|
+
});
|
|
149
17
|
};
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
const { exec } = require('./tools/meta');
|
|
2
|
+
const { sleep } = require('./tools/sleep');
|
|
1
3
|
const { clean } = require('./tools/clean');
|
|
2
4
|
const { commitRefresh } = require('./tools/commit.refresh');
|
|
3
5
|
const {
|
|
4
6
|
createCleanScriptFile,
|
|
5
7
|
createPackageCheckSpecialVersionScriptFile,
|
|
6
|
-
|
|
8
|
+
createInstallGlobalDevelopDependenceScriptFile,
|
|
7
9
|
createDevelopFiles,
|
|
8
10
|
} = require('./tools/develop.file');
|
|
9
11
|
const { initialEnvironment } = require('./tools/initial.environment');
|
|
@@ -24,8 +26,9 @@ const {
|
|
|
24
26
|
updateSpecialPackageVersion,
|
|
25
27
|
updateAllPackageVersion,
|
|
26
28
|
} = require('./tools/package.update');
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
+
const {
|
|
30
|
+
updatePackageFromPackage,
|
|
31
|
+
} = require('./tools/update.package.from.package');
|
|
29
32
|
|
|
30
33
|
module.exports = {
|
|
31
34
|
clean,
|
|
@@ -40,10 +43,11 @@ module.exports = {
|
|
|
40
43
|
sleep,
|
|
41
44
|
createCleanScriptFile,
|
|
42
45
|
createPackageCheckSpecialVersionScriptFile,
|
|
43
|
-
|
|
46
|
+
createInstallGlobalDevelopDependenceScriptFile,
|
|
44
47
|
createDevelopFiles,
|
|
45
48
|
prettierAllFile,
|
|
46
49
|
prettierChangeFile,
|
|
47
50
|
prettierAllPackageJson,
|
|
48
51
|
prettierCurrentPackageJson,
|
|
52
|
+
updatePackageFromPackage,
|
|
49
53
|
};
|
|
@@ -3,12 +3,14 @@ const { fileGlobalHeader } = require('./template.config');
|
|
|
3
3
|
const folderPath = './develop/config/eslint';
|
|
4
4
|
|
|
5
5
|
const ignoreFileContent = `${fileGlobalHeader}
|
|
6
|
-
const content =
|
|
6
|
+
const content = \`#
|
|
7
|
+
**/public
|
|
7
8
|
**/lib
|
|
8
9
|
**/es
|
|
9
10
|
**/.history
|
|
10
11
|
**/.vs
|
|
11
12
|
**/.swc
|
|
13
|
+
|
|
12
14
|
*.d.ts
|
|
13
15
|
*.log
|
|
14
16
|
*.zip
|
|
@@ -16,6 +18,10 @@ const content = \`**/public
|
|
|
16
18
|
*.7z
|
|
17
19
|
*.min.js
|
|
18
20
|
rollup.config-*.cjs
|
|
21
|
+
|
|
22
|
+
.eslintrc.js
|
|
23
|
+
.prettierrc.js
|
|
24
|
+
.stylelintrc.js
|
|
19
25
|
\`;
|
|
20
26
|
|
|
21
27
|
module.exports = {
|
|
@@ -60,46 +66,29 @@ const { rules } = require('./items/rules');
|
|
|
60
66
|
const { parserOptions } = require('./items/parser');
|
|
61
67
|
const { pluginCollection } = require('./items/plugins');
|
|
62
68
|
const { extendCollection } = require('./items/extends');
|
|
69
|
+
const { settings } = require('./items/settings');
|
|
63
70
|
|
|
64
71
|
module.exports = {
|
|
65
72
|
generalConfig: {
|
|
66
73
|
extends: [
|
|
67
|
-
'eslint:recommended',
|
|
68
|
-
'plugin:react/recommended',
|
|
69
|
-
'plugin:unicorn/recommended',
|
|
70
|
-
'plugin:promise/recommended',
|
|
71
|
-
'prettier',
|
|
72
74
|
...extendCollection,
|
|
73
75
|
],
|
|
74
|
-
env: {
|
|
76
|
+
env: {
|
|
77
|
+
es6: true,
|
|
78
|
+
browser: true,
|
|
79
|
+
commonjs: true,
|
|
80
|
+
jest: true,
|
|
81
|
+
worker: true,
|
|
82
|
+
shelljs: true,
|
|
83
|
+
node: true,
|
|
84
|
+
},
|
|
75
85
|
plugins: [
|
|
76
|
-
'unicorn',
|
|
77
|
-
'simple-import-sort',
|
|
78
|
-
'import',
|
|
79
|
-
'prettier',
|
|
80
86
|
...pluginCollection,
|
|
81
87
|
],
|
|
82
88
|
parser: '@babel/eslint-parser',
|
|
83
89
|
parserOptions: parserOptions,
|
|
84
90
|
rules: rules,
|
|
85
|
-
settings:
|
|
86
|
-
'import/parsers': {
|
|
87
|
-
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
88
|
-
},
|
|
89
|
-
'import/resolver': {
|
|
90
|
-
node: {
|
|
91
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
92
|
-
moduleDirectory: ['src', 'node_modules'],
|
|
93
|
-
},
|
|
94
|
-
typescript: {
|
|
95
|
-
// always try to resolve types under \`<root>@types\` directory even it doesn't contain any source code, like \`@types/unIst\`
|
|
96
|
-
alwaysTryTypes: true,
|
|
97
|
-
|
|
98
|
-
// use an array of glob patterns
|
|
99
|
-
directory: ['./tsconfig.json', './packages/*/tsconfig.json'],
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
91
|
+
settings: settings,
|
|
103
92
|
},
|
|
104
93
|
};
|
|
105
94
|
`;
|
|
@@ -111,9 +100,24 @@ const configFile = {
|
|
|
111
100
|
fileContent: configFileContent,
|
|
112
101
|
};
|
|
113
102
|
|
|
114
|
-
const
|
|
115
|
-
const
|
|
103
|
+
const ruleEmbedFileContent = `${fileGlobalHeader}
|
|
104
|
+
const coreRules = {
|
|
116
105
|
camelias: 0,
|
|
106
|
+
'no-bitwise': 0,
|
|
107
|
+
'linebreak-style': 0,
|
|
108
|
+
'generator-star-spacing': 0,
|
|
109
|
+
'operator-linebreak': 0,
|
|
110
|
+
'object-curly-newline': 0,
|
|
111
|
+
'no-use-before-define': 0,
|
|
112
|
+
'no-nested-ternary': 0,
|
|
113
|
+
'no-spaced-func': 2,
|
|
114
|
+
'no-this-before-super': 0,
|
|
115
|
+
'no-var': 1,
|
|
116
|
+
'sort-imports': 0,
|
|
117
|
+
'jsx-quotes': ['error', 'prefer-double'],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const reactRules = {
|
|
117
121
|
'react/sort-comp': 0,
|
|
118
122
|
'react/jsx-uses-react': 'off',
|
|
119
123
|
'react/react-in-jsx-scope': 'off',
|
|
@@ -123,26 +127,42 @@ const generalRules = {
|
|
|
123
127
|
'react/forbid-prop-types': 0,
|
|
124
128
|
'react/jsx-one-expression-per-line': 0,
|
|
125
129
|
'react/jsx-props-no-spreading': 0,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const jsxRules = {
|
|
126
133
|
'jsx-a11y/no-noninteractive-element-interactions': 0,
|
|
127
134
|
'jsx-a11y/click-events-have-key-events': 0,
|
|
128
135
|
'jsx-a11y/no-static-element-interactions': 0,
|
|
129
136
|
'jsx-a11y/anchor-is-valid': 0,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
'operator-linebreak': 0,
|
|
134
|
-
'object-curly-newline': 0,
|
|
135
|
-
'no-use-before-define': 0,
|
|
136
|
-
'no-nested-ternary': 0,
|
|
137
|
-
'no-spaced-func': 2,
|
|
138
|
-
'no-this-before-super': 0,
|
|
139
|
-
'no-var': 1,
|
|
140
|
-
'compat/compat': 0,
|
|
141
|
-
'sort-imports': 0,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const typescriptRules = {
|
|
142
140
|
'@typescript-eslint/no-this-alias': ['off'],
|
|
143
141
|
'@typescript-eslint/no-unused-vars': 0,
|
|
144
142
|
'@typescript-eslint/no-invalid-this': 0,
|
|
145
|
-
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const unicornRules = {
|
|
146
|
+
'unicorn/filename-case': [
|
|
147
|
+
'error',
|
|
148
|
+
{
|
|
149
|
+
cases: {
|
|
150
|
+
kebabCase: true,
|
|
151
|
+
camelCase: true,
|
|
152
|
+
pascalCase: true,
|
|
153
|
+
snakeCase: true,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
'unicorn/no-null': 0,
|
|
158
|
+
'unicorn/no-this-assignment': 0,
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const compatRules = {
|
|
162
|
+
'compat/compat': 0,
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const importRules = {
|
|
146
166
|
'import/export': 'error',
|
|
147
167
|
'import/first': 'error',
|
|
148
168
|
'import/named': 'error',
|
|
@@ -155,10 +175,10 @@ const generalRules = {
|
|
|
155
175
|
'import/no-unresolved': 'error',
|
|
156
176
|
'import/no-useless-path-segments': 'error',
|
|
157
177
|
'import/no-unused-modules': 'error',
|
|
178
|
+
'import/order': 0,
|
|
158
179
|
};
|
|
159
180
|
|
|
160
|
-
const
|
|
161
|
-
'import/order': 0,
|
|
181
|
+
const simpleImportSortRules = {
|
|
162
182
|
'simple-import-sort/imports': [
|
|
163
183
|
'error',
|
|
164
184
|
{
|
|
@@ -169,67 +189,298 @@ const sortRules = {
|
|
|
169
189
|
],
|
|
170
190
|
['^(?!@/)(?!easy-soft-)(?!.)'],
|
|
171
191
|
['^easy-soft-'],
|
|
172
|
-
['^(?!@/)(?!taro-fast-)(?!.)'],
|
|
173
|
-
['^taro-fast-'],
|
|
174
192
|
['^(?!@/)(?!antd-management-fast-)(?!.)'],
|
|
175
193
|
['^antd-management-fast-'],
|
|
194
|
+
['^(?!@/)(?!taro-fast-)(?!.)'],
|
|
195
|
+
['^taro-fast-'],
|
|
176
196
|
['^((@/).*|$)'],
|
|
177
|
-
['
|
|
178
|
-
['
|
|
179
|
-
['
|
|
180
|
-
['
|
|
197
|
+
['^\\\\u0000'],
|
|
198
|
+
['^\\\\.\\\\.(?!/?$)', '^\\\\.\\\\./?$'],
|
|
199
|
+
['^\\\\./(?=.*/)(?!/?$)', '^\\\\.(?!/?$)', '^\\\\./?$'],
|
|
200
|
+
['^.+\\\\.s?less$', '^.+\\\\.s?scss$', '^.+\\\\.s?css$'],
|
|
181
201
|
],
|
|
182
202
|
},
|
|
183
203
|
],
|
|
184
204
|
'simple-import-sort/exports': 'error',
|
|
185
|
-
'sort-imports': 0,
|
|
186
205
|
};
|
|
187
206
|
|
|
188
207
|
module.exports = {
|
|
189
|
-
rules: {
|
|
208
|
+
rules: {
|
|
209
|
+
...coreRules,
|
|
210
|
+
...reactRules,
|
|
211
|
+
...jsxRules,
|
|
212
|
+
...typescriptRules,
|
|
213
|
+
...unicornRules,
|
|
214
|
+
...compatRules,
|
|
215
|
+
...importRules,
|
|
216
|
+
...simpleImportSortRules,
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
`;
|
|
220
|
+
|
|
221
|
+
const ruleEmbedFile = {
|
|
222
|
+
folderPath: `${folderPath}/config/items/rules`,
|
|
223
|
+
fileName: 'embed.js',
|
|
224
|
+
coverFile: true,
|
|
225
|
+
fileContent: ruleEmbedFileContent,
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const ruleCustomFileContent = `${fileGlobalHeader}
|
|
229
|
+
const customRules = {};
|
|
230
|
+
|
|
231
|
+
module.exports = {
|
|
232
|
+
rules: {
|
|
233
|
+
...customRules,
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
`;
|
|
237
|
+
|
|
238
|
+
const ruleCustomFile = {
|
|
239
|
+
folderPath: `${folderPath}/config/items/rules`,
|
|
240
|
+
fileName: 'custom.js',
|
|
241
|
+
coverFile: false,
|
|
242
|
+
fileContent: ruleCustomFileContent,
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const ruleFileContent = `${fileGlobalHeader}
|
|
246
|
+
const { rules: embedRules } = require('./embed');
|
|
247
|
+
const { rules: customRules } = require('./custom');
|
|
248
|
+
|
|
249
|
+
module.exports = {
|
|
250
|
+
rules: {
|
|
251
|
+
...embedRules,
|
|
252
|
+
...customRules,
|
|
253
|
+
},
|
|
190
254
|
};
|
|
191
255
|
`;
|
|
192
256
|
|
|
193
257
|
const ruleFile = {
|
|
194
258
|
folderPath: `${folderPath}/config/items/rules`,
|
|
195
259
|
fileName: 'index.js',
|
|
196
|
-
coverFile:
|
|
260
|
+
coverFile: true,
|
|
197
261
|
fileContent: ruleFileContent,
|
|
198
262
|
};
|
|
199
263
|
|
|
264
|
+
const settingEmbedFileContent = `${fileGlobalHeader}
|
|
265
|
+
const items = {
|
|
266
|
+
'import/parsers': {
|
|
267
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
268
|
+
},
|
|
269
|
+
'import/resolver': {
|
|
270
|
+
node: {
|
|
271
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
272
|
+
moduleDirectory: ['src', 'node_modules'],
|
|
273
|
+
},
|
|
274
|
+
typescript: {
|
|
275
|
+
// always try to resolve types under \`<root>@types\` directory even it doesn't contain any source code, like \`@types/unIst\`
|
|
276
|
+
alwaysTryTypes: true,
|
|
277
|
+
|
|
278
|
+
// use an array of glob patterns
|
|
279
|
+
directory: ['./tsconfig.json', './packages/*/tsconfig.json'],
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
module.exports = {
|
|
285
|
+
settings: {
|
|
286
|
+
...items,
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
`;
|
|
290
|
+
|
|
291
|
+
const settingEmbedFile = {
|
|
292
|
+
folderPath: `${folderPath}/config/items/settings`,
|
|
293
|
+
fileName: 'embed.js',
|
|
294
|
+
coverFile: true,
|
|
295
|
+
fileContent: settingEmbedFileContent,
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
const settingCustomFileContent = `${fileGlobalHeader}
|
|
299
|
+
const items = {};
|
|
300
|
+
|
|
301
|
+
module.exports = {
|
|
302
|
+
settings: {
|
|
303
|
+
...items,
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
`;
|
|
307
|
+
|
|
308
|
+
const settingCustomFile = {
|
|
309
|
+
folderPath: `${folderPath}/config/items/settings`,
|
|
310
|
+
fileName: 'custom.js',
|
|
311
|
+
coverFile: false,
|
|
312
|
+
fileContent: settingCustomFileContent,
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const settingFileContent = `${fileGlobalHeader}
|
|
316
|
+
const { settings: embedSettings } = require('./embed');
|
|
317
|
+
const { settings: customSettings } = require('./custom');
|
|
318
|
+
|
|
319
|
+
module.exports = {
|
|
320
|
+
settings: {
|
|
321
|
+
...embedSettings,
|
|
322
|
+
...customSettings,
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
`;
|
|
326
|
+
|
|
327
|
+
const settingFile = {
|
|
328
|
+
folderPath: `${folderPath}/config/items/settings`,
|
|
329
|
+
fileName: 'index.js',
|
|
330
|
+
coverFile: true,
|
|
331
|
+
fileContent: settingFileContent,
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const extendEmbedFileContent = `${fileGlobalHeader}
|
|
335
|
+
const extendCollection = [
|
|
336
|
+
'eslint:recommended',
|
|
337
|
+
'plugin:react/recommended',
|
|
338
|
+
'plugin:unicorn/recommended',
|
|
339
|
+
'plugin:promise/recommended',
|
|
340
|
+
'prettier',
|
|
341
|
+
];
|
|
342
|
+
|
|
343
|
+
module.exports = {
|
|
344
|
+
extendCollection: [...extendCollection],
|
|
345
|
+
};
|
|
346
|
+
`;
|
|
347
|
+
|
|
348
|
+
const extendEmbedFile = {
|
|
349
|
+
folderPath: `${folderPath}/config/items/extends`,
|
|
350
|
+
fileName: 'embed.js',
|
|
351
|
+
coverFile: true,
|
|
352
|
+
fileContent: extendEmbedFileContent,
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const extendCustomFileContent = `${fileGlobalHeader}
|
|
356
|
+
const extendCollection = [];
|
|
357
|
+
|
|
358
|
+
module.exports = {
|
|
359
|
+
extendCollection: [...extendCollection],
|
|
360
|
+
};
|
|
361
|
+
`;
|
|
362
|
+
|
|
363
|
+
const extendCustomFile = {
|
|
364
|
+
folderPath: `${folderPath}/config/items/extends`,
|
|
365
|
+
fileName: 'custom.js',
|
|
366
|
+
coverFile: false,
|
|
367
|
+
fileContent: extendCustomFileContent,
|
|
368
|
+
};
|
|
369
|
+
|
|
200
370
|
const extendFileContent = `${fileGlobalHeader}
|
|
371
|
+
const { extendCollection: extendEmbedPlugins } = require('./embed');
|
|
372
|
+
const { extendCollection: extendCustomPlugins } = require('./custom');
|
|
373
|
+
|
|
201
374
|
module.exports = {
|
|
202
|
-
extendCollection: [],
|
|
203
|
-
}
|
|
375
|
+
extendCollection: [...extendEmbedPlugins, ...extendCustomPlugins],
|
|
376
|
+
};
|
|
377
|
+
`;
|
|
204
378
|
|
|
205
379
|
const extendFile = {
|
|
206
380
|
folderPath: `${folderPath}/config/items/extends`,
|
|
207
381
|
fileName: 'index.js',
|
|
208
|
-
coverFile:
|
|
382
|
+
coverFile: true,
|
|
209
383
|
fileContent: extendFileContent,
|
|
210
384
|
};
|
|
211
385
|
|
|
386
|
+
const pluginEmbedFileContent = `${fileGlobalHeader}
|
|
387
|
+
const plugins = [
|
|
388
|
+
'unicorn',
|
|
389
|
+
'simple-import-sort',
|
|
390
|
+
'import',
|
|
391
|
+
'prettier',
|
|
392
|
+
];
|
|
393
|
+
|
|
394
|
+
module.exports = {
|
|
395
|
+
pluginCollection: [...plugins],
|
|
396
|
+
};
|
|
397
|
+
`;
|
|
398
|
+
|
|
399
|
+
const pluginEmbedFile = {
|
|
400
|
+
folderPath: `${folderPath}/config/items/plugins`,
|
|
401
|
+
fileName: 'embed.js',
|
|
402
|
+
coverFile: true,
|
|
403
|
+
fileContent: pluginEmbedFileContent,
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
const pluginCustomFileContent = `${fileGlobalHeader}
|
|
407
|
+
const plugins = [];
|
|
408
|
+
|
|
409
|
+
module.exports = {
|
|
410
|
+
pluginCollection: [...plugins],
|
|
411
|
+
};
|
|
412
|
+
`;
|
|
413
|
+
|
|
414
|
+
const pluginCustomFile = {
|
|
415
|
+
folderPath: `${folderPath}/config/items/plugins`,
|
|
416
|
+
fileName: 'custom.js',
|
|
417
|
+
coverFile: false,
|
|
418
|
+
fileContent: pluginCustomFileContent,
|
|
419
|
+
};
|
|
420
|
+
|
|
212
421
|
const pluginFileContent = `${fileGlobalHeader}
|
|
422
|
+
const { pluginCollection: embedPlugins } = require('./embed');
|
|
423
|
+
const { pluginCollection: customPlugins } = require('./custom');
|
|
424
|
+
|
|
213
425
|
module.exports = {
|
|
214
|
-
pluginCollection: [],
|
|
215
|
-
}
|
|
426
|
+
pluginCollection: [...embedPlugins, ...customPlugins],
|
|
427
|
+
};
|
|
428
|
+
`;
|
|
216
429
|
|
|
217
430
|
const pluginFile = {
|
|
218
431
|
folderPath: `${folderPath}/config/items/plugins`,
|
|
219
432
|
fileName: 'index.js',
|
|
220
|
-
coverFile:
|
|
433
|
+
coverFile: true,
|
|
221
434
|
fileContent: pluginFileContent,
|
|
222
435
|
};
|
|
223
436
|
|
|
437
|
+
const parserEmbedFileContent = `${fileGlobalHeader}
|
|
438
|
+
const parserOptions = {
|
|
439
|
+
requireConfigFile: false,
|
|
440
|
+
babelOptions: {
|
|
441
|
+
presets: ['@babel/preset-react'],
|
|
442
|
+
plugins: [
|
|
443
|
+
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
444
|
+
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
445
|
+
],
|
|
446
|
+
},
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
module.exports = {
|
|
450
|
+
parserOptions: { ...parserOptions },
|
|
451
|
+
};
|
|
452
|
+
`;
|
|
453
|
+
|
|
454
|
+
const parserEmbedFile = {
|
|
455
|
+
folderPath: `${folderPath}/config/items/parser`,
|
|
456
|
+
fileName: 'embed.js',
|
|
457
|
+
coverFile: true,
|
|
458
|
+
fileContent: parserEmbedFileContent,
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
const parserCustomFileContent = `${fileGlobalHeader}
|
|
462
|
+
const parserOptions = {};
|
|
463
|
+
|
|
464
|
+
module.exports = {
|
|
465
|
+
parserOptions: { ...parserOptions },
|
|
466
|
+
};
|
|
467
|
+
`;
|
|
468
|
+
|
|
469
|
+
const parserCustomFile = {
|
|
470
|
+
folderPath: `${folderPath}/config/items/parser`,
|
|
471
|
+
fileName: 'custom.js',
|
|
472
|
+
coverFile: false,
|
|
473
|
+
fileContent: parserCustomFileContent,
|
|
474
|
+
};
|
|
475
|
+
|
|
224
476
|
const parserFileContent = `${fileGlobalHeader}
|
|
477
|
+
const { parserOptions: embedParserOptions } = require('./embed');
|
|
478
|
+
const { parserOptions: customParserOptions } = require('./custom');
|
|
479
|
+
|
|
225
480
|
module.exports = {
|
|
226
|
-
parserOptions: {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
presets: ['@babel/preset-react'],
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
}`;
|
|
481
|
+
parserOptions: { ...embedParserOptions, ...customParserOptions },
|
|
482
|
+
};
|
|
483
|
+
`;
|
|
233
484
|
|
|
234
485
|
const parserFile = {
|
|
235
486
|
folderPath: `${folderPath}/config/items/parser`,
|
|
@@ -241,9 +492,20 @@ const parserFile = {
|
|
|
241
492
|
module.exports = {
|
|
242
493
|
ignoreFile,
|
|
243
494
|
contentFile,
|
|
495
|
+
ruleEmbedFile,
|
|
496
|
+
ruleCustomFile,
|
|
244
497
|
ruleFile,
|
|
245
498
|
configFile,
|
|
499
|
+
extendEmbedFile,
|
|
500
|
+
extendCustomFile,
|
|
246
501
|
extendFile,
|
|
502
|
+
pluginEmbedFile,
|
|
503
|
+
pluginCustomFile,
|
|
247
504
|
pluginFile,
|
|
505
|
+
parserEmbedFile,
|
|
506
|
+
parserCustomFile,
|
|
248
507
|
parserFile,
|
|
508
|
+
settingEmbedFile,
|
|
509
|
+
settingCustomFile,
|
|
510
|
+
settingFile,
|
|
249
511
|
};
|
|
@@ -3,26 +3,34 @@ const { fileGlobalHeader } = require('./template.config');
|
|
|
3
3
|
const folderPath = './develop/config/package';
|
|
4
4
|
|
|
5
5
|
const globalChildPackageFileContent = `${fileGlobalHeader}
|
|
6
|
-
const
|
|
6
|
+
const commitScript = {
|
|
7
7
|
precommit: 'npm run z:lint:staged',
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const documentationScript = {
|
|
11
|
+
'prez:documentation:generate': 'npx rimraf ./docs && npm run z:documentation:lint',
|
|
12
|
+
'z:documentation:generate': 'npx documentation build src/** -f html --github -o docs',
|
|
13
|
+
'z:documentation:lint': 'npx documentation lint src/**',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const lintScript = {
|
|
17
|
+
'z:lint:file:all': 'npm run z:lint:script:all && npm run z:lint:style:all',
|
|
18
|
+
'z:lint:file:all:fix': 'npm run z:lint:script:all:fix && npm run z:lint:style:all:fix',
|
|
19
|
+
'z:lint:file:change': 'npm run z:lint:script:change && npm run z:lint:style:all',
|
|
20
|
+
'z:lint:file:change:fix': 'npm run z:lint:script:change:fix && npm run z:lint:style:all:fix',
|
|
12
21
|
'z:lint:script:all': 'npx eslint --ext .js,.jsx,.ts,.tsx ./src',
|
|
13
22
|
'z:lint:script:all:fix': 'npx eslint --fix --ext .js,.jsx,.ts,.tsx ./src',
|
|
14
|
-
'postz:lint:script:all:fix': 'npm run prettier:format:all',
|
|
23
|
+
'postz:lint:script:all:fix': 'npm run z:prettier:format:all',
|
|
15
24
|
'z:lint:script:change': 'npx eslint --cache --ext .js,.jsx,.ts,.tsx ./src',
|
|
16
|
-
'z:lint:script:change:fix': 'npx eslint --fix --cache --ext .js,.jsx,.ts,.tsx ./src && npm run lint:style:fix',
|
|
25
|
+
'z:lint:script:change:fix': 'npx eslint --fix --cache --ext .js,.jsx,.ts,.tsx ./src && npm run z:lint:style:fix',
|
|
17
26
|
'postz:lint:script:change:fix': 'npm run prettier:format:change',
|
|
18
27
|
'z:lint:staged': 'npx lint-staged --quiet',
|
|
19
28
|
'z:lint:style:all': 'npx stylelint "./src/**/*.less"',
|
|
20
29
|
'z:lint:style:all:fix': 'npx stylelint --fix "./src/**/*.less"',
|
|
21
|
-
'postz:lint:style:all:fix': 'npm run prettier:format:all',
|
|
30
|
+
'postz:lint:style:all:fix': 'npm run z:prettier:format:all',
|
|
22
31
|
'z:lint:style:change': 'npx stylelint --cache "./src/**/*.less"',
|
|
23
32
|
'z:lint:style:change:fix': 'npx stylelint --cache --fix "./src/**/*.less"',
|
|
24
33
|
'postz:lint:style:change:fix': 'npm run prettier:format:change',
|
|
25
|
-
'z:tsc:build': 'echo show tsc version and create declaration file && tsc -v && tsc -p ./tsconfig.types.json && echo declaration file generate complete',
|
|
26
34
|
};
|
|
27
35
|
|
|
28
36
|
const prettierScript = {
|
|
@@ -31,9 +39,15 @@ const prettierScript = {
|
|
|
31
39
|
'z:prettier:package.json': 'npx prettier --write ./package.json',
|
|
32
40
|
};
|
|
33
41
|
|
|
42
|
+
const tscScript = {
|
|
43
|
+
'z:tsc:build': 'echo show tsc version and create declaration file && tsc -v && tsc -p ./tsconfig.types.json && echo declaration file generate complete',
|
|
44
|
+
};
|
|
45
|
+
|
|
34
46
|
module.exports = {
|
|
47
|
+
...commitScript,
|
|
35
48
|
...lintScript,
|
|
36
49
|
...prettierScript,
|
|
50
|
+
...tscScript,
|
|
37
51
|
};
|
|
38
52
|
`;
|
|
39
53
|
|
|
@@ -61,6 +75,7 @@ const toolsScript = {
|
|
|
61
75
|
"z:show:package": "npx lerna ls -a -l",
|
|
62
76
|
"z:sleep": "npx easy-soft-develop sleep --second 2 --showInfo false",
|
|
63
77
|
"z:create:assist-scripts": "npx easy-soft-develop create-assist-scripts",
|
|
78
|
+
"z:update:package-from-package": "node ./develop/assists/update-package-from-package.js",
|
|
64
79
|
};
|
|
65
80
|
|
|
66
81
|
const publishScript = {
|
|
@@ -71,7 +86,7 @@ const publishScript = {
|
|
|
71
86
|
'postz:publish-npm-all': 'npm run z:change:nrm:local',
|
|
72
87
|
'prez:publish:lerna': 'npm run z:change:nrm:npm',
|
|
73
88
|
'z:publish:lerna': 'lerna updated && npm run z:lerna:publish',
|
|
74
|
-
'postz:publish:lerna': 'npm run z:change:nrm:local && npm run publish-npm-all',
|
|
89
|
+
'postz:publish:lerna': 'npm run z:change:nrm:local && npm run z:publish-npm-all',
|
|
75
90
|
'prez:publish:build': 'npm run z:install && npm run cz && npm run z:build:all',
|
|
76
91
|
'z:publish:build': 'npm run z:publish:lerna',
|
|
77
92
|
};
|
|
@@ -23,10 +23,21 @@ const {
|
|
|
23
23
|
contentFile: eslintContentFile,
|
|
24
24
|
ignoreFile: eslintIgnoreFile,
|
|
25
25
|
configFile: eslintConfigFile,
|
|
26
|
+
ruleCustomFile: eslintCustomRuleFile,
|
|
27
|
+
ruleEmbedFile: eslintEmbedRuleFile,
|
|
26
28
|
ruleFile: eslintRuleFile,
|
|
29
|
+
extendEmbedFile: eslintExtendCustomFile,
|
|
30
|
+
extendCustomFile: eslintExtendEmbedFile,
|
|
27
31
|
extendFile: eslintExtendFile,
|
|
32
|
+
parserCustomFile: eslintParserCustomFile,
|
|
33
|
+
parserEmbedFile: eslintParserEmbedFile,
|
|
28
34
|
parserFile: eslintParserFile,
|
|
35
|
+
pluginEmbedFile: eslintPluginEmbedFile,
|
|
36
|
+
pluginCustomFile: eslintPluginCustomFile,
|
|
29
37
|
pluginFile: eslintPluginFile,
|
|
38
|
+
settingCustomFile: eslintSettingCustomFile,
|
|
39
|
+
settingEmbedFile: eslintSettingEmbedFile,
|
|
40
|
+
settingFile: eslintSettingFile,
|
|
30
41
|
} = require('../templates/eslint.template');
|
|
31
42
|
const {
|
|
32
43
|
attributeFile: gitAttributeFile,
|
|
@@ -123,11 +134,19 @@ const developDependencePackageCollection = [];
|
|
|
123
134
|
|
|
124
135
|
const updateSpecialPackageCollection = [];
|
|
125
136
|
|
|
137
|
+
const updatePackageFromPackageOptions = {
|
|
138
|
+
agent: '',
|
|
139
|
+
localFile: '',
|
|
140
|
+
packageUrl: '',
|
|
141
|
+
repo: '',
|
|
142
|
+
};
|
|
143
|
+
|
|
126
144
|
module.exports = {
|
|
127
145
|
cleanCommand,
|
|
128
146
|
cleanCollection,
|
|
129
147
|
developDependencePackageCollection,
|
|
130
148
|
updateSpecialPackageCollection,
|
|
149
|
+
updatePackageFromPackageOptions,
|
|
131
150
|
};
|
|
132
151
|
`;
|
|
133
152
|
|
|
@@ -151,6 +170,23 @@ clean(cleanCommand, cleanCollection);
|
|
|
151
170
|
return createScriptFile('./develop/assists', 'clean.js', content, true);
|
|
152
171
|
}
|
|
153
172
|
|
|
173
|
+
function createUpdatePackageFromPackageScriptFile() {
|
|
174
|
+
const content = `${fileGlobalHeader}
|
|
175
|
+
const { updatePackageFromPackage } = require('easy-soft-develop');
|
|
176
|
+
|
|
177
|
+
const { updatePackageFromPackageOptions } = require('./config');
|
|
178
|
+
|
|
179
|
+
updatePackageFromPackage(updatePackageFromPackageOptions);
|
|
180
|
+
`;
|
|
181
|
+
|
|
182
|
+
return createScriptFile(
|
|
183
|
+
'./develop/assists',
|
|
184
|
+
'update.package.from.package.js',
|
|
185
|
+
content,
|
|
186
|
+
true,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
154
190
|
function createPackageCheckSpecialVersionScriptFile() {
|
|
155
191
|
const content = `${fileGlobalHeader}
|
|
156
192
|
const { updateSpecialPackageVersion } = require('easy-soft-develop');
|
|
@@ -172,13 +208,13 @@ updateSpecialPackageVersion(updateSpecialPackageCollection);
|
|
|
172
208
|
}
|
|
173
209
|
}
|
|
174
210
|
|
|
175
|
-
function
|
|
211
|
+
function createInstallGlobalDevelopDependenceScriptFile() {
|
|
176
212
|
const content = `${fileGlobalHeader}
|
|
177
|
-
const {
|
|
213
|
+
const { installGlobalDevelopDependencePackages } = require('easy-soft-develop');
|
|
178
214
|
|
|
179
215
|
const { developDependencePackageCollection } = require('./config');
|
|
180
216
|
|
|
181
|
-
|
|
217
|
+
installGlobalDevelopDependencePackages(developDependencePackageCollection);
|
|
182
218
|
`;
|
|
183
219
|
|
|
184
220
|
try {
|
|
@@ -235,38 +271,47 @@ const mainFileContentList = [
|
|
|
235
271
|
{
|
|
236
272
|
name: '.eslintrc.js',
|
|
237
273
|
content: mainEslintFileContent,
|
|
274
|
+
coverFile: true,
|
|
238
275
|
},
|
|
239
276
|
{
|
|
240
277
|
name: '.prettierrc.js',
|
|
241
278
|
content: mainPrettierContent,
|
|
279
|
+
coverFile: true,
|
|
242
280
|
},
|
|
243
281
|
{
|
|
244
282
|
name: '.stylelintrc.js',
|
|
245
283
|
content: mainStylelintContent,
|
|
284
|
+
coverFile: true,
|
|
246
285
|
},
|
|
247
286
|
{
|
|
248
287
|
name: '.editorconfig',
|
|
249
288
|
content: editorConfigContent,
|
|
289
|
+
coverFile: true,
|
|
250
290
|
},
|
|
251
291
|
{
|
|
252
292
|
name: '.eslintignore',
|
|
253
293
|
content: eslintIgnoreContent,
|
|
294
|
+
coverFile: false,
|
|
254
295
|
},
|
|
255
296
|
{
|
|
256
297
|
name: '.prettierignore',
|
|
257
298
|
content: prettierIgnoreContent,
|
|
299
|
+
coverFile: false,
|
|
258
300
|
},
|
|
259
301
|
{
|
|
260
302
|
name: '.gitattributes',
|
|
261
303
|
content: gitAttributesContent,
|
|
304
|
+
coverFile: true,
|
|
262
305
|
},
|
|
263
306
|
{
|
|
264
307
|
name: '.gitignore',
|
|
265
308
|
content: gitIgnoreContent,
|
|
309
|
+
coverFile: false,
|
|
266
310
|
},
|
|
267
311
|
{
|
|
268
312
|
name: '.lintstagedrc',
|
|
269
313
|
content: lintStagedRcContent,
|
|
314
|
+
coverFile: false,
|
|
270
315
|
},
|
|
271
316
|
];
|
|
272
317
|
|
|
@@ -274,38 +319,47 @@ const packageFileContentList = [
|
|
|
274
319
|
{
|
|
275
320
|
name: '.eslintrc.js',
|
|
276
321
|
content: packageEslintFileContent,
|
|
322
|
+
coverFile: true,
|
|
277
323
|
},
|
|
278
324
|
{
|
|
279
325
|
name: '.prettierrc.js',
|
|
280
326
|
content: packagePrettierContent,
|
|
327
|
+
coverFile: true,
|
|
281
328
|
},
|
|
282
329
|
{
|
|
283
330
|
name: '.stylelintrc.js',
|
|
284
331
|
content: packageStylelintContent,
|
|
332
|
+
coverFile: true,
|
|
285
333
|
},
|
|
286
334
|
{
|
|
287
335
|
name: '.editorconfig',
|
|
288
336
|
content: editorConfigContent,
|
|
337
|
+
coverFile: true,
|
|
289
338
|
},
|
|
290
339
|
{
|
|
291
340
|
name: '.eslintignore',
|
|
292
341
|
content: eslintIgnoreContent,
|
|
342
|
+
coverFile: false,
|
|
293
343
|
},
|
|
294
344
|
{
|
|
295
345
|
name: '.prettierignore',
|
|
296
346
|
content: prettierIgnoreContent,
|
|
347
|
+
coverFile: false,
|
|
297
348
|
},
|
|
298
349
|
{
|
|
299
350
|
name: '.gitattributes',
|
|
300
351
|
content: gitAttributesContent,
|
|
352
|
+
coverFile: true,
|
|
301
353
|
},
|
|
302
354
|
{
|
|
303
355
|
name: '.gitignore',
|
|
304
356
|
content: gitIgnoreContent,
|
|
357
|
+
coverFile: false,
|
|
305
358
|
},
|
|
306
359
|
{
|
|
307
360
|
name: '.lintstagedrc',
|
|
308
361
|
content: lintStagedRcContent,
|
|
362
|
+
coverFile: false,
|
|
309
363
|
},
|
|
310
364
|
];
|
|
311
365
|
|
|
@@ -354,12 +408,34 @@ function createDevelopFiles(waitMessage = '', successMessage = '') {
|
|
|
354
408
|
|
|
355
409
|
writeFileWithOptionsSync(eslintConfigFile);
|
|
356
410
|
|
|
411
|
+
writeFileWithOptionsSync(eslintCustomRuleFile);
|
|
412
|
+
|
|
413
|
+
writeFileWithOptionsSync(eslintEmbedRuleFile);
|
|
414
|
+
|
|
357
415
|
writeFileWithOptionsSync(eslintRuleFile);
|
|
358
416
|
|
|
417
|
+
writeFileWithOptionsSync(eslintSettingCustomFile);
|
|
418
|
+
|
|
419
|
+
writeFileWithOptionsSync(eslintSettingEmbedFile);
|
|
420
|
+
|
|
421
|
+
writeFileWithOptionsSync(eslintSettingFile);
|
|
422
|
+
|
|
423
|
+
writeFileWithOptionsSync(eslintExtendCustomFile);
|
|
424
|
+
|
|
425
|
+
writeFileWithOptionsSync(eslintExtendEmbedFile);
|
|
426
|
+
|
|
359
427
|
writeFileWithOptionsSync(eslintExtendFile);
|
|
360
428
|
|
|
429
|
+
writeFileWithOptionsSync(eslintParserCustomFile);
|
|
430
|
+
|
|
431
|
+
writeFileWithOptionsSync(eslintParserEmbedFile);
|
|
432
|
+
|
|
361
433
|
writeFileWithOptionsSync(eslintParserFile);
|
|
362
434
|
|
|
435
|
+
writeFileWithOptionsSync(eslintPluginCustomFile);
|
|
436
|
+
|
|
437
|
+
writeFileWithOptionsSync(eslintPluginEmbedFile);
|
|
438
|
+
|
|
363
439
|
writeFileWithOptionsSync(eslintPluginFile);
|
|
364
440
|
|
|
365
441
|
//#endregion
|
|
@@ -416,9 +492,11 @@ function createDevelopFiles(waitMessage = '', successMessage = '') {
|
|
|
416
492
|
|
|
417
493
|
createCleanScriptFile();
|
|
418
494
|
|
|
495
|
+
createUpdatePackageFromPackageScriptFile();
|
|
496
|
+
|
|
419
497
|
createPackageCheckSpecialVersionScriptFile();
|
|
420
498
|
|
|
421
|
-
|
|
499
|
+
createInstallGlobalDevelopDependenceScriptFile();
|
|
422
500
|
|
|
423
501
|
createInitialEnvironmentScriptFiles();
|
|
424
502
|
|
|
@@ -437,7 +515,8 @@ module.exports = {
|
|
|
437
515
|
createNpmConfigFile,
|
|
438
516
|
createCleanScriptFile,
|
|
439
517
|
createPackageCheckSpecialVersionScriptFile,
|
|
440
|
-
|
|
518
|
+
createInstallGlobalDevelopDependenceScriptFile,
|
|
441
519
|
createInitialEnvironmentScriptFiles,
|
|
442
520
|
createDevelopFiles,
|
|
521
|
+
createUpdatePackageFromPackageScriptFile,
|
|
443
522
|
};
|
|
@@ -18,9 +18,9 @@ function createMainFile(fileWithContentCollection) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
fileWithContentCollection.forEach((o) => {
|
|
21
|
-
const { name, content } = o;
|
|
21
|
+
const { name, content, coverFile } = o;
|
|
22
22
|
|
|
23
|
-
writeFileSync(name, content);
|
|
23
|
+
writeFileSync(name, content, { coverFile });
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
const log = `main files [${fileWithContentCollection
|
|
@@ -43,9 +43,9 @@ function createPackageFile(fileWithContentCollection) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
fileWithContentCollection.forEach((o) => {
|
|
46
|
-
const { name, content } = o;
|
|
46
|
+
const { name, content, coverFile } = o;
|
|
47
47
|
|
|
48
|
-
writeFileSync(`${itemPath}/${name}`, content);
|
|
48
|
+
writeFileSync(`${itemPath}/${name}`, content, { coverFile });
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -82,7 +82,7 @@ function adjustMainPackageJson({ scripts }) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
function adjustChildrenPackageJson({ scripts }) {
|
|
85
|
-
loopPackage(({ absolutePath }) => {
|
|
85
|
+
loopPackage(({ name, absolutePath }) => {
|
|
86
86
|
const itemPath = absolutePath;
|
|
87
87
|
|
|
88
88
|
const childPackageJsonPath = `${itemPath}/package.json`;
|
|
@@ -93,7 +93,7 @@ function adjustChildrenPackageJson({ scripts }) {
|
|
|
93
93
|
|
|
94
94
|
writeJsonFileSync(childPackageJsonPath, packageJson, { coverFile: true });
|
|
95
95
|
|
|
96
|
-
promptSuccess(
|
|
96
|
+
promptSuccess(`adjust ${name} package.json success`);
|
|
97
97
|
promptEmptyLine();
|
|
98
98
|
});
|
|
99
99
|
}
|
|
@@ -16,6 +16,7 @@ function getGlobalPackages() {
|
|
|
16
16
|
'@babel/plugin-transform-runtime',
|
|
17
17
|
'@babel/preset-env',
|
|
18
18
|
'@babel/preset-react',
|
|
19
|
+
'@babel/runtime',
|
|
19
20
|
]);
|
|
20
21
|
|
|
21
22
|
packages = packages.concat([
|
|
@@ -47,6 +48,8 @@ function getGlobalPackages() {
|
|
|
47
48
|
'eslint-plugin-unicorn',
|
|
48
49
|
]);
|
|
49
50
|
|
|
51
|
+
packages = packages.concat(['documentation']);
|
|
52
|
+
|
|
50
53
|
packages = packages.concat([
|
|
51
54
|
'prettier',
|
|
52
55
|
'prettier-plugin-organize-imports',
|
|
@@ -59,13 +62,7 @@ function getGlobalPackages() {
|
|
|
59
62
|
'stylelint-config-standard',
|
|
60
63
|
]);
|
|
61
64
|
|
|
62
|
-
packages = packages.concat(
|
|
63
|
-
'rimraf',
|
|
64
|
-
'lint-staged',
|
|
65
|
-
'husky',
|
|
66
|
-
'shelljs',
|
|
67
|
-
'terminal-kit',
|
|
68
|
-
);
|
|
65
|
+
packages = packages.concat('rimraf', 'lint-staged', 'husky');
|
|
69
66
|
|
|
70
67
|
packages = packages.concat('easy-soft-develop');
|
|
71
68
|
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
const download = require('download');
|
|
2
|
+
const agent = require('hpagent');
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
promptSuccess,
|
|
6
|
+
promptLine,
|
|
7
|
+
promptError,
|
|
8
|
+
promptWarn,
|
|
9
|
+
exit,
|
|
10
|
+
readJsonFileSync,
|
|
11
|
+
resolvePath,
|
|
12
|
+
writeJsonFileSync,
|
|
13
|
+
checkStringIsEmpty,
|
|
14
|
+
} = require('../tools/meta');
|
|
15
|
+
|
|
16
|
+
const { HttpsProxyAgent } = agent;
|
|
17
|
+
|
|
18
|
+
function handlePackage({ packageFilePath, packageTempPath }) {
|
|
19
|
+
promptSuccess(`referential package.json :${packageTempPath}`);
|
|
20
|
+
|
|
21
|
+
const packageProjectPath = resolvePath(packageFilePath);
|
|
22
|
+
|
|
23
|
+
const packageJsonTemp = readJsonFileSync(packageTempPath);
|
|
24
|
+
|
|
25
|
+
const packageJsonTarget = readJsonFileSync(packageProjectPath);
|
|
26
|
+
|
|
27
|
+
const dependencies = packageJsonTemp.dependencies;
|
|
28
|
+
const devDependencies = packageJsonTemp.devDependencies;
|
|
29
|
+
|
|
30
|
+
packageJsonTarget.dependencies = dependencies;
|
|
31
|
+
packageJsonTarget.devDependencies = devDependencies;
|
|
32
|
+
|
|
33
|
+
writeJsonFileSync(packageProjectPath, packageJsonTarget, { coverFile: true });
|
|
34
|
+
|
|
35
|
+
promptSuccess(`update package.json success!`);
|
|
36
|
+
|
|
37
|
+
promptLine();
|
|
38
|
+
|
|
39
|
+
exit();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function handleTempPackagePath({ agent, localFile, packageUrl, repo }) {
|
|
43
|
+
let packageTempPath = '';
|
|
44
|
+
|
|
45
|
+
if (localFile) {
|
|
46
|
+
promptSuccess(`use local referential package.json`);
|
|
47
|
+
|
|
48
|
+
promptSuccess(`file path: ${localFile}`);
|
|
49
|
+
|
|
50
|
+
promptLine();
|
|
51
|
+
|
|
52
|
+
packageTempPath = resolvePath(localFile);
|
|
53
|
+
} else {
|
|
54
|
+
promptSuccess(`try ${repo} repo`);
|
|
55
|
+
|
|
56
|
+
if (agent) {
|
|
57
|
+
promptSuccess(`agent: ${agent}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
promptSuccess(`${repo} repo: ${packageUrl}`);
|
|
61
|
+
|
|
62
|
+
await download(packageUrl, resolvePath(`./temp`), {
|
|
63
|
+
...(agent
|
|
64
|
+
? {
|
|
65
|
+
agent: {
|
|
66
|
+
https: new HttpsProxyAgent({
|
|
67
|
+
keepAlive: true,
|
|
68
|
+
keepAliveMsecs: 1000,
|
|
69
|
+
maxSockets: 256,
|
|
70
|
+
maxFreeSockets: 256,
|
|
71
|
+
scheduling: 'lifo',
|
|
72
|
+
proxy: agent,
|
|
73
|
+
}),
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
: {}),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
promptSuccess(`use ${repo} repo success!`);
|
|
80
|
+
|
|
81
|
+
packageTempPath = resolvePath(`./temp/package.json`);
|
|
82
|
+
|
|
83
|
+
promptSuccess(`packageTempPath: ${packageTempPath}`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return packageTempPath;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function updatePackageFromPackage({
|
|
90
|
+
path,
|
|
91
|
+
primaryRemoteUrl,
|
|
92
|
+
spareRemoteUrl,
|
|
93
|
+
agent,
|
|
94
|
+
localFile,
|
|
95
|
+
}) {
|
|
96
|
+
if (checkStringIsEmpty(primaryRemoteUrl)) {
|
|
97
|
+
promptError('please input primary remote package.json url');
|
|
98
|
+
|
|
99
|
+
exit();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let packageTempPath = '';
|
|
103
|
+
|
|
104
|
+
promptSuccess(`prepare to update package.json: `);
|
|
105
|
+
|
|
106
|
+
promptLine();
|
|
107
|
+
|
|
108
|
+
try {
|
|
109
|
+
packageTempPath = await handleTempPackagePath({
|
|
110
|
+
agent,
|
|
111
|
+
localFile,
|
|
112
|
+
packageUrl: primaryRemoteUrl,
|
|
113
|
+
repo: 'github',
|
|
114
|
+
});
|
|
115
|
+
} catch (error) {
|
|
116
|
+
if (checkStringIsEmpty(primaryRemoteUrl)) {
|
|
117
|
+
promptError('please input spare remote package.json url');
|
|
118
|
+
|
|
119
|
+
exit();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
promptLine();
|
|
123
|
+
|
|
124
|
+
promptWarn(
|
|
125
|
+
`use github repo failure! switch to gitee, gitee repo possible update delay.`,
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
promptLine();
|
|
129
|
+
|
|
130
|
+
try {
|
|
131
|
+
packageTempPath = await handleTempPackagePath({
|
|
132
|
+
agent: '',
|
|
133
|
+
localFile,
|
|
134
|
+
packageUrl: spareRemoteUrl,
|
|
135
|
+
repo: 'gitee',
|
|
136
|
+
});
|
|
137
|
+
} catch (error) {
|
|
138
|
+
promptLine();
|
|
139
|
+
|
|
140
|
+
promptError(error);
|
|
141
|
+
|
|
142
|
+
promptLine();
|
|
143
|
+
|
|
144
|
+
promptWarn('download error, please check network');
|
|
145
|
+
|
|
146
|
+
exit();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
handlePackage(path, packageTempPath);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
module.exports = { updatePackageFromPackage };
|