Skip to content

Commit

Permalink
fix: AwaitEventEmitter is not a constructor
Browse files Browse the repository at this point in the history
close: #200
  • Loading branch information
unlight committed Dec 17, 2023
1 parent 36b6da7 commit 3ec7db8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Taskfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build() {
# https://esbuild.github.io/api/#target
cp -fv src/bin.js dist
cp -fv README.md LICENSE dist
npx pkgroll --target=es2020
npx pkgroll --target=es2020 --export-condition=node
cat package.json | jq '.main = "./index.cjs"' |
jq '.types = "./index.d.ts"' |
jq '.exports.".".require = "./index.cjs"' |
Expand Down
9 changes: 6 additions & 3 deletions src/generate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { GeneratorOptions } from '@prisma/generator-helper';
import { ok } from 'assert';
import AwaitEventEmitter from 'await-event-emitter';
import { mapKeys } from 'lodash';
import { Project, QuoteKind } from 'ts-morph';

Expand Down Expand Up @@ -30,12 +29,13 @@ import {
ObjectSettings,
OutputType,
} from './types';
const AwaitEventEmitter = require('await-event-emitter').default;

Check warning on line 32 in src/generate.ts

View workflow job for this annotation

GitHub Actions / Test on Node 20 and ubuntu-latest

Unsafe assignment of an `any` value

Check warning on line 32 in src/generate.ts

View workflow job for this annotation

GitHub Actions / Test on Node 20 and ubuntu-latest

Require statement not part of import statement

Check warning on line 32 in src/generate.ts

View workflow job for this annotation

GitHub Actions / Test on Node 20 and ubuntu-latest

Do not use "require"

Check warning on line 32 in src/generate.ts

View workflow job for this annotation

GitHub Actions / Test on Node 20 and ubuntu-latest

Maximum number of dependencies (15) exceeded

Check warning on line 32 in src/generate.ts

View workflow job for this annotation

GitHub Actions / Test on Node 20 and ubuntu-latest

Unsafe member access .default on an `any` value

export async function generate(
args: GeneratorOptions & {
skipAddOutputSourceFiles?: boolean;
connectCallback?: (
emitter: AwaitEventEmitter,
emitter: typeof import('await-event-emitter'),
eventArguments: EventArguments,
) => void | Promise<void>;
},
Expand All @@ -53,7 +53,10 @@ export async function generate(
if (config.emitBlocks.prismaEnums || config.emitBlocks.schemaEnums) {
eventEmitter.on('EnumType', registerEnum);
}
if (config.emitBlocks.outputs || config.emitBlocks.models && !config.omitModelsCount) {
if (
config.emitBlocks.outputs ||
(config.emitBlocks.models && !config.omitModelsCount)
) {
eventEmitter.on('OutputType', outputType);
}
config.emitBlocks.models && eventEmitter.on('ModelOutputType', modelOutputType);
Expand Down

0 comments on commit 3ec7db8

Please sign in to comment.