Skip to content

Commit

Permalink
fix: readPackageJSON and readPackageJSON can be called without id (
Browse files Browse the repository at this point in the history
  • Loading branch information
kecrily committed Sep 15, 2022
1 parent 53eab02 commit 1b149ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Expand Up @@ -18,7 +18,7 @@ export function defineTSConfig (tsconfig: TSConfig): TSConfig {
return tsconfig
}

export async function readPackageJSON (id: string, opts: ResolveOptions = {}): Promise<PackageJson> {
export async function readPackageJSON (id?: string, opts: ResolveOptions = {}): Promise<PackageJson> {
const resolvedPath = await resolvePackageJSON(id, opts)
const blob = await fsp.readFile(resolvedPath, 'utf-8')
return JSON.parse(blob) as PackageJson
Expand All @@ -28,7 +28,7 @@ export async function writePackageJSON (path: string, pkg: PackageJson): Promise
await fsp.writeFile(path, JSON.stringify(pkg, null, 2))
}

export async function readTSConfig (id: string, opts: ResolveOptions = {}): Promise<TSConfig> {
export async function readTSConfig (id?: string, opts: ResolveOptions = {}): Promise<TSConfig> {
const resolvedPath = await resolveTSConfig(id, opts)
const blob = await fsp.readFile(resolvedPath, 'utf-8')
const jsonc = await import('jsonc-parser')
Expand Down

0 comments on commit 1b149ef

Please sign in to comment.