Skip to content

feat!: new template variable {{versionName}} and change of the … #1612

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Tensai75
Copy link
Contributor

@Tensai75 Tensai75 commented Apr 24, 2025

… behaviour 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}}

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.

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.

1 participant