Skip to content

Commit

Permalink
fix(cli): Fix another ES module issue (#3395)
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl authored Jan 22, 2024
1 parent 067e4d9 commit 8e39884
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ import chalk from 'chalk'
import { Command } from 'commander'
import { dirname } from 'path'
import { runGenerator, getContext, FeathersBaseContext, version } from '@feathersjs/generators'
import { createRequire } from 'node:module'

export * from 'commander'
export { chalk }

const require = createRequire(import.meta.url)

export const commandRunner = (name: string) => async (options: any) => {
const folder = dirname(require.resolve('@feathersjs/generators'))
const ctx = getContext<FeathersBaseContext>({
...options
})

await Promise.resolve(ctx)
.then(runGenerator(folder, name, 'index'))
.then(runGenerator(folder, name, 'index.js'))
.catch((error) => {
const { logger } = ctx.pinion

Expand Down

0 comments on commit 8e39884

Please sign in to comment.