From 3e9ced47b60e65187ffac72d4b3aa945cd533138 Mon Sep 17 00:00:00 2001 From: Tensai Date: Thu, 24 Apr 2025 21:28:33 +0200 Subject: [PATCH] feat!: new template variable `{{versionName}}` and change of the 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}}` --- packages/wxt/src/core/zip.ts | 3 ++- packages/wxt/src/types.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/wxt/src/core/zip.ts b/packages/wxt/src/core/zip.ts index ceda07efd..66330d8c4 100644 --- a/packages/wxt/src/core/zip.ts +++ b/packages/wxt/src/core/zip.ts @@ -34,8 +34,9 @@ export async function zip(config?: InlineConfig): Promise { template .replaceAll('{{name}}', projectName) .replaceAll('{{browser}}', wxt.config.browser) + .replaceAll('{{version}}', output.manifest.version) .replaceAll( - '{{version}}', + '{{versionName}}', output.manifest.version_name ?? output.manifest.version, ) .replaceAll('{{packageVersion}}', packageJson?.version) diff --git a/packages/wxt/src/types.ts b/packages/wxt/src/types.ts index b1ef253bd..6ab4aa97b 100644 --- a/packages/wxt/src/types.ts +++ b/packages/wxt/src/types.ts @@ -146,7 +146,8 @@ export interface InlineConfig { * Available template variables: * * - `{{name}}` - The project's name converted to kebab-case - * - `{{version}}` - The version_name or version from the manifest + * - `{{version}}` - The version from the manifest + * - `{{versionName}}` - The version_name from the manifest or, if not set (i.e. if built for Firefox), the version from the manifest * - `{{packageVersion}}` - The version from the package.json * - `{{browser}}` - The target browser from the `--browser` CLI flag * - `{{mode}}` - The current mode @@ -171,7 +172,8 @@ export interface InlineConfig { * Available template variables: * * - `{{name}}` - The project's name converted to kebab-case - * - `{{version}}` - The version_name or version from the manifest + * - `{{version}}` - The version from the manifest + * - `{{versionName}}` - The version_name from the manifest or, if not set (i.e. if built for Firefox), the version from the manifest * - `{{packageVersion}}` - The version from the package.json * - `{{browser}}` - The target browser from the `--browser` CLI flag * - `{{mode}}` - The current mode