easy-soft-develop 2.0.82 → 2.0.119

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.
@@ -3,12 +3,15 @@ const { fileGlobalHeader } = require('./template.config');
3
3
  const folderPath = './develop/config/eslint';
4
4
 
5
5
  const ignoreFileContent = `${fileGlobalHeader}
6
- const content = \`**/public
6
+ const content = \`#
7
+ **/public
7
8
  **/lib
8
9
  **/es
9
10
  **/.history
10
11
  **/.vs
11
12
  **/.swc
13
+ **/docs
14
+
12
15
  *.d.ts
13
16
  *.log
14
17
  *.zip
@@ -16,6 +19,10 @@ const content = \`**/public
16
19
  *.7z
17
20
  *.min.js
18
21
  rollup.config-*.cjs
22
+
23
+ .eslintrc.js
24
+ .prettierrc.js
25
+ .stylelintrc.js
19
26
  \`;
20
27
 
21
28
  module.exports = {
@@ -60,46 +67,29 @@ const { rules } = require('./items/rules');
60
67
  const { parserOptions } = require('./items/parser');
61
68
  const { pluginCollection } = require('./items/plugins');
62
69
  const { extendCollection } = require('./items/extends');
70
+ const { settings } = require('./items/settings');
63
71
 
64
72
  module.exports = {
65
73
  generalConfig: {
66
74
  extends: [
67
- 'eslint:recommended',
68
- 'plugin:react/recommended',
69
- 'plugin:unicorn/recommended',
70
- 'plugin:promise/recommended',
71
- 'prettier',
72
75
  ...extendCollection,
73
76
  ],
74
- env: { es6: true },
77
+ env: {
78
+ es6: true,
79
+ browser: true,
80
+ commonjs: true,
81
+ jest: true,
82
+ worker: true,
83
+ shelljs: true,
84
+ node: true,
85
+ },
75
86
  plugins: [
76
- 'unicorn',
77
- 'simple-import-sort',
78
- 'import',
79
- 'prettier',
80
87
  ...pluginCollection,
81
88
  ],
82
89
  parser: '@babel/eslint-parser',
83
90
  parserOptions: parserOptions,
84
91
  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
- },
92
+ settings: settings,
103
93
  },
104
94
  };
105
95
  `;
@@ -111,9 +101,24 @@ const configFile = {
111
101
  fileContent: configFileContent,
112
102
  };
113
103
 
114
- const ruleFileContent = `${fileGlobalHeader}
115
- const generalRules = {
104
+ const ruleEmbedFileContent = `${fileGlobalHeader}
105
+ const coreRules = {
116
106
  camelias: 0,
107
+ 'no-bitwise': 0,
108
+ 'linebreak-style': 0,
109
+ 'generator-star-spacing': 0,
110
+ 'operator-linebreak': 0,
111
+ 'object-curly-newline': 0,
112
+ 'no-use-before-define': 0,
113
+ 'no-nested-ternary': 0,
114
+ 'no-spaced-func': 2,
115
+ 'no-this-before-super': 0,
116
+ 'no-var': 1,
117
+ 'sort-imports': 0,
118
+ 'jsx-quotes': ['error', 'prefer-double'],
119
+ };
120
+
121
+ const reactRules = {
117
122
  'react/sort-comp': 0,
118
123
  'react/jsx-uses-react': 'off',
119
124
  'react/react-in-jsx-scope': 'off',
@@ -123,26 +128,42 @@ const generalRules = {
123
128
  'react/forbid-prop-types': 0,
124
129
  'react/jsx-one-expression-per-line': 0,
125
130
  'react/jsx-props-no-spreading': 0,
131
+ };
132
+
133
+ const jsxRules = {
126
134
  'jsx-a11y/no-noninteractive-element-interactions': 0,
127
135
  'jsx-a11y/click-events-have-key-events': 0,
128
136
  'jsx-a11y/no-static-element-interactions': 0,
129
137
  'jsx-a11y/anchor-is-valid': 0,
130
- 'no-bitwise': 0,
131
- 'linebreak-style': 0,
132
- 'generator-star-spacing': 0,
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,
138
+ };
139
+
140
+ const typescriptRules = {
142
141
  '@typescript-eslint/no-this-alias': ['off'],
143
142
  '@typescript-eslint/no-unused-vars': 0,
144
143
  '@typescript-eslint/no-invalid-this': 0,
145
- 'jsx-quotes': ['error', 'prefer-double'],
144
+ };
145
+
146
+ const unicornRules = {
147
+ 'unicorn/filename-case': [
148
+ 'error',
149
+ {
150
+ cases: {
151
+ kebabCase: true,
152
+ camelCase: true,
153
+ pascalCase: true,
154
+ snakeCase: true,
155
+ },
156
+ },
157
+ ],
158
+ 'unicorn/no-null': 0,
159
+ 'unicorn/no-this-assignment': 0,
160
+ };
161
+
162
+ const compatRules = {
163
+ 'compat/compat': 0,
164
+ };
165
+
166
+ const importRules = {
146
167
  'import/export': 'error',
147
168
  'import/first': 'error',
148
169
  'import/named': 'error',
@@ -155,10 +176,10 @@ const generalRules = {
155
176
  'import/no-unresolved': 'error',
156
177
  'import/no-useless-path-segments': 'error',
157
178
  'import/no-unused-modules': 'error',
179
+ 'import/order': 0,
158
180
  };
159
181
 
160
- const sortRules = {
161
- 'import/order': 0,
182
+ const simpleImportSortRules = {
162
183
  'simple-import-sort/imports': [
163
184
  'error',
164
185
  {
@@ -169,67 +190,298 @@ const sortRules = {
169
190
  ],
170
191
  ['^(?!@/)(?!easy-soft-)(?!.)'],
171
192
  ['^easy-soft-'],
172
- ['^(?!@/)(?!taro-fast-)(?!.)'],
173
- ['^taro-fast-'],
174
193
  ['^(?!@/)(?!antd-management-fast-)(?!.)'],
175
194
  ['^antd-management-fast-'],
195
+ ['^(?!@/)(?!taro-fast-)(?!.)'],
196
+ ['^taro-fast-'],
176
197
  ['^((@/).*|$)'],
177
- ['^\u0000'],
178
- ['^..(?!/?$)', '^../?$'],
179
- ['^./(?=.*/)(?!/?$)', '^.(?!/?$)', '^./?$'],
180
- ['^.+.s?less$', '^.+.s?scss$', '^.+.s?css$'],
198
+ ['^\\\\u0000'],
199
+ ['^\\\\.\\\\.(?!/?$)', '^\\\\.\\\\./?$'],
200
+ ['^\\\\./(?=.*/)(?!/?$)', '^\\\\.(?!/?$)', '^\\\\./?$'],
201
+ ['^.+\\\\.s?less$', '^.+\\\\.s?scss$', '^.+\\\\.s?css$'],
181
202
  ],
182
203
  },
183
204
  ],
184
205
  'simple-import-sort/exports': 'error',
185
- 'sort-imports': 0,
186
206
  };
187
207
 
188
208
  module.exports = {
189
- rules: { ...generalRules, ...sortRules },
209
+ rules: {
210
+ ...coreRules,
211
+ ...reactRules,
212
+ ...jsxRules,
213
+ ...typescriptRules,
214
+ ...unicornRules,
215
+ ...compatRules,
216
+ ...importRules,
217
+ ...simpleImportSortRules,
218
+ },
219
+ };
220
+ `;
221
+
222
+ const ruleEmbedFile = {
223
+ folderPath: `${folderPath}/config/items/rules`,
224
+ fileName: 'embed.js',
225
+ coverFile: true,
226
+ fileContent: ruleEmbedFileContent,
227
+ };
228
+
229
+ const ruleCustomFileContent = `${fileGlobalHeader}
230
+ const customRules = {};
231
+
232
+ module.exports = {
233
+ rules: {
234
+ ...customRules,
235
+ },
236
+ };
237
+ `;
238
+
239
+ const ruleCustomFile = {
240
+ folderPath: `${folderPath}/config/items/rules`,
241
+ fileName: 'custom.js',
242
+ coverFile: false,
243
+ fileContent: ruleCustomFileContent,
244
+ };
245
+
246
+ const ruleFileContent = `${fileGlobalHeader}
247
+ const { rules: embedRules } = require('./embed');
248
+ const { rules: customRules } = require('./custom');
249
+
250
+ module.exports = {
251
+ rules: {
252
+ ...embedRules,
253
+ ...customRules,
254
+ },
190
255
  };
191
256
  `;
192
257
 
193
258
  const ruleFile = {
194
259
  folderPath: `${folderPath}/config/items/rules`,
195
260
  fileName: 'index.js',
196
- coverFile: false,
261
+ coverFile: true,
197
262
  fileContent: ruleFileContent,
198
263
  };
199
264
 
265
+ const settingEmbedFileContent = `${fileGlobalHeader}
266
+ const items = {
267
+ 'import/parsers': {
268
+ '@typescript-eslint/parser': ['.ts', '.tsx'],
269
+ },
270
+ 'import/resolver': {
271
+ node: {
272
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
273
+ moduleDirectory: ['src', 'node_modules'],
274
+ },
275
+ typescript: {
276
+ // always try to resolve types under \`<root>@types\` directory even it doesn't contain any source code, like \`@types/unIst\`
277
+ alwaysTryTypes: true,
278
+
279
+ // use an array of glob patterns
280
+ directory: ['./tsconfig.json', './packages/*/tsconfig.json'],
281
+ },
282
+ },
283
+ };
284
+
285
+ module.exports = {
286
+ settings: {
287
+ ...items,
288
+ },
289
+ };
290
+ `;
291
+
292
+ const settingEmbedFile = {
293
+ folderPath: `${folderPath}/config/items/settings`,
294
+ fileName: 'embed.js',
295
+ coverFile: true,
296
+ fileContent: settingEmbedFileContent,
297
+ };
298
+
299
+ const settingCustomFileContent = `${fileGlobalHeader}
300
+ const items = {};
301
+
302
+ module.exports = {
303
+ settings: {
304
+ ...items,
305
+ },
306
+ };
307
+ `;
308
+
309
+ const settingCustomFile = {
310
+ folderPath: `${folderPath}/config/items/settings`,
311
+ fileName: 'custom.js',
312
+ coverFile: false,
313
+ fileContent: settingCustomFileContent,
314
+ };
315
+
316
+ const settingFileContent = `${fileGlobalHeader}
317
+ const { settings: embedSettings } = require('./embed');
318
+ const { settings: customSettings } = require('./custom');
319
+
320
+ module.exports = {
321
+ settings: {
322
+ ...embedSettings,
323
+ ...customSettings,
324
+ },
325
+ };
326
+ `;
327
+
328
+ const settingFile = {
329
+ folderPath: `${folderPath}/config/items/settings`,
330
+ fileName: 'index.js',
331
+ coverFile: true,
332
+ fileContent: settingFileContent,
333
+ };
334
+
335
+ const extendEmbedFileContent = `${fileGlobalHeader}
336
+ const extendCollection = [
337
+ 'eslint:recommended',
338
+ 'plugin:react/recommended',
339
+ 'plugin:unicorn/recommended',
340
+ 'plugin:promise/recommended',
341
+ 'prettier',
342
+ ];
343
+
344
+ module.exports = {
345
+ extendCollection: [...extendCollection],
346
+ };
347
+ `;
348
+
349
+ const extendEmbedFile = {
350
+ folderPath: `${folderPath}/config/items/extends`,
351
+ fileName: 'embed.js',
352
+ coverFile: true,
353
+ fileContent: extendEmbedFileContent,
354
+ };
355
+
356
+ const extendCustomFileContent = `${fileGlobalHeader}
357
+ const extendCollection = [];
358
+
359
+ module.exports = {
360
+ extendCollection: [...extendCollection],
361
+ };
362
+ `;
363
+
364
+ const extendCustomFile = {
365
+ folderPath: `${folderPath}/config/items/extends`,
366
+ fileName: 'custom.js',
367
+ coverFile: false,
368
+ fileContent: extendCustomFileContent,
369
+ };
370
+
200
371
  const extendFileContent = `${fileGlobalHeader}
372
+ const { extendCollection: extendEmbedPlugins } = require('./embed');
373
+ const { extendCollection: extendCustomPlugins } = require('./custom');
374
+
201
375
  module.exports = {
202
- extendCollection: [],
203
- }`;
376
+ extendCollection: [...extendEmbedPlugins, ...extendCustomPlugins],
377
+ };
378
+ `;
204
379
 
205
380
  const extendFile = {
206
381
  folderPath: `${folderPath}/config/items/extends`,
207
382
  fileName: 'index.js',
208
- coverFile: false,
383
+ coverFile: true,
209
384
  fileContent: extendFileContent,
210
385
  };
211
386
 
387
+ const pluginEmbedFileContent = `${fileGlobalHeader}
388
+ const plugins = [
389
+ 'unicorn',
390
+ 'simple-import-sort',
391
+ 'import',
392
+ 'prettier',
393
+ ];
394
+
395
+ module.exports = {
396
+ pluginCollection: [...plugins],
397
+ };
398
+ `;
399
+
400
+ const pluginEmbedFile = {
401
+ folderPath: `${folderPath}/config/items/plugins`,
402
+ fileName: 'embed.js',
403
+ coverFile: true,
404
+ fileContent: pluginEmbedFileContent,
405
+ };
406
+
407
+ const pluginCustomFileContent = `${fileGlobalHeader}
408
+ const plugins = [];
409
+
410
+ module.exports = {
411
+ pluginCollection: [...plugins],
412
+ };
413
+ `;
414
+
415
+ const pluginCustomFile = {
416
+ folderPath: `${folderPath}/config/items/plugins`,
417
+ fileName: 'custom.js',
418
+ coverFile: false,
419
+ fileContent: pluginCustomFileContent,
420
+ };
421
+
212
422
  const pluginFileContent = `${fileGlobalHeader}
423
+ const { pluginCollection: embedPlugins } = require('./embed');
424
+ const { pluginCollection: customPlugins } = require('./custom');
425
+
213
426
  module.exports = {
214
- pluginCollection: [],
215
- }`;
427
+ pluginCollection: [...embedPlugins, ...customPlugins],
428
+ };
429
+ `;
216
430
 
217
431
  const pluginFile = {
218
432
  folderPath: `${folderPath}/config/items/plugins`,
219
433
  fileName: 'index.js',
220
- coverFile: false,
434
+ coverFile: true,
221
435
  fileContent: pluginFileContent,
222
436
  };
223
437
 
438
+ const parserEmbedFileContent = `${fileGlobalHeader}
439
+ const parserOptions = {
440
+ requireConfigFile: false,
441
+ babelOptions: {
442
+ presets: ['@babel/preset-react'],
443
+ plugins: [
444
+ ['@babel/plugin-proposal-decorators', { legacy: true }],
445
+ ['@babel/plugin-proposal-class-properties', { loose: true }],
446
+ ],
447
+ },
448
+ };
449
+
450
+ module.exports = {
451
+ parserOptions: { ...parserOptions },
452
+ };
453
+ `;
454
+
455
+ const parserEmbedFile = {
456
+ folderPath: `${folderPath}/config/items/parser`,
457
+ fileName: 'embed.js',
458
+ coverFile: true,
459
+ fileContent: parserEmbedFileContent,
460
+ };
461
+
462
+ const parserCustomFileContent = `${fileGlobalHeader}
463
+ const parserOptions = {};
464
+
465
+ module.exports = {
466
+ parserOptions: { ...parserOptions },
467
+ };
468
+ `;
469
+
470
+ const parserCustomFile = {
471
+ folderPath: `${folderPath}/config/items/parser`,
472
+ fileName: 'custom.js',
473
+ coverFile: false,
474
+ fileContent: parserCustomFileContent,
475
+ };
476
+
224
477
  const parserFileContent = `${fileGlobalHeader}
478
+ const { parserOptions: embedParserOptions } = require('./embed');
479
+ const { parserOptions: customParserOptions } = require('./custom');
480
+
225
481
  module.exports = {
226
- parserOptions: {
227
- requireConfigFile: false,
228
- babelOptions: {
229
- presets: ['@babel/preset-react'],
230
- },
231
- },
232
- }`;
482
+ parserOptions: { ...embedParserOptions, ...customParserOptions },
483
+ };
484
+ `;
233
485
 
234
486
  const parserFile = {
235
487
  folderPath: `${folderPath}/config/items/parser`,
@@ -241,9 +493,20 @@ const parserFile = {
241
493
  module.exports = {
242
494
  ignoreFile,
243
495
  contentFile,
496
+ ruleEmbedFile,
497
+ ruleCustomFile,
244
498
  ruleFile,
245
499
  configFile,
500
+ extendEmbedFile,
501
+ extendCustomFile,
246
502
  extendFile,
503
+ pluginEmbedFile,
504
+ pluginCustomFile,
247
505
  pluginFile,
506
+ parserEmbedFile,
507
+ parserCustomFile,
248
508
  parserFile,
509
+ settingEmbedFile,
510
+ settingCustomFile,
511
+ settingFile,
249
512
  };
@@ -10,7 +10,7 @@ const content = \`{
10
10
  "npx prettier --cache --write"
11
11
  ],
12
12
  "*.{css,less,scss}": [
13
- "stylelint",
13
+ "stylelint --allow-empty-input",
14
14
  "npx prettier --cache --write"
15
15
  ],
16
16
  "*.{ts,tsx}": [
@@ -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 lintScript = {
6
+ const commitScript = {
7
7
  precommit: 'npm run z:lint:staged',
8
- 'z:lint:file:all': 'npm run lint:script:all && npm run lint:style:all',
9
- 'z:lint:file:all:fix': 'npm run lint:script:all:fix && npm run lint:style:all:fix',
10
- 'z:lint:file:change': 'npm run lint:script:change && npm run lint:style:all',
11
- 'z:lint:file:change:fix': 'npm run lint:script:change:fix && npm run lint:style:all:fix',
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',
17
- 'postz:lint:script:change:fix': 'npm run prettier:format:change',
25
+ 'z:lint:script:change:fix': 'npx eslint --fix --cache --ext .js,.jsx,.ts,.tsx ./src',
26
+ 'postz:lint:script:change:fix': 'npm run z:prettier:format:change',
18
27
  'z:lint:staged': 'npx lint-staged --quiet',
19
- 'z:lint:style:all': 'npx stylelint "./src/**/*.less"',
20
- 'z:lint:style:all:fix': 'npx stylelint --fix "./src/**/*.less"',
21
- 'postz:lint:style:all:fix': 'npm run prettier:format:all',
22
- 'z:lint:style:change': 'npx stylelint --cache "./src/**/*.less"',
23
- 'z:lint:style:change:fix': 'npx stylelint --cache --fix "./src/**/*.less"',
24
- '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',
28
+ 'z:lint:style:all': 'npx stylelint --allow-empty-input "./src/**/*.{css,scss,less}"',
29
+ 'z:lint:style:all:fix': 'npx stylelint --allow-empty-input --fix "./src/**/*.{css,scss,less}"',
30
+ 'postz:lint:style:all:fix': 'npm run z:prettier:format:all',
31
+ 'z:lint:style:change': 'npx stylelint --allow-empty-input --cache "./src/**/*.{css,scss,less}"',
32
+ 'z:lint:style:change:fix': 'npx stylelint --allow-empty-input --cache --fix "./src/**/*.{css,scss,less}"',
33
+ 'postz:lint:style:change:fix': 'npm run z:prettier:format:change',
26
34
  };
27
35
 
28
36
  const prettierScript = {
@@ -31,9 +39,16 @@ 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,
48
+ ...documentationScript,
35
49
  ...lintScript,
36
50
  ...prettierScript,
51
+ ...tscScript,
37
52
  };
38
53
  `;
39
54
 
@@ -61,6 +76,7 @@ const toolsScript = {
61
76
  "z:show:package": "npx lerna ls -a -l",
62
77
  "z:sleep": "npx easy-soft-develop sleep --second 2 --showInfo false",
63
78
  "z:create:assist-scripts": "npx easy-soft-develop create-assist-scripts",
79
+ "z:update:package-from-package": "node ./develop/assists/update-package-from-package.js",
64
80
  };
65
81
 
66
82
  const publishScript = {
@@ -71,7 +87,7 @@ const publishScript = {
71
87
  'postz:publish-npm-all': 'npm run z:change:nrm:local',
72
88
  'prez:publish:lerna': 'npm run z:change:nrm:npm',
73
89
  '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',
90
+ 'postz:publish:lerna': 'npm run z:change:nrm:local && npm run z:publish-npm-all',
75
91
  'prez:publish:build': 'npm run z:install && npm run cz && npm run z:build:all',
76
92
  'z:publish:build': 'npm run z:publish:lerna',
77
93
  };
@@ -95,7 +95,6 @@ const content = \`# ignore dir
95
95
  *.min.js
96
96
 
97
97
  # ignore special
98
- .prettierrc.js
99
98
  .eslintignore
100
99
  .stylelintignore
101
100
  .gitattributes