Skip to content

Commit f1b9edf

Browse files
committed
Add configurable module extension for exports in index.ts
1 parent 466b8f2 commit f1b9edf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function generateIndexContent(tsFiles: string[], config: TypeSqlConfig) {
176176
const writer = new CodeBlockWriter();
177177
for (const filePath of tsFiles) {
178178
const fileName = path.basename(filePath, '.ts'); //remove the ts extension
179-
const suffix = config.esm ? '.js' : '';
179+
const suffix = config.moduleExtension ? `.${config.moduleExtension}` : '.js';
180180
writer.writeLine(`export * from "./${fileName}${suffix}";`);
181181
}
182182
return writer.toString();

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export type TypeSqlConfig = {
164164
attach?: string[];
165165
loadExtensions?: string[];
166166
includeCrudTables: string[];
167-
esm?: boolean;
167+
moduleExtension?: 'js' | 'ts';
168168
};
169169

170170
export type SqlGenOption = 'select' | 's' | 'insert' | 'i' | 'update' | 'u' | 'delete' | 'd';

0 commit comments

Comments
 (0)