Skip to content

Commit

Permalink
fix: replace 'importModule' by 'PackageManager'
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhulle committed Oct 22, 2023
1 parent 11a275c commit f66065a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/cli/src/utils/getPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck

import { importModule } from '@kubb/core'
import { PackageManager } from '@kubb/core'

import type { KubbJSONPlugins, KubbObjectPlugin, KubbUserConfig } from '@kubb/core'

Expand All @@ -17,7 +17,9 @@ function isObjectPlugins(plugins: KubbUserConfig['plugins'] | KubbJSONPlugins[])
}

async function importPlugin(name: string, options: object): Promise<KubbUserConfig['plugins']> {
const importedPlugin: any = process.env.NODE_ENV === 'test' ? await import(name) : await importModule(name, process.cwd())
const packageManager = new PackageManager(process.cwd())

const importedPlugin: any = process.env.NODE_ENV === 'test' ? await import(name) : await packageManager.import(name, process.cwd())

// eslint-disable-next-line
return importedPlugin?.default ? importedPlugin.default(options) : importedPlugin(options)
Expand Down

1 comment on commit f66065a

@vercel
Copy link

@vercel vercel bot commented on f66065a Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kubb – ./

kubb-kubb.vercel.app
www.kubb.dev
kubb.dev
kubb-git-main-kubb.vercel.app

Please sign in to comment.