easy-soft-develop 2.1.103 → 2.1.107
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 +9 -0
- package/package.json +4 -1
- package/src/cliCollection/rimraf.js +9 -0
- package/src/templates/babel.config.template.js +5 -2
- package/src/templates/package.template.js +1 -1
- package/src/tools/meta.js +41 -1
- package/src/tools/update.project.from.master.template.js +2 -2
- package/types/cliCollection/rimraf.d.ts +1 -0
- package/types/templates/babel.config.template.d.ts +5 -5
- package/types/templates/package.template.d.ts +28 -28
- package/types/tools/meta.d.ts +33 -11
package/bin/cli.js
CHANGED
|
@@ -17,6 +17,7 @@ const createProjectWithMasterTemplate = require('../src/cliCollection/create-pro
|
|
|
17
17
|
const updateProjectWithMasterTemplate = require('../src/cliCollection/update-project-with-master-template');
|
|
18
18
|
const prompt = require('../src/cliCollection/prompt');
|
|
19
19
|
const code = require('../src/cliCollection/createCode');
|
|
20
|
+
const rimraf = require('../src/cliCollection/rimraf');
|
|
20
21
|
|
|
21
22
|
const program = new Command();
|
|
22
23
|
|
|
@@ -166,4 +167,12 @@ program
|
|
|
166
167
|
code.run(a, o);
|
|
167
168
|
});
|
|
168
169
|
|
|
170
|
+
program
|
|
171
|
+
.command('rimraf')
|
|
172
|
+
.description('remove target path by use rimraf')
|
|
173
|
+
.option('--path <string>', 'target path will remove')
|
|
174
|
+
.action((a, o) => {
|
|
175
|
+
rimraf.run(a, o);
|
|
176
|
+
});
|
|
177
|
+
|
|
169
178
|
program.parse(getArgCollection());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-soft-develop",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.107",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/kityandhero/easy-soft-develop#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"test:bin:create-assist-scripts": "node ./bin/cli.js create-assist-scripts",
|
|
35
35
|
"test:bin:create-repository-project": "node ./bin/cli.js create-repository-project",
|
|
36
36
|
"test:bin:publish": "node ./bin/cli.js publish --packages ss --otp true",
|
|
37
|
+
"test:bin:rimraf": "node ./bin/cli.js rimraf --path ./testRemoveThisPath",
|
|
37
38
|
"test:bin:sleep": "node ./bin/cli.js sleep --second 2 --showInfo true",
|
|
38
39
|
"test:bin:update-all-package-version": "node ./bin/cli.js update-all-package-version",
|
|
39
40
|
"test:bin:update-project-with-master-template": "node ./bin/cli.js update-project-with-master-template --projectPath E:\\temp\\2\\test",
|
|
@@ -44,6 +45,8 @@
|
|
|
44
45
|
"test:createPackageUpdateAllVersionScriptFile": "node ./test/createPackageUpdateAllVersionScriptFile.test.js",
|
|
45
46
|
"test:createSleepScriptFile": "node ./test/createSleepScriptFile.test.js",
|
|
46
47
|
"test:inner:assignObject": "node ./test/assignObject.test.js",
|
|
48
|
+
"test:inner:existPath": "node ./test/existPath.test.js",
|
|
49
|
+
"test:inner:rimraf": "node ./test/rimraf.test.js",
|
|
47
50
|
"z:change:npm:registry:local": "nrm use local",
|
|
48
51
|
"z:change:npm:registry:npm": "nrm use npm",
|
|
49
52
|
"z:check:all-package-version": "npx ncu",
|
|
@@ -3,12 +3,15 @@ const { fileGlobalHeader } = require('./template.config');
|
|
|
3
3
|
const folderPath = '.';
|
|
4
4
|
|
|
5
5
|
const contentFileContent = `${fileGlobalHeader}
|
|
6
|
-
|
|
6
|
+
function buildConfig(api) {
|
|
7
7
|
api.cache(true);
|
|
8
|
+
|
|
8
9
|
return {
|
|
9
10
|
babelrcRoots: ['.', 'packages/*'],
|
|
10
11
|
};
|
|
11
|
-
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = buildConfig;
|
|
12
15
|
`;
|
|
13
16
|
|
|
14
17
|
const contentFile = {
|
|
@@ -8,7 +8,7 @@ const commitScript = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const documentationScript = {
|
|
11
|
-
'prez:documentation:generate': '
|
|
11
|
+
'prez:documentation:generate': 'rimraf ./docs && npm run z:documentation:lint',
|
|
12
12
|
'z:documentation:generate': 'npx documentation build src/** -f html --github -o docs',
|
|
13
13
|
'z:documentation:lint': 'npx documentation lint src/**',
|
|
14
14
|
};
|
package/src/tools/meta.js
CHANGED
|
@@ -130,17 +130,31 @@ function promptError(error) {
|
|
|
130
130
|
promptEmptyLine();
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
function
|
|
133
|
+
function existPathSync(path) {
|
|
134
|
+
if (!path || typeof path !== 'string') {
|
|
135
|
+
throw new TypeError('file path not allow empty');
|
|
136
|
+
}
|
|
137
|
+
|
|
134
138
|
try {
|
|
135
139
|
fs.accessSync(path, fs.F_OK);
|
|
136
140
|
} catch (error) {
|
|
137
141
|
return false;
|
|
138
142
|
}
|
|
139
143
|
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function existFileSync(path) {
|
|
140
148
|
if (!path || typeof path !== 'string') {
|
|
141
149
|
throw new TypeError('file path not allow empty');
|
|
142
150
|
}
|
|
143
151
|
|
|
152
|
+
try {
|
|
153
|
+
fs.accessSync(path, fs.F_OK);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
|
|
144
158
|
const p = resolvePath(path);
|
|
145
159
|
|
|
146
160
|
const state = fs.statSync(p);
|
|
@@ -256,11 +270,36 @@ function readJsonFileSync(path) {
|
|
|
256
270
|
return fsExtra.readJsonSync(path);
|
|
257
271
|
}
|
|
258
272
|
|
|
273
|
+
function rimraf(path) {
|
|
274
|
+
if (checkStringIsEmpty(path)) {
|
|
275
|
+
promptWarn(`path is empty`);
|
|
276
|
+
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (!existPathSync(path)) {
|
|
281
|
+
promptWarn(`path not exist: "${path}"`);
|
|
282
|
+
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const cmd = `rimraf ${resolvePath(path)}`;
|
|
287
|
+
|
|
288
|
+
promptInfo(
|
|
289
|
+
`remove target by use rimraf package, make sure rimraf installed with global mode.`,
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
exec(cmd);
|
|
293
|
+
|
|
294
|
+
promptSuccess(`remove path success, path: "${path}"`);
|
|
295
|
+
}
|
|
296
|
+
|
|
259
297
|
module.exports = {
|
|
260
298
|
exec,
|
|
261
299
|
cd,
|
|
262
300
|
getArgCollection,
|
|
263
301
|
checkInCollection,
|
|
302
|
+
existPathSync,
|
|
264
303
|
existFileSync,
|
|
265
304
|
existDirectorySync,
|
|
266
305
|
writeFileSync,
|
|
@@ -281,4 +320,5 @@ module.exports = {
|
|
|
281
320
|
writeFileWithOptionsSync,
|
|
282
321
|
resolvePath,
|
|
283
322
|
exit,
|
|
323
|
+
rimraf,
|
|
284
324
|
};
|
|
@@ -72,13 +72,13 @@ function copyFolder({
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function clearResource() {
|
|
75
|
-
const removeSourceFolderCmd = `
|
|
75
|
+
const removeSourceFolderCmd = `rimraf ${resolvePath(`./temp/source/`)}`;
|
|
76
76
|
|
|
77
77
|
promptInfo(`remove folder: "./temp/source/"`);
|
|
78
78
|
|
|
79
79
|
exec(removeSourceFolderCmd);
|
|
80
80
|
|
|
81
|
-
const removeZipFolderCmd = `
|
|
81
|
+
const removeZipFolderCmd = `rimraf ${resolvePath(`./temp/zip/`)}`;
|
|
82
82
|
|
|
83
83
|
promptInfo(`remove folder: "./temp/zip/"`);
|
|
84
84
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function run(s: any, o: any): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export namespace contentFile {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export let folderPath: string;
|
|
3
|
+
export let fileName: string;
|
|
4
|
+
export let coverFile: boolean;
|
|
5
|
+
export { contentFileContent as fileContent };
|
|
6
6
|
}
|
|
7
|
-
declare const contentFileContent: "/* eslint-disable no-undef */\n/* eslint-disable import/no-commonjs */\n/* eslint-disable unicorn/prefer-module */\n/* eslint-disable no-useless-escape */\n\
|
|
7
|
+
declare const contentFileContent: "/* eslint-disable no-undef */\n/* eslint-disable import/no-commonjs */\n/* eslint-disable unicorn/prefer-module */\n/* eslint-disable no-useless-escape */\n\nfunction buildConfig(api) {\n api.cache(true);\n\n return {\n babelrcRoots: ['.', 'packages/*'],\n };\n}\n\nmodule.exports = buildConfig;\n";
|
|
8
8
|
export {};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
export namespace globalChildPackageFile {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export let folderPath: string;
|
|
3
|
+
export let fileName: string;
|
|
4
|
+
export let coverFile: boolean;
|
|
5
|
+
export { globalChildPackageFileContent as fileContent };
|
|
6
6
|
}
|
|
7
7
|
export namespace globalMainPackageFile {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
let folderPath_1: string;
|
|
9
|
+
export { folderPath_1 as folderPath };
|
|
10
|
+
let fileName_1: string;
|
|
11
|
+
export { fileName_1 as fileName };
|
|
12
|
+
let coverFile_1: boolean;
|
|
13
|
+
export { coverFile_1 as coverFile };
|
|
14
|
+
export let fileContent: string;
|
|
15
15
|
}
|
|
16
16
|
export namespace customMainPackageFile {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
let folderPath_2: string;
|
|
18
|
+
export { folderPath_2 as folderPath };
|
|
19
|
+
let fileName_2: string;
|
|
20
|
+
export { fileName_2 as fileName };
|
|
21
|
+
let coverFile_2: boolean;
|
|
22
|
+
export { coverFile_2 as coverFile };
|
|
23
|
+
export { customMainPackageFileContent as fileContent };
|
|
24
24
|
}
|
|
25
25
|
export namespace customChildPackageFile {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
let folderPath_3: string;
|
|
27
|
+
export { folderPath_3 as folderPath };
|
|
28
|
+
let fileName_3: string;
|
|
29
|
+
export { fileName_3 as fileName };
|
|
30
|
+
let coverFile_3: boolean;
|
|
31
|
+
export { coverFile_3 as coverFile };
|
|
32
|
+
export { customChildPackageFileContent as fileContent };
|
|
33
33
|
}
|
|
34
|
-
declare const globalChildPackageFileContent: "/* eslint-disable no-undef */\n/* eslint-disable import/no-commonjs */\n/* eslint-disable unicorn/prefer-module */\n/* eslint-disable no-useless-escape */\n\nconst commitScript = {\n precommit: 'npm run z:lint:staged:quiet',\n};\n\nconst documentationScript = {\n 'prez:documentation:generate': '
|
|
35
|
-
declare const customMainPackageFileContent:
|
|
36
|
-
declare const customChildPackageFileContent:
|
|
34
|
+
declare const globalChildPackageFileContent: "/* eslint-disable no-undef */\n/* eslint-disable import/no-commonjs */\n/* eslint-disable unicorn/prefer-module */\n/* eslint-disable no-useless-escape */\n\nconst commitScript = {\n precommit: 'npm run z:lint:staged:quiet',\n};\n\nconst documentationScript = {\n 'prez:documentation:generate': 'rimraf ./docs && npm run z:documentation:lint',\n 'z:documentation:generate': 'npx documentation build src/** -f html --github -o docs',\n 'z:documentation:lint': 'npx documentation lint src/**',\n};\n\nconst lintScript = {\n 'z:lint:file:all': 'npm run z:lint:script:all && npm run z:lint:style:all',\n 'z:lint:file:all:fix': 'npm run z:lint:script:all:fix && npm run z:lint:style:all:fix',\n 'z:lint:file:change': 'npm run z:lint:script:change && npm run z:lint:style:all',\n 'z:lint:file:change:fix': 'npm run z:lint:script:change:fix && npm run z:lint:style:all:fix',\n 'z:lint:script:all': 'npx eslint --ext .js,.jsx,.ts,.tsx ./src',\n 'z:lint:script:all:fix': 'npx eslint --fix --ext .js,.jsx,.ts,.tsx ./src',\n 'postz:lint:script:all:fix': 'npm run z:prettier:format:all',\n 'z:lint:script:change': 'npx eslint --cache --ext .js,.jsx,.ts,.tsx ./src',\n 'z:lint:script:change:fix': 'npx eslint --fix --cache --ext .js,.jsx,.ts,.tsx ./src',\n 'postz:lint:script:change:fix': 'npm run z:prettier:format:change',\n 'z:lint:staged': 'npx lint-staged',\n 'z:lint:staged:quiet': 'npx lint-staged --quiet',\n 'z:lint:style:all': 'npx stylelint --allow-empty-input \"./src/**/*.{css,scss,less}\"',\n 'z:lint:style:all:fix': 'npx stylelint --allow-empty-input --fix \"./src/**/*.{css,scss,less}\"',\n 'postz:lint:style:all:fix': 'npm run z:prettier:format:all',\n 'z:lint:style:change': 'npx stylelint --allow-empty-input --cache \"./src/**/*.{css,scss,less}\"',\n 'z:lint:style:change:fix': 'npx stylelint --allow-empty-input --cache --fix \"./src/**/*.{css,scss,less}\"',\n 'postz:lint:style:change:fix': 'npm run z:prettier:format:change',\n};\n\nconst prettierScript = {\n 'z:prettier:format:all': 'npx prettier --write .',\n 'z:prettier:format:change': 'npx prettier --cache --write .',\n 'z:prettier:package.json': 'npx prettier --write ./package.json',\n};\n\nconst tscScript = {\n 'z:tsc:build': 'echo show tsc version and create declaration file && tsc -v && tsc -p ./tsconfig.types.json && echo declaration file generate complete',\n};\n\nconst jestScript = {\n 'z:test': 'cross-env NODE_ENV=test jest',\n};\n\nmodule.exports = {\n ...commitScript,\n ...documentationScript,\n ...lintScript,\n ...prettierScript,\n ...tscScript,\n ...jestScript,\n};\n";
|
|
35
|
+
declare const customMainPackageFileContent: '/* eslint-disable no-undef */\n/* eslint-disable import/no-commonjs */\n/* eslint-disable unicorn/prefer-module */\n/* eslint-disable no-useless-escape */\n\nconst scripts = {};\n\nmodule.exports = {\n ...scripts,\n};\n';
|
|
36
|
+
declare const customChildPackageFileContent: '/* eslint-disable no-undef */\n/* eslint-disable import/no-commonjs */\n/* eslint-disable unicorn/prefer-module */\n/* eslint-disable no-useless-escape */\n\nconst scripts = {};\n\nmodule.exports = {\n ...scripts,\n};\n';
|
|
37
37
|
export {};
|
package/types/tools/meta.d.ts
CHANGED
|
@@ -7,11 +7,16 @@ export function getArgCollection(): any;
|
|
|
7
7
|
* @param {*} target the target value will be checked
|
|
8
8
|
*/
|
|
9
9
|
export function checkInCollection(collection: any[], target: any): boolean;
|
|
10
|
+
export function existPathSync(path: any): boolean;
|
|
10
11
|
export function existFileSync(path: any): any;
|
|
11
12
|
export function existDirectorySync(path: any): any;
|
|
12
|
-
export function writeFileSync(
|
|
13
|
+
export function writeFileSync(
|
|
14
|
+
path: any,
|
|
15
|
+
content: any,
|
|
16
|
+
options?: {
|
|
13
17
|
coverFile: boolean;
|
|
14
|
-
}
|
|
18
|
+
},
|
|
19
|
+
): boolean;
|
|
15
20
|
export function checkStringIsEmpty(v: any): boolean;
|
|
16
21
|
/**
|
|
17
22
|
* Prompt line
|
|
@@ -27,16 +32,33 @@ export function isArray(value: any): boolean;
|
|
|
27
32
|
export function assignObject(source: any, ...mergeData: any[]): any;
|
|
28
33
|
export function mkdirSync(path: any): void;
|
|
29
34
|
export function readJsonFileSync(path: any): any;
|
|
30
|
-
export function writeJsonFileSync(
|
|
35
|
+
export function writeJsonFileSync(
|
|
36
|
+
path: any,
|
|
37
|
+
json: any,
|
|
38
|
+
options?: {
|
|
31
39
|
coverFile: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
},
|
|
41
|
+
): boolean;
|
|
42
|
+
export function writeFileWithFolderAndNameSync(
|
|
43
|
+
folderPath: any,
|
|
44
|
+
relativePath: any,
|
|
45
|
+
fileName: any,
|
|
46
|
+
fileContent: any,
|
|
47
|
+
coverFile?: boolean,
|
|
48
|
+
): boolean;
|
|
49
|
+
export function writeFileWithOptionsSync({
|
|
50
|
+
folderPath,
|
|
51
|
+
relativePath,
|
|
52
|
+
fileName,
|
|
53
|
+
fileContent,
|
|
54
|
+
coverFile,
|
|
55
|
+
}: {
|
|
56
|
+
folderPath: any;
|
|
57
|
+
relativePath?: string | undefined;
|
|
58
|
+
fileName: any;
|
|
59
|
+
fileContent: any;
|
|
60
|
+
coverFile?: boolean | undefined;
|
|
40
61
|
}): boolean;
|
|
41
62
|
export function resolvePath(path: any): any;
|
|
42
63
|
export function exit(): any;
|
|
64
|
+
export function rimraf(path: any): void;
|