diff --git a/docs/guide/resources/upgrading.md b/docs/guide/resources/upgrading.md index 356def92..99974548 100644 --- a/docs/guide/resources/upgrading.md +++ b/docs/guide/resources/upgrading.md @@ -64,6 +64,14 @@ In v0.20, how automatic startup is enabled/disabled has changed: rm ~/web-ext.config.ts ``` +### `{{version}}` Template Variable Changes + +The `{{version}}` template var in `artifactTemplate` and `sourcesTemplate` used to equal `manifest.version_name ?? manifest.version`. It now equals `{{manifest.version}}`. + +If you have a custom template for one of these options, replace `{{version}}` with `{{versionName}}` to maintain the same behavior. + +If you don't customize `artifactTemplate` or `sourcesTemplate`, this does not effect you. + ## Shadow root UIs no longer include a full HTML document `@webext-core/isolated-element` was upgraded to v2. This release changes the internal structure of the shadow DOM, simplifying it from a full `` document to just a `div`: diff --git a/packages/wxt/src/core/zip.ts b/packages/wxt/src/core/zip.ts index 01b023c1..ff89493b 100644 --- a/packages/wxt/src/core/zip.ts +++ b/packages/wxt/src/core/zip.ts @@ -40,8 +40,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 4ccf6f50..3ad0a3a3 100644 --- a/packages/wxt/src/types.ts +++ b/packages/wxt/src/types.ts @@ -192,8 +192,10 @@ export interface InlineConfig { * * - `{{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 @@ -223,8 +225,10 @@ export interface InlineConfig { * * - `{{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