@biuxiu/codegen 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/code/nest.js +24 -21
- package/dist/libs/nest-lib.d.ts +2 -2
- package/dist/libs/nest-lib.js +1 -1
- package/dist/lua_codegen_bg.wasm +0 -0
- package/package.json +1 -1
package/dist/code/nest.js
CHANGED
@@ -30,29 +30,9 @@ class RenderNest {
|
|
30
30
|
}
|
31
31
|
constructor(name, path) {
|
32
32
|
this.#path = path ? path.endsWith("/") ? `${this.#formatPath(path)}/${name}` : this.#formatPath(path) : name;
|
33
|
-
let basePath = "";
|
34
33
|
const apiDir = getApiDir();
|
35
|
-
if (this.#path.includes("/")) {
|
36
|
-
const pathArr = this.#path.split("/");
|
37
|
-
for (let i = 0; i < pathArr.length; i++) {
|
38
|
-
const curPath = pathArr[i];
|
39
|
-
if (i === 0) {
|
40
|
-
basePath = join(apiDir, curPath);
|
41
|
-
} else {
|
42
|
-
basePath = join(basePath, curPath);
|
43
|
-
}
|
44
|
-
if (!existsSync(basePath)) {
|
45
|
-
mkdirSync(basePath);
|
46
|
-
}
|
47
|
-
}
|
48
|
-
} else {
|
49
|
-
basePath = join(apiDir, this.#path);
|
50
|
-
if (!existsSync(basePath)) {
|
51
|
-
mkdirSync(basePath);
|
52
|
-
}
|
53
|
-
}
|
54
34
|
this.#name = name;
|
55
|
-
this.#moduleDir =
|
35
|
+
this.#moduleDir = join(apiDir, this.#path);
|
56
36
|
}
|
57
37
|
async #deleteDir(path) {
|
58
38
|
const files = await readdir(path);
|
@@ -74,6 +54,29 @@ class RenderNest {
|
|
74
54
|
this.editAppModule(true);
|
75
55
|
}
|
76
56
|
editAppModule(isDelete = false) {
|
57
|
+
if (!isDelete) {
|
58
|
+
let basePath = "";
|
59
|
+
const apiDir = getApiDir();
|
60
|
+
if (this.#path.includes("/")) {
|
61
|
+
const pathArr = this.#path.split("/");
|
62
|
+
for (let i = 0; i < pathArr.length; i++) {
|
63
|
+
const curPath = pathArr[i];
|
64
|
+
if (i === 0) {
|
65
|
+
basePath = join(apiDir, curPath);
|
66
|
+
} else {
|
67
|
+
basePath = join(basePath, curPath);
|
68
|
+
}
|
69
|
+
if (!existsSync(basePath)) {
|
70
|
+
mkdirSync(basePath);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
} else {
|
74
|
+
basePath = join(apiDir, this.#path);
|
75
|
+
if (!existsSync(basePath)) {
|
76
|
+
mkdirSync(basePath);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
77
80
|
editFileQueue.push(async () => {
|
78
81
|
const moudleName = `${this.#name[0].toUpperCase() + this.#name.slice(1)}Module`;
|
79
82
|
const appModuleFile = join(getApiDir(), "app.module.ts");
|
package/dist/libs/nest-lib.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ApiServiceField, DtoField, EntityField } from '../types';
|
2
|
-
export declare function renderNestCode(config: {
|
2
|
+
export declare function renderNestCode(entity: EntityField[], dto: DtoField[], apiService: ApiServiceField[], config: {
|
3
3
|
name: string;
|
4
4
|
path?: string;
|
5
|
-
}
|
5
|
+
}): void;
|
package/dist/libs/nest-lib.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { RenderNest } from "../code/nest";
|
2
2
|
import { isReverse } from "../config";
|
3
|
-
function renderNestCode(
|
3
|
+
function renderNestCode(entity, dto, apiService, config) {
|
4
4
|
const api = new RenderNest(config.name, config.path);
|
5
5
|
if (isReverse()) {
|
6
6
|
api.remove();
|
package/dist/lua_codegen_bg.wasm
CHANGED
Binary file
|