@cyber-tools/cyber-git 4.5.0 → 4.7.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
CHANGED
|
@@ -5540,9 +5540,10 @@ var import_commander = require("commander");
|
|
|
5540
5540
|
// package.json
|
|
5541
5541
|
var package_default = {
|
|
5542
5542
|
name: "@cyber-tools/cyber-git",
|
|
5543
|
-
version: "4.
|
|
5543
|
+
version: "4.7.0",
|
|
5544
5544
|
description: "\u89C4\u8303\u5316git\u64CD\u4F5C\u7684\u76F8\u5173\u7684\u811A\u672C\u548C\u5DE5\u5177",
|
|
5545
5545
|
main: "./dist/index.js",
|
|
5546
|
+
types: "./types/index.d.ts",
|
|
5546
5547
|
scripts: {
|
|
5547
5548
|
dev: "node -r esbuild-register ./frameworks/development.ts",
|
|
5548
5549
|
build: "node -r esbuild-register ./frameworks/build.ts",
|
|
@@ -5580,7 +5581,9 @@ var package_default = {
|
|
|
5580
5581
|
"@types/node": "^25.5.0",
|
|
5581
5582
|
esbuild: "^0.27.4",
|
|
5582
5583
|
"esbuild-node-externals": "^1.20.1",
|
|
5583
|
-
"esbuild-register": "^3.6.0"
|
|
5584
|
+
"esbuild-register": "^3.6.0",
|
|
5585
|
+
"ts-morph": "^27.0.2",
|
|
5586
|
+
typescript: "^5.7.3"
|
|
5584
5587
|
}
|
|
5585
5588
|
};
|
|
5586
5589
|
|
|
@@ -6171,6 +6174,7 @@ var CreateIgnoreFile = class {
|
|
|
6171
6174
|
this.ignoreFiletemplate = [
|
|
6172
6175
|
"/logs/",
|
|
6173
6176
|
"/dist/",
|
|
6177
|
+
"/types/",
|
|
6174
6178
|
"/assest/",
|
|
6175
6179
|
"/node_modules/",
|
|
6176
6180
|
"**/.DS_Store/**",
|
package/frameworks/build.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import fs from "fs";
|
|
1
2
|
import path from "path";
|
|
2
3
|
import esbuild from "esbuild";
|
|
4
|
+
import { promisify } from "util";
|
|
3
5
|
import { nodeExternalsPlugin } from "esbuild-node-externals";
|
|
4
6
|
|
|
7
|
+
import { generateDeclaration } from "@@/frameworks/generateDeclaration";
|
|
8
|
+
|
|
5
9
|
setImmediate(async () => {
|
|
10
|
+
await promisify(fs.rm)(path.resolve(process.cwd(), "./dist/"), { recursive: true, force: true });
|
|
6
11
|
await esbuild.build({
|
|
7
12
|
entryPoints: [path.resolve(process.cwd(), "./src/index.ts")],
|
|
8
13
|
bundle: true,
|
|
@@ -13,4 +18,5 @@ setImmediate(async () => {
|
|
|
13
18
|
packagePath: path.resolve(process.cwd(), "./package.json")
|
|
14
19
|
})]
|
|
15
20
|
});
|
|
21
|
+
await generateDeclaration();
|
|
16
22
|
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { Project } from "ts-morph";
|
|
3
|
+
import { readFile } from "jsonfile";
|
|
4
|
+
|
|
5
|
+
export async function generateDeclaration() {
|
|
6
|
+
/** 以下是生成DTS类型注释的逻辑 **/
|
|
7
|
+
const tsConfigFileContent = await readFile(path.resolve(process.cwd(), "./tsconfig.json"));
|
|
8
|
+
/** 处理掉compilerOptions中对输出结果有影响的属性 **/
|
|
9
|
+
delete tsConfigFileContent.compilerOptions["target"];
|
|
10
|
+
delete tsConfigFileContent.compilerOptions["module"];
|
|
11
|
+
delete tsConfigFileContent.compilerOptions["moduleResolution"];
|
|
12
|
+
const project = new Project(tsConfigFileContent);
|
|
13
|
+
project.addSourceFilesAtPaths("./src/**/*.ts");
|
|
14
|
+
/** 获取到所有的源代码管理对象 **/
|
|
15
|
+
const sourceFiles = project.getSourceFiles();
|
|
16
|
+
/** 计算出当前项目的绝对路径 **/
|
|
17
|
+
const projectDirectory = path.resolve(process.cwd(), "./src/");
|
|
18
|
+
/** 循环处理源代码中的路径别名 **/
|
|
19
|
+
sourceFiles.forEach((everySourceFile) => {
|
|
20
|
+
everySourceFile.getImportDeclarations().forEach((importPackagePath) => {
|
|
21
|
+
const module = importPackagePath.getModuleSpecifierValue();
|
|
22
|
+
if (module.startsWith("@")) {
|
|
23
|
+
const sourceFileDirectoryPath = everySourceFile.getDirectoryPath();
|
|
24
|
+
const relativePath = path.relative(sourceFileDirectoryPath, projectDirectory);
|
|
25
|
+
importPackagePath.setModuleSpecifier(module.replace("@", relativePath));
|
|
26
|
+
};
|
|
27
|
+
if (module.startsWith("@@")) {
|
|
28
|
+
const sourceFileDirectoryPath = everySourceFile.getDirectoryPath();
|
|
29
|
+
const relativePath = path.relative(sourceFileDirectoryPath, projectDirectory);
|
|
30
|
+
importPackagePath.setModuleSpecifier(module.replace("@", relativePath));
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
await project.emit();
|
|
35
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyber-tools/cyber-git",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "规范化git操作的相关的脚本和工具",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
|
+
"types": "./types/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"dev": "node -r esbuild-register ./frameworks/development.ts",
|
|
8
9
|
"build": "node -r esbuild-register ./frameworks/build.ts",
|
|
@@ -40,6 +41,8 @@
|
|
|
40
41
|
"@types/node": "^25.5.0",
|
|
41
42
|
"esbuild": "^0.27.4",
|
|
42
43
|
"esbuild-node-externals": "^1.20.1",
|
|
43
|
-
"esbuild-register": "^3.6.0"
|
|
44
|
+
"esbuild-register": "^3.6.0",
|
|
45
|
+
"ts-morph": "^27.0.2",
|
|
46
|
+
"typescript": "^5.7.3"
|
|
44
47
|
}
|
|
45
48
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
"declaration": true,
|
|
4
|
+
"emitDeclarationOnly": true,
|
|
3
5
|
"emitDecoratorMetadata": true,
|
|
4
6
|
"experimentalDecorators": true,
|
|
5
7
|
"target": "es2016",
|
|
6
8
|
"module": "commonjs",
|
|
7
|
-
"baseUrl": "
|
|
9
|
+
"baseUrl": ".",
|
|
8
10
|
"moduleResolution": "node",
|
|
9
11
|
"resolveJsonModule": true,
|
|
12
|
+
"outDir": "./types/",
|
|
10
13
|
"esModuleInterop": true,
|
|
11
14
|
"forceConsistentCasingInFileNames": true,
|
|
12
15
|
"strict": false,
|
|
@@ -18,7 +21,7 @@
|
|
|
18
21
|
],
|
|
19
22
|
"@@/*": [
|
|
20
23
|
"./*"
|
|
21
|
-
]
|
|
24
|
+
]
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
}
|