@biuxiu/codegen 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
package/dist/code/nest.js CHANGED
@@ -40,7 +40,6 @@ class RenderNest {
40
40
  const filePath = join(path, files[i]);
41
41
  if (statSync(filePath).isDirectory()) {
42
42
  await this.#deleteDir(filePath);
43
- await rmdir(filePath);
44
43
  } else {
45
44
  await unlink(filePath);
46
45
  }
package/dist/config.d.ts CHANGED
@@ -3,8 +3,9 @@ declare const CodegenConfig: {
3
3
  apiDir: string;
4
4
  reverse: boolean;
5
5
  };
6
- export type ConfigType = Partial<typeof CodegenConfig>;
6
+ export type ConfigType = Omit<Partial<typeof CodegenConfig>, 'reverse'>;
7
7
  export declare function setConfig(config: ConfigType): void;
8
+ export declare const setReverse: (reverse: boolean) => boolean;
8
9
  export declare const getWebDir: () => string;
9
10
  export declare const getApiDir: () => string;
10
11
  export declare const isReverse: () => boolean;
package/dist/config.js CHANGED
@@ -11,10 +11,8 @@ function setConfig(config) {
11
11
  if (config.apiDir) {
12
12
  CodegenConfig.apiDir = config.apiDir;
13
13
  }
14
- if (config.reverse !== void 0) {
15
- CodegenConfig.reverse = config.reverse;
16
- }
17
14
  }
15
+ const setReverse = (reverse) => CodegenConfig.reverse = reverse;
18
16
  const getWebDir = () => CodegenConfig.webDir;
19
17
  const getApiDir = () => CodegenConfig.apiDir;
20
18
  const isReverse = () => CodegenConfig.reverse;
@@ -22,5 +20,6 @@ export {
22
20
  getApiDir,
23
21
  getWebDir,
24
22
  isReverse,
25
- setConfig
23
+ setConfig,
24
+ setReverse
26
25
  };
package/dist/gen-type.js CHANGED
@@ -33,7 +33,7 @@ const genLuaTypes = async (path) => {
33
33
  writeFormatFile(
34
34
  settingPath,
35
35
  JSON.stringify({
36
- "Lua.workspace.library": types.map((t) => `./${t}-type.lua`)
36
+ "Lua.workspace.library": types.map((t) => `.vscode/${t}-type.lua`)
37
37
  }),
38
38
  true
39
39
  );
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { genLuaTypes } from './gen-type';
2
2
  import { ConfigType } from './config';
3
- declare function startRun(filePath: string, config?: ConfigType): Promise<undefined>;
4
- export { startRun, genLuaTypes };
3
+ declare const startGen: (filePath: string, config?: ConfigType) => Promise<undefined>;
4
+ declare const startRemove: (filePath: string, config?: ConfigType) => Promise<undefined>;
5
+ export { startGen, startRemove, genLuaTypes };
package/dist/index.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { compileToByte } from "./compile";
2
2
  import { existsSync } from "fs";
3
3
  import { genLuaTypes } from "./gen-type";
4
- import { setConfig } from "./config";
5
- async function startRun(filePath, config) {
4
+ import { setConfig, setReverse } from "./config";
5
+ async function startRun(filePath, isReverse, config) {
6
6
  if (config) setConfig(config);
7
+ setReverse(isReverse);
7
8
  if (existsSync(filePath)) {
8
9
  try {
9
10
  const data = await compileToByte(filePath);
10
11
  const { run } = await import("./lua_codegen");
11
- run(new Uint8Array(data), filePath);
12
+ run(new Uint8Array(data), filePath);
12
13
  } catch (error) {
13
14
  return Promise.reject(error);
14
15
  }
@@ -16,7 +17,14 @@ run(new Uint8Array(data), filePath);
16
17
  return Promise.reject(`${filePath}\u6587\u4EF6\u5B58\u5728`);
17
18
  }
18
19
  }
20
+ const startGen = (filePath, config) => {
21
+ return startRun(filePath, true, config);
22
+ };
23
+ const startRemove = (filePath, config) => {
24
+ return startRun(filePath, false, config);
25
+ };
19
26
  export {
20
27
  genLuaTypes,
21
- startRun
28
+ startGen,
29
+ startRemove
22
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biuxiu/codegen",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "代码生成工具",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {