Skip to content

Commit

Permalink
fix: Use correct fs-extra subpath (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
LekoArts committed Oct 15, 2023
1 parent 82f7ec4 commit a4153eb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-peaches-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"secco": patch
---

Use correct `fs-extra/esm` subpath were needed to mitigate `fs.readJsonSync is not a function`
4 changes: 2 additions & 2 deletions src/utils/__tests__/traverse-pkg-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function mockReadJsonSync(path: string) {
}
}

vi.mock('fs-extra', async () => {
const actual = await vi.importActual('fs-extra') as any
vi.mock('fs-extra/esm', async () => {
const actual = await vi.importActual('fs-extra/esm') as any
return {
...actual,
readJsonSync: vi.fn((path) => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/traverse-pkg-deps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fs from 'fs-extra'
import * as fs from 'fs-extra/esm'
import { difference, intersection } from 'lodash-es'
import { join } from 'pathe'
import type { DepTree, PackageJson, PackageNamesToFilePath, SourcePackages } from '../types'
Expand Down
1 change: 1 addition & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default defineConfig((options) => {
format: 'esm',
minify: !options.watch,
clean: true,
cjsInterop: true,
outExtension() {
return {
js: '.mjs',
Expand Down

0 comments on commit a4153eb

Please sign in to comment.