Skip to content

Conversation

Tensai75
Copy link
Contributor

@Tensai75 Tensai75 commented Apr 24, 2025

BREAKING CHANGE: change the behaviour of the template variable {{version}} for artifactTemplate and sourcesTemplate to use manifest.version and add the new template variable {{versionName}} which uses manifest.version_name or, if not available, manifest.version and takes over the previous behaviour of {{version}}

Overview

This PR is a continuation of PR #1604 and the associated discussion and introduces a breaking change to the behaviour of the template variable {{version}} for artifactTemplate and sourcesTemplate. Currently {{version}} uses the version_name from the manifest or, if not available, the version from the manifest. This is unituitive and it is therefore suggested to change the behaviour to only use the version from the manifest and introduce a new template variable {{versionsName}} to take over the previous behaviour of {{version}}:

  • {{version}} --> always uses manifest.version
  • {{versionsName}} --> uses manifest. version_name or fallback to manifest.version
  • {{packageVersion}} --> always uses the version from package.json (which is identical to manifest.version_name) [introduced with PR feat: add {{packageVersion}} as template variable #1604]

This gives the user more and consistent control over the version number used in the filename of generated zip files.

Manual Testing

  1. set the version in package.json to 1.0.0-beta.1
  2. without a custom artifactTemplate or sourcesTemplate in your wxt.config.ts, run wxt zip and wxt zip -b firefox
  3. the resulting zip files should have the following names (defaulting to {{name}}-{{version}}-{{browser}}.zip and {{name}}-{{version}}-sources.zip:
    extensionname-1.0.0-chrome.zip
    extensionname-1.0.0-firefox.zip
    extensionname-1.0.0-sources.zip
    
  4. add the following custom templates to your wxt.config.ts:
    zip: {
      artifactTemplate: "{{name}}-{{versionName}}-{{browser}}.zip",
      sourcesTemplate: "{{name}}-{{versionName}}-sources.zip",
    },
    
  5. run wxt zip and wxt zip -b firefox and the resulting zip files should have the following names:
    extensionname-1.0.0-beta.1-chrome.zip
    extensionname-1.0.0-firefox.zip
    extensionname-1.0.0-sources.zip
    
  6. change the custom templates in your wxt.config.ts to:
    zip: {
      artifactTemplate: "{{name}}-{{packageVersion}}-{{browser}}.zip",
      sourcesTemplate: "{{name}}-{{packageVersion}}-sources.zip",
    },
    
  7. run wxt zip and wxt zip -b firefox and the resulting zip files should have the following names:
    extensionname-1.0.0-beta.1-chrome.zip
    extensionname-1.0.0-beta.1-firefox.zip
    extensionname-1.0.0-beta.1-sources.zip
    

Related Issue

N/A
This breaking change was discussed in PR #1604

…viour of `{{version}}`

BREAKING CHANGE: change the behaviour of the template variable `{{version}}` for artifactTemplate and sourcesTemplate to use `manifest.version` and add the new template variable `{{versionName}}` which uses `manifest.version_name` or, if not available, `manifest.version` and takes over the previous behaviour of `{{version}}`
Copy link

netlify bot commented Apr 24, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 3e9ced4
🔍 Latest deploy log https://app.netlify.com/sites/creative-fairy-df92c4/deploys/680a9ce5bcaf8d0008ac70c2
😎 Deploy Preview https://deploy-preview-1612--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@aklinker1 aklinker1 changed the title feat!: new template variable {{versionName}} and change of the … feat!: new template variable {{versionName}} and change of the behaviour of {{version}} Sep 3, 2025
@aklinker1 aklinker1 changed the base branch from main to major September 3, 2025 13:45
aklinker1
aklinker1 previously approved these changes Sep 3, 2025
Copy link
Member

@aklinker1 aklinker1 left a comment

Choose a reason for hiding this comment

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

Changed the base to be merged into the next major branch. Not sure when I'll do another major release.

Copy link

codecov bot commented Sep 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.88%. Comparing base (bb63004) to head (87d9f79).

Additional details and impacted files
@@            Coverage Diff             @@
##            major    #1612      +/-   ##
==========================================
- Coverage   80.98%   80.88%   -0.11%     
==========================================
  Files         131      131              
  Lines        6679     6680       +1     
  Branches     1094     1092       -2     
==========================================
- Hits         5409     5403       -6     
- Misses       1259     1266       +7     
  Partials       11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aklinker1
Copy link
Member

aklinker1 commented Sep 3, 2025

Wait, I still want the default behavior to be the same. So we should update the default templates to use {{versionName}}, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants