mutano 3.0.3 → 3.0.5

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.
Files changed (2) hide show
  1. package/dist/main.js +6 -5
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as path from 'node:path';
2
2
  import camelCase from 'camelcase';
3
- import * as fs from 'fs-extra';
3
+ import { writeFile } from 'node:fs/promises';
4
+ import { ensureDir } from 'fs-extra/esm';
4
5
  import knex from 'knex';
5
6
  import { readFileSync } from 'node:fs';
6
7
  import { createPrismaSchemaBuilder } from '@mrleebo/prisma-ast';
@@ -937,9 +938,9 @@ async function generate(config) {
937
938
  enumDeclarations,
938
939
  defaultZodHeader
939
940
  });
940
- const suffix = destination.suffix || destination.type;
941
+ const suffix = destination.suffix === void 0 ? destination.type : destination.suffix;
941
942
  const folder = destination.folder || ".";
942
- const fileName = `${entityName}.${suffix}.ts`;
943
+ const fileName = `${entityName}${suffix ? `.${suffix}` : ""}.ts`;
943
944
  const filePath = path.join(folder, fileName);
944
945
  results[filePath] = (destination.header || "") + content;
945
946
  }
@@ -1003,8 +1004,8 @@ export interface ${schemaName} {
1003
1004
  }
1004
1005
  for (const [filePath, content] of Object.entries(results)) {
1005
1006
  const fullPath = path.resolve(filePath);
1006
- await fs.ensureDir(path.dirname(fullPath));
1007
- await fs.writeFile(fullPath, content);
1007
+ await ensureDir(path.dirname(fullPath));
1008
+ await writeFile(fullPath, content);
1008
1009
  if (!config.silent) {
1009
1010
  console.log(`Created: ${filePath}`);
1010
1011
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mutano",
3
3
  "type": "module",
4
- "version": "3.0.3",
4
+ "version": "3.0.5",
5
5
  "description": "Converts Prisma/MySQL/PostgreSQL/SQLite schemas to Zod/TS/Kysely interfaces",
6
6
  "author": "Alisson Cavalcante Agiani <thelinuxlich@gmail.com>",
7
7
  "license": "MIT",