@cyber-tools/create-cyber-project 9.0.0 → 9.2.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.
@@ -0,0 +1,13 @@
1
+ const path = require("path");
2
+ const esbuild = require("esbuild");
3
+
4
+ setImmediate(async () => {
5
+ await esbuild.build({
6
+ entryPoints: [path.resolve(process.cwd(), "./src/index.ts")],
7
+ bundle: true,
8
+ format: "cjs",
9
+ platform: "node",
10
+ outdir: path.resolve(process.cwd(), "./dist/"),
11
+ external: ["knex", "electron", "npm-name", "validate-npm-package-name"]
12
+ });
13
+ });
@@ -0,0 +1,17 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const esbuild = require("esbuild");
4
+ const { promisify } = require("util");
5
+
6
+ setImmediate(async () => {
7
+ await promisify(fs.rm)(path.resolve(process.cwd(), "./dist/"), { recursive: true, force: true });
8
+ await esbuild.build({
9
+ entryPoints: [path.resolve(process.cwd(), "./src/index.ts")],
10
+ bundle: true,
11
+ format: "cjs",
12
+ platform: "node",
13
+ outdir: path.resolve(process.cwd(), "./dist/"),
14
+ external: ["knex", "electron", "npm-name", "validate-npm-package-name"]
15
+ });
16
+ require("../dist/index.js");
17
+ });
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@cyber-tools/create-cyber-project",
3
- "version": "9.0.0",
4
- "main": "./.bin/index.js",
3
+ "version": "9.2.0",
4
+ "main": "./dist/index.js",
5
5
  "scripts": {
6
- "test": "echo test"
6
+ "dev": "node ./frameworks/development.js",
7
+ "build": "node ./frameworks/build.js",
8
+ "prepublishOnly": "npm run build"
7
9
  },
8
10
  "publishConfig": {
9
11
  "access": "public"
10
12
  },
11
- "bin": "./.bin/index.js",
13
+ "bin": "./dist/index.js",
12
14
  "keywords": [
13
15
  "cli",
14
16
  "cyber",
@@ -20,21 +22,22 @@
20
22
  "license": "ISC",
21
23
  "description": "用于创建cyber系列项目的命令行工具",
22
24
  "dependencies": {
23
- "ora": "^5.1.0",
24
- "colors": "1.4.0",
25
- "path-exists": "^4.0.0",
26
25
  "cli-spinners": "^2.4.0",
26
+ "colors": "1.4.0",
27
27
  "download-git-repo": "^3.0.2",
28
+ "esbuild-register": "^3.6.0",
28
29
  "inquirer": "^7.3.3",
29
30
  "inversify": "^6.0.2",
30
31
  "jsonfile": "^6.0.1",
31
32
  "lodash": "^4.17.23",
33
+ "ora": "^5.1.0",
34
+ "path-exists": "^4.0.0",
32
35
  "prompt": "1.2.2",
33
36
  "reflect-metadata": "^0.2.2",
34
- "esbuild-register": "^3.6.0",
35
37
  "winston": "3.6.0"
36
38
  },
37
39
  "devDependencies": {
40
+ "@types/node": "^25.5.0",
38
41
  "esbuild": "^0.27.4"
39
42
  }
40
43
  }
@@ -1,8 +1,8 @@
1
+ #!/usr/bin/env node
1
2
  import { IOCContainer } from "@/commons/IOCContainer";
2
3
  import { CommandLineUtils } from "@/utils/CommandLineUtils";
3
4
  import { ApplicationConfigManager } from "@/commons/ApplicationConfigManager";
4
5
 
5
- //@ts-ignore
6
6
  setImmediate(async () => {
7
7
  try {
8
8
  /** 初始化配置文件 **/
@@ -1,13 +1,11 @@
1
1
  import path from "path";
2
2
  import prompt from "prompt";
3
3
  import colors from "colors";
4
- import npmName from "npm-name";
5
4
  import inquirer from "inquirer";
6
5
  import { promisify } from "util";
7
6
  import download from "download-git-repo";
8
7
  import { readFile, writeFile } from "jsonfile";
9
8
  import { injectable, inject } from "inversify";
10
- import validate from "validate-npm-package-name";
11
9
 
12
10
  import { IOCContainer } from "@/commons/IOCContainer";
13
11
  import { CommandLineToast } from "@/utils/CommandLineToast";
@@ -59,26 +57,6 @@ export class CommandLineUtils {
59
57
  };
60
58
  };
61
59
 
62
- /**
63
- * 检查包明是否已经在npm注册
64
- * **/
65
- public async caniUseName(name: string) {
66
- try {
67
- this.$CommandLineToast.start(["正在查询包名(", name, ")是否可用", "... ..."].join(""));
68
- const { validForNewPackages, validForOldPackages } = await validate(name);
69
- const isValidate = (validForNewPackages && validForOldPackages);
70
- const isAvailable = await npmName(name);
71
- if (isValidate && isAvailable) {
72
- this.$CommandLineToast.toast.succeed(["包名(", name, ")可用!"].join(""));
73
- return true;
74
- };
75
- this.$CommandLineToast.toast.fail(["包名(", name, ")不可用!"].join(""));
76
- return false;
77
- } catch (error) {
78
- throw error;
79
- };
80
- };
81
-
82
60
  /**
83
61
  * 下载远程仓库中的代码摸板
84
62
  * **/
package/tsconfig.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "sourceMap": true,
15
15
  "paths": {
16
16
  "@/*": [
17
- "./*"
17
+ "./src/*"
18
18
  ]
19
19
  }
20
20
  }
package/.bin/index.js DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- require("esbuild-register");
3
- require("../index.ts");
File without changes
File without changes