feat(Firefox): List files in sources zip (#2513)
This commit is contained in:
@@ -79,7 +79,7 @@ export async function zip(config?: InlineConfig): Promise<string[]> {
|
||||
wxt.config.outBaseDir,
|
||||
sourcesZipFilename,
|
||||
);
|
||||
await zipDir(wxt.config.zip.sourcesRoot, sourcesZipPath, {
|
||||
const files = await zipDir(wxt.config.zip.sourcesRoot, sourcesZipPath, {
|
||||
include: wxt.config.zip.includeSources,
|
||||
exclude: excludeSources,
|
||||
transform(absolutePath, zipPath, content) {
|
||||
@@ -92,6 +92,13 @@ export async function zip(config?: InlineConfig): Promise<string[]> {
|
||||
});
|
||||
zipFiles.push(sourcesZipPath);
|
||||
await wxt.hooks.callHook('zip:sources:done', wxt, sourcesZipPath);
|
||||
|
||||
await printFileList(
|
||||
wxt.logger.info,
|
||||
`Sources included in \`${sourcesZipFilename}\``,
|
||||
wxt.config.zip.sourcesRoot,
|
||||
files,
|
||||
);
|
||||
}
|
||||
|
||||
await printFileList(
|
||||
@@ -121,7 +128,7 @@ async function zipDir(
|
||||
additionalFiles?: string[];
|
||||
dot?: boolean;
|
||||
},
|
||||
): Promise<void> {
|
||||
): Promise<string[]> {
|
||||
const archive = new JSZip();
|
||||
// includeSources patterns are used directly (defaults to ['**/*'] from config)
|
||||
// excludeSources patterns are passed to glob's ignore option for efficient filtering
|
||||
@@ -136,7 +143,7 @@ async function zipDir(
|
||||
...(options?.additionalFiles ?? []).map((file) =>
|
||||
path.relative(directory, file),
|
||||
),
|
||||
];
|
||||
].sort();
|
||||
for (const file of filesToZip) {
|
||||
const absolutePath = path.resolve(directory, file);
|
||||
if (file.endsWith('.json')) {
|
||||
@@ -167,6 +174,8 @@ async function zipDir(
|
||||
.on('error', reject)
|
||||
.on('close', resolve),
|
||||
);
|
||||
|
||||
return filesToZip;
|
||||
}
|
||||
|
||||
async function downloadPrivatePackages() {
|
||||
|
||||
Reference in New Issue
Block a user