@cyber-tools/create-cyber-tools 9.1.0 → 9.3.0
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/dist/index.js +86112 -0
- package/package.json +2 -2
- package/src/utils/CommandLineToast.ts +5 -1
- package/src/utils/CommandLineUtils.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyber-tools/create-cyber-tools",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "用于创建cyber系列工具的命令行工具",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
|
-
"bin": "
|
|
14
|
+
"bin": "./dist/index.js",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"cli",
|
|
17
17
|
"tools",
|
|
@@ -6,7 +6,11 @@ import { IOCContainer } from "@/commons/IOCContainer";
|
|
|
6
6
|
@injectable()
|
|
7
7
|
export class CommandLineToast {
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
private toast = ora(dots);
|
|
10
|
+
|
|
11
|
+
public warn(...params: any) {
|
|
12
|
+
this.toast.warn(...arguments);
|
|
13
|
+
};
|
|
10
14
|
|
|
11
15
|
public start(...params: any) {
|
|
12
16
|
this.toast.start(...arguments);
|
|
@@ -90,10 +90,10 @@ export class CommandLineUtils {
|
|
|
90
90
|
const isValidate = (validForNewPackages && validForOldPackages);
|
|
91
91
|
const isAvailable = await npmName(name);
|
|
92
92
|
if (isValidate && isAvailable) {
|
|
93
|
-
this.$CommandLineToast.
|
|
93
|
+
this.$CommandLineToast.succeed(["包名(", name, ")可用!"].join(""));
|
|
94
94
|
return true;
|
|
95
95
|
};
|
|
96
|
-
this.$CommandLineToast.
|
|
96
|
+
this.$CommandLineToast.fail(["包名(", name, ")不可用!"].join(""));
|
|
97
97
|
return false;
|
|
98
98
|
} catch (error) {
|
|
99
99
|
throw error;
|
|
@@ -121,7 +121,7 @@ export class CommandLineUtils {
|
|
|
121
121
|
* **/
|
|
122
122
|
public async changeJsonFile({ folderName, projectName, devDependencies }) {
|
|
123
123
|
try {
|
|
124
|
-
this.$CommandLineToast.
|
|
124
|
+
this.$CommandLineToast.start("修改package.json");
|
|
125
125
|
const jsonFilePath = path.resolve(process.cwd(), folderName, "./package.json");
|
|
126
126
|
const jsonObject = await promisify(readFile)(jsonFilePath);
|
|
127
127
|
const rewriteJsonObject = Object.assign({}, jsonObject, {
|