ondc-code-generator 0.1.0 → 0.1.2

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.
@@ -7,6 +7,10 @@ import { ConfigValidator } from "./validators/config-validator.js";
7
7
  import { writeAndFormatCode } from "../utils/fs-utils.js";
8
8
  import { readFileSync } from "fs";
9
9
  import Mustache from "mustache";
10
+ import { fileURLToPath } from "url";
11
+ import path from "path";
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
10
14
  const defaultConfig = {
11
15
  removeRequiredfromSchema: true,
12
16
  removeEnumsfromSchema: true,
@@ -65,10 +69,10 @@ export class ConfigCompiler {
65
69
  action: schema,
66
70
  };
67
71
  });
68
- const template = readFileSync("/Users/rudranshsinghal/ondc/automation-utility/official-code/code-generator/src/generator/generators/typescript/templates/schema-template.mustache", "utf-8");
72
+ const template = readFileSync(path.resolve(__dirname, "../generator/generators/typescript/templates/schema-template.mustache"), "utf-8");
69
73
  console.log(actions);
70
74
  const l0 = Mustache.render(template, { actions });
71
- writeAndFormatCode(`./generated/L0-schemas`, `index.ts`, l0, "typescript");
75
+ await writeAndFormatCode(`./generated/L0-schemas`, `index.ts`, l0, "typescript");
72
76
  };
73
77
  this.language = language;
74
78
  this.SchemaExtactionService = new SchemaExtactionService();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ondc-code-generator",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "generate code from build.yaml ",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",