Skip to content

Commit c5a0e49

Browse files
committed
fix: added warning to add type module
1 parent 603d2a2 commit c5a0e49

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

no-config-integration/zero-schema.gen.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
* ------------------------------------------------------------
1616
*/
1717

18-
import type { DrizzleToZeroSchema, ZeroCustomType } from "drizzle-zero";
18+
import type { ZeroCustomType } from "drizzle-zero";
1919
import type * as drizzleSchema from "./drizzle/schema";
20+
import type { DrizzleToZeroSchema } from "drizzle-zero";
2021

2122
type ZeroSchema = DrizzleToZeroSchema<typeof drizzleSchema, "snake_case">;
2223

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "drizzle-zero",
3-
"version": "0.11.0",
3+
"version": "0.11.1",
44
"description": "Generate Zero schemas from Drizzle ORM schemas",
55
"type": "module",
66
"scripts": {

src/cli/drizzle-kit.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export const getFullDrizzleSchemaFilePath = async ({
5757
drizzleKitConfigPath: string | undefined;
5858
drizzleSchemaPath: string | undefined;
5959
}) => {
60+
const typeModuleErrorMessage = `. You may need to add \` "type": "module" \` to your package.json.`;
61+
6062
if (drizzleSchemaPath) {
6163
const fullPath = path.resolve(process.cwd(), drizzleSchemaPath);
6264

@@ -120,7 +122,7 @@ export const getFullDrizzleSchemaFilePath = async ({
120122
};
121123
} catch (error) {
122124
console.error(
123-
`❌ drizzle-zero: could not find Drizzle Kit config file at ${drizzleKitConfigPath}`,
125+
`❌ drizzle-zero: could not find Drizzle Kit config file at ${drizzleKitConfigPath}${typeModuleErrorMessage}`,
124126
error,
125127
);
126128
process.exit(1);

src/cli/shared.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ export async function getGeneratedSchema({
166166

167167
zeroSchemaGenerated.formatText();
168168

169-
const organizedFile = zeroSchemaGenerated.organizeImports();
170-
171-
const file = organizedFile.getText();
169+
const file = zeroSchemaGenerated.getText();
172170

173171
return `/* eslint-disable */
174172
/* tslint:disable */

0 commit comments

Comments
 (0)