easy-soft-develop 2.1.229 → 2.1.233
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 +10 -0
- package/package.json +8 -6
- package/src/cliCollection/copy-content.js +12 -0
- package/src/index.js +4 -0
- package/src/tools/meta.js +57 -0
- package/types/cliCollection/copy-content.d.ts +1 -0
- package/types/index.d.ts +4 -0
- package/types/tools/meta.d.ts +8 -0
package/bin/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ const { Command } = require('commander');
|
|
|
4
4
|
|
|
5
5
|
const { getArgCollection } = require('../src/tools/meta');
|
|
6
6
|
const createAssistScripts = require('../src/cliCollection/create-assist-scripts.cli');
|
|
7
|
+
const copyContent = require('../src/cliCollection/copy-content');
|
|
7
8
|
const checkAllPackageVersion = require('../src/cliCollection/check-all-package-version');
|
|
8
9
|
const checkEveryPackageVersion = require('../src/cliCollection/check-every-package-version');
|
|
9
10
|
const updateAllPackageVersion = require('../src/cliCollection/update-all-package-version');
|
|
@@ -75,6 +76,15 @@ program
|
|
|
75
76
|
sleep.run(a, o);
|
|
76
77
|
});
|
|
77
78
|
|
|
79
|
+
program
|
|
80
|
+
.command('copy-content')
|
|
81
|
+
.description('copy content from source file content to target file content')
|
|
82
|
+
.option('--source <string>', 'source file path')
|
|
83
|
+
.option('--target <string>', 'target file path will write')
|
|
84
|
+
.action((a, o) => {
|
|
85
|
+
copyContent.run(a, o);
|
|
86
|
+
});
|
|
87
|
+
|
|
78
88
|
program
|
|
79
89
|
.command('exit')
|
|
80
90
|
.description('exit process')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-soft-develop",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.233",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/kityandhero/easy-soft-develop#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
"prepare": "echo do other prepare work with here before install package",
|
|
32
32
|
"test:bin:check-all-package-version": "node ./bin/cli.js check-all-package-version",
|
|
33
33
|
"test:bin:code": "node ./bin/cli.js code --dataPath ./develop/generatorCodeSource/code.json",
|
|
34
|
+
"test:bin:copy-content": "node ./bin/cli.js copy-content --source ./develop/flags/commit.flag.json --target ./temp/testCopyContent/testCopyContent.json",
|
|
35
|
+
"posttest:bin:copy-content": "node ./bin/cli.js rimraf --path ./temp/testCopyContent",
|
|
34
36
|
"test:bin:create-assist-scripts": "node ./bin/cli.js create-assist-scripts",
|
|
35
37
|
"test:bin:create-project-from-repository": "node ./bin/cli.js create-project-from-repository --repository kityandhero/mono-antd-management-fast-master-template --folder ./temp/create-project-from-repository-demo",
|
|
36
38
|
"test:bin:create-repository-project": "node ./bin/cli.js create-repository-project",
|
|
@@ -87,7 +89,7 @@
|
|
|
87
89
|
},
|
|
88
90
|
"devDependencies": {
|
|
89
91
|
"@changesets/cli": "^2.27.7",
|
|
90
|
-
"@commitlint/cli": "^19.
|
|
92
|
+
"@commitlint/cli": "^19.4.0",
|
|
91
93
|
"@commitlint/config-conventional": "^19.2.2",
|
|
92
94
|
"@commitlint/config-pnpm-scopes": "^19.1.0",
|
|
93
95
|
"commitizen": "^4.3.0",
|
|
@@ -100,10 +102,10 @@
|
|
|
100
102
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
101
103
|
"eslint-plugin-import": "^2.29.1",
|
|
102
104
|
"eslint-plugin-prettier": "^5.2.1",
|
|
103
|
-
"eslint-plugin-promise": "^
|
|
104
|
-
"husky": "^9.1.
|
|
105
|
-
"lint-staged": "^15.2.
|
|
106
|
-
"npm-check-updates": "^
|
|
105
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
106
|
+
"husky": "^9.1.5",
|
|
107
|
+
"lint-staged": "^15.2.9",
|
|
108
|
+
"npm-check-updates": "^17.0.6",
|
|
107
109
|
"prettier": "^3.3.3",
|
|
108
110
|
"prettier-plugin-packagejson": "^2.5.1"
|
|
109
111
|
}
|
package/src/index.js
CHANGED
|
@@ -35,6 +35,8 @@ const {
|
|
|
35
35
|
writeFileWithFolderAndNameSync,
|
|
36
36
|
writeFileWithOptionsSync,
|
|
37
37
|
writeJsonFileSync,
|
|
38
|
+
copyContentSync,
|
|
39
|
+
touchSync,
|
|
38
40
|
} = require('./tools/meta');
|
|
39
41
|
const { sleep } = require('./tools/sleep');
|
|
40
42
|
const { clean } = require('./tools/clean');
|
|
@@ -75,6 +77,7 @@ module.exports = {
|
|
|
75
77
|
checkStringIsEmpty,
|
|
76
78
|
clean,
|
|
77
79
|
commitRefresh,
|
|
80
|
+
copyContentSync,
|
|
78
81
|
copyFile,
|
|
79
82
|
copyFileSync,
|
|
80
83
|
copyFolder,
|
|
@@ -115,6 +118,7 @@ module.exports = {
|
|
|
115
118
|
readJsonFileSync,
|
|
116
119
|
resolvePath,
|
|
117
120
|
sleep,
|
|
121
|
+
touchSync,
|
|
118
122
|
updateAllPackageVersion,
|
|
119
123
|
updatePackageFromPackage,
|
|
120
124
|
updateSpecialPackageVersion,
|
package/src/tools/meta.js
CHANGED
|
@@ -490,11 +490,67 @@ function copyFolderSync({ sourceMainPath, targetMainPath, filepath }) {
|
|
|
490
490
|
);
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
+
function touchSync({ path }) {
|
|
494
|
+
if (checkStringIsEmpty(path)) {
|
|
495
|
+
promptError('touchSync params error: path not allow empty');
|
|
496
|
+
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
const pathAdjust = resolvePath(path);
|
|
501
|
+
|
|
502
|
+
if (!existPathSync(pathAdjust)) {
|
|
503
|
+
promptInfo(`touch file: "${pathAdjust}" not exist, will create it.`);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
fsExtra.ensureFileSync(pathAdjust);
|
|
507
|
+
|
|
508
|
+
// try {
|
|
509
|
+
// const time = new Date();
|
|
510
|
+
|
|
511
|
+
// fs.utimesSync(pathAdjust, time, time);
|
|
512
|
+
// } catch (e) {
|
|
513
|
+
// promptInfo(`"${pathAdjust}" not exist, will create it.`);
|
|
514
|
+
|
|
515
|
+
// let fd = fs.openSync(pathAdjust, 'a');
|
|
516
|
+
|
|
517
|
+
// fs.closeSync(fd);
|
|
518
|
+
// }
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function copyContentSync({ sourcePath, targetPath }) {
|
|
522
|
+
if (checkStringIsEmpty(sourcePath)) {
|
|
523
|
+
promptError('copyContentSync params error: sourcePath not allow empty');
|
|
524
|
+
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
if (checkStringIsEmpty(targetPath)) {
|
|
529
|
+
promptError('copyContentSync params error: targetMainPath not allow empty');
|
|
530
|
+
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
const sourcePathAdjust = resolvePath(sourcePath);
|
|
535
|
+
const targetPathAdjust = resolvePath(targetPath);
|
|
536
|
+
|
|
537
|
+
touchSync({ path: targetPath });
|
|
538
|
+
|
|
539
|
+
promptTip('copy content', `"${sourcePath}" -> "${targetPath}".`);
|
|
540
|
+
promptTip('source absolute path', sourcePathAdjust);
|
|
541
|
+
promptTip('target absolute path', targetPathAdjust);
|
|
542
|
+
|
|
543
|
+
const content = fs.readFileSync(sourcePathAdjust);
|
|
544
|
+
|
|
545
|
+
writeFileSync(targetPathAdjust, content, { coverFile: true });
|
|
546
|
+
}
|
|
547
|
+
|
|
493
548
|
module.exports = {
|
|
494
549
|
assignObject,
|
|
495
550
|
cd,
|
|
496
551
|
checkInCollection,
|
|
497
552
|
checkStringIsEmpty,
|
|
553
|
+
copyContentSync,
|
|
498
554
|
copyFile,
|
|
499
555
|
copyFileSync,
|
|
500
556
|
copyFolder,
|
|
@@ -525,6 +581,7 @@ module.exports = {
|
|
|
525
581
|
readJsonFileSync,
|
|
526
582
|
resolvePath,
|
|
527
583
|
rimraf,
|
|
584
|
+
touchSync,
|
|
528
585
|
writeFileSync,
|
|
529
586
|
writeFileWithFolderAndNameSync,
|
|
530
587
|
writeFileWithOptionsSync,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function run(s: any, o: any): void;
|
package/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { checkInCollection } from './tools/meta';
|
|
|
5
5
|
import { checkStringIsEmpty } from './tools/meta';
|
|
6
6
|
import { clean } from './tools/clean';
|
|
7
7
|
import { commitRefresh } from './tools/commit.refresh';
|
|
8
|
+
import { copyContentSync } from './tools/meta';
|
|
8
9
|
import { copyFile } from './tools/meta';
|
|
9
10
|
import { copyFileSync } from './tools/meta';
|
|
10
11
|
import { copyFolder } from './tools/meta';
|
|
@@ -45,6 +46,7 @@ import { promptWarn } from './tools/meta';
|
|
|
45
46
|
import { readJsonFileSync } from './tools/meta';
|
|
46
47
|
import { resolvePath } from './tools/meta';
|
|
47
48
|
import { sleep } from './tools/sleep';
|
|
49
|
+
import { touchSync } from './tools/meta';
|
|
48
50
|
import { updateAllPackageVersion } from './tools/package.update';
|
|
49
51
|
import { updatePackageFromPackage } from './tools/update.package.from.package';
|
|
50
52
|
import { updateSpecialPackageVersion } from './tools/package.update';
|
|
@@ -60,6 +62,7 @@ export {
|
|
|
60
62
|
checkStringIsEmpty,
|
|
61
63
|
clean,
|
|
62
64
|
commitRefresh,
|
|
65
|
+
copyContentSync,
|
|
63
66
|
copyFile,
|
|
64
67
|
copyFileSync,
|
|
65
68
|
copyFolder,
|
|
@@ -100,6 +103,7 @@ export {
|
|
|
100
103
|
readJsonFileSync,
|
|
101
104
|
resolvePath,
|
|
102
105
|
sleep,
|
|
106
|
+
touchSync,
|
|
103
107
|
updateAllPackageVersion,
|
|
104
108
|
updatePackageFromPackage,
|
|
105
109
|
updateSpecialPackageVersion,
|
package/types/tools/meta.d.ts
CHANGED
|
@@ -7,6 +7,13 @@ export function cd(path: any): void;
|
|
|
7
7
|
*/
|
|
8
8
|
export function checkInCollection(collection: any[], target: any): boolean;
|
|
9
9
|
export function checkStringIsEmpty(v: any): boolean;
|
|
10
|
+
export function copyContentSync({
|
|
11
|
+
sourcePath,
|
|
12
|
+
targetPath,
|
|
13
|
+
}: {
|
|
14
|
+
sourcePath: any;
|
|
15
|
+
targetPath: any;
|
|
16
|
+
}): void;
|
|
10
17
|
export function copyFile({
|
|
11
18
|
sourceMainPath,
|
|
12
19
|
targetMainPath,
|
|
@@ -80,6 +87,7 @@ export function promptWarn(message: any, emptyLine?: boolean): void;
|
|
|
80
87
|
export function readJsonFileSync(path: any): any;
|
|
81
88
|
export function resolvePath(path: any): any;
|
|
82
89
|
export function rimraf(path: any): void;
|
|
90
|
+
export function touchSync({ path }: { path: any }): void;
|
|
83
91
|
export function writeFileSync(
|
|
84
92
|
path: any,
|
|
85
93
|
content: any,
|