wxt icon indicating copy to clipboard operation
wxt copied to clipboard

feat!: new template variable `{{versionName}}` and change of the behaviour of `{{version}}`

Open Tensai75 opened this issue 7 months ago • 3 comments

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 #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

Tensai75 avatar Apr 24 '25 20:04 Tensai75

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
Latest commit 3e9ced47b60e65187ffac72d4b3aa945cd533138
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.

netlify[bot] avatar Apr 24 '25 20:04 netlify[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: 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              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Sep 03 '25 13:09 codecov[bot]

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

aklinker1 avatar Sep 03 '25 13:09 aklinker1