Skip to content

Adds mode to the zip filenames #1605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/wxt/e2e/tests/zip.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('Zipping', () => {
mode: 'development',
zip: {
artifactTemplate: '{{name}}-{{version}}-{{browser}}-{{mode}}.zip',
sourcesTemplate: '{{name}}-{{version}}-{{mode}}-sources.zip',
sourcesTemplate: '{{name}}-{{version}}-{{browser}}-{{mode}}-sources.zip',
},
});

Expand Down
4 changes: 2 additions & 2 deletions packages/wxt/src/core/resolve-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ function resolveZipConfig(
const downloadedPackagesDir = path.resolve(root, '.wxt/local_modules');
return {
name: undefined,
sourcesTemplate: '{{name}}-{{version}}-sources.zip',
artifactTemplate: '{{name}}-{{version}}-{{browser}}.zip',
sourcesTemplate: '{{name}}-{{version}}-{{browser}}-{{mode}}-sources.zip',
artifactTemplate: '{{name}}-{{version}}-{{browser}}-{{mode}}.zip',
Copy link
Contributor

@Tensai75 Tensai75 Apr 25, 2025

Choose a reason for hiding this comment

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

I have to admit I misunderstood the PR at first and thought it was the {{manifestVersion}} that should be added to the filenames, but it's the production mode.
Ok, then I agree with this PR in principle, because I too like consistency. But the outDirTemplate uses {{modeSuffix}} (‘-dev’ for development, ‘’ for production):

const outDirTemplate = (
mergedConfig.outDirTemplate ??
`${browser}-mv${manifestVersion}${modeSuffix}`
)

So we should use {{modeSuffix}} in artifactTemplate and sourcesTemplate as well and not add {{browser}} to sourcesTemplate (the source zip is exactly the same for all browsers and should be generated only once anyway):

sourcesTemplate: '{{name}}-{{version}}-sources{{modeSuffix}}.zip',
artifactTemplate: '{{name}}-{{version}}-{{browser}}{{modeSuffix}}.zip',

This would for development result in:

extensionname-1.0.0-chrome-dev.zip
extensionname-1.0.0-firefox-dev.zip
extensionname-1.0.0-sources-dev.zip

and for production in:

extensionname-1.0.0-chrome.zip
extensionname-1.0.0-firefox.zip
extensionname-1.0.0-sources.zip

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm already handling this all in my config, so I'll just close this PR. Looks like you have another PR related to these templates, so I'll let you handle whatever you think will work best in the current state of things.

sourcesRoot: root,
includeSources: [],
compressionLevel: 9,
Expand Down