File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/codemods/src/lib Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1- import path from 'path'
1+ import fs from 'node:fs'
2+ import path from 'node:path'
23
34import { format } from 'prettier'
45
56import { getPaths } from '@cedarjs/project-config'
67
78const getPrettierConfig = async ( ) => {
9+ const basePath = getPaths ( ) . base
10+ const prettierConfigCjsPath = path . join ( basePath , 'prettier.config.cjs' )
11+ const prettierConfigMjsPath = path . join ( basePath , 'prettier.config.mjs' )
12+ const prettierConfigPath = fs . existsSync ( prettierConfigCjsPath )
13+ ? prettierConfigCjsPath
14+ : prettierConfigMjsPath
15+
816 try {
917 const { default : prettierConfig } = await import (
10- `file://${ path . join ( getPaths ( ) . base , 'prettier.config.cjs' ) } `
18+ `file://${ prettierConfigPath } `
1119 )
1220 return prettierConfig
1321 } catch {
You can’t perform that action at this time.
0 commit comments