Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ export async function updateSourceFiles ({
}
}

const tarExtractWarnings = []
const tarExtractEntries = []
try {
const reader = await CarReader.fromIterable(res.body)
const entries = exporter(cid, {
Expand All @@ -216,8 +218,18 @@ export async function updateSourceFiles ({
// `{ strip: 1 }` tells tar to remove the top-level directory (e.g. `mod-peer-checker-v1.0.0`)
await pipeline(
/** @type {any} */(entry.content()),
/** @type {any} */(tar.x({ strip: 1, C: outDir }))
/** @type {any} */(tar.x({
strip: 1,
C: outDir,
onwarn (code, message, data) {
tarExtractWarnings.push({ code, message, data })
},
onReadEntry (entry) {
tarExtractEntries.push(entry.path)
}
}))
)
await stat(join(outDir, 'main.js'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about the same! Check if the main.js file exists and throw if not (to delete the entire directory tree)

}
} catch (err) {
try {
Expand All @@ -227,6 +239,8 @@ export async function updateSourceFiles ({
throw err
}
}
err.tarExtractWarnings = tarExtractWarnings
err.tarExtractEntries = tarExtractEntries
throw err
}

Expand Down