silgi 0.0.6 → 0.0.8

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.
@@ -828,23 +828,24 @@ class SchemaManager {
828
828
  }
829
829
  }
830
830
  async initialize() {
831
- if (!this.config.output.server) {
832
- throw new Error("No output directory specified");
831
+ if (this.config.output.server) {
832
+ const outputFileTS = resolve(this.config.rootDir, this.config.output.server, "silgi.generated.ts");
833
+ this.config._silgi.outputDirTS = outputFileTS;
834
+ await promises.mkdir(this.config.output.server, { recursive: true });
835
+ }
836
+ if (this.config.output.client) {
837
+ this.config._silgi.outputDirClientTS = resolve(this.config.rootDir, this.config.output.client, "silgi.generated.ts");
838
+ await promises.mkdir(this.config.output.client, { recursive: true });
833
839
  }
834
- const outputFileTS = resolve(this.config.rootDir, this.config.output.server, "silgi.generated.ts");
835
- this.config._silgi.outputDirTS = outputFileTS;
836
- this.config._silgi.outputDirClientTS = resolve(this.config.rootDir, this.config.output.server, "silgi.generated.ts");
837
- await promises.mkdir(this.config.output.server, { recursive: true });
838
840
  }
839
841
  async generateOutput() {
840
842
  if (!this.storage || !this.storage.schemaObjects) {
841
843
  return;
842
844
  }
843
- if (!this.config.output.server) {
844
- throw new Error("No output directory specified");
845
+ if (this.config.output.server) {
846
+ const resolvedPath = resolve(this.config.rootDir, this.config.output.server, "silgi.generated.ts");
847
+ await generateSilgiInterface(this.storage, resolvedPath);
845
848
  }
846
- const resolvedPath = resolve(this.config.rootDir, this.config.output.server, "silgi.generated.ts");
847
- await generateSilgiInterface(this.storage, resolvedPath);
848
849
  if (this.storage?.schemaObjects && this.storage.files) {
849
850
  const schemaCount = Object.keys(this.storage.schemaObjects).length;
850
851
  consola.log(`Found ${schemaCount} schema objects in ${this.storage.files.length} files`);
@@ -854,12 +855,9 @@ class SchemaManager {
854
855
  if (!this.clientSchemas) {
855
856
  return;
856
857
  }
857
- if (!this.config.output.client) {
858
- throw new Error("No output directory specified");
859
- }
860
- const resolvedPath = resolve(this.config.rootDir, this.config.output.client, "silgi.generated.ts");
861
- await generateClientGenTS(this.clientSchemas, resolvedPath);
862
- if (this.storage?.schemaObjects && this.storage.files) {
858
+ if (this.config.output.client && this.storage.schemaObjects && this.storage.files) {
859
+ const resolvedPath = resolve(this.config.rootDir, this.config.output.client, "silgi.generated.ts");
860
+ await generateClientGenTS(this.clientSchemas, resolvedPath);
863
861
  const schemaCount = Object.keys(this.storage.schemaObjects).length;
864
862
  consola.log(`Found ${schemaCount} schema objects in ${this.storage.files.length} files`);
865
863
  consola.success(`Generated client schema files in ${resolvedPath}`);
@@ -3,7 +3,7 @@ import consola from 'consola';
3
3
 
4
4
  const name = "silgi";
5
5
  const type = "module";
6
- const version = "0.0.6";
6
+ const version = "0.0.8";
7
7
  const exports = {
8
8
  ".": {
9
9
  "import": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "exports": {
6
6
  ".": {
7
7
  "import": {
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "devDependencies": {
68
68
  "unbuild": "^3.0.1",
69
- "silgi": "0.0.6"
69
+ "silgi": "0.0.8"
70
70
  },
71
71
  "resolutions": {
72
72
  "silgi": "workspace:*"