Skip to content

Commit

Permalink
fix: check for snapshot file presence, fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Dec 9, 2024
1 parent 9b3e5f7 commit 0e3a91e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/snapshot/addResourcesToSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function addResourcesToSnapshot(mq: MoquerieInstance, options: AddR
const resourceStorage = await getResourceInstanceStorage(mq, resourceName)

const ids = resourceIds[resourceName]
const data: Record<string, any> = SuperJSON.parse(await fs.promises.readFile(targetFile, 'utf8'))
const data: Record<string, any> = fs.existsSync(targetFile) ? SuperJSON.parse(await fs.promises.readFile(targetFile, 'utf8')) : {}

for (const id of ids) {
const file = resourceStorage.manifest.files[id]
Expand Down

0 comments on commit 0e3a91e

Please sign in to comment.