diff --git a/packages/wxt/src/core/zip.ts b/packages/wxt/src/core/zip.ts index 092d5c27..ceda07ef 100644 --- a/packages/wxt/src/core/zip.ts +++ b/packages/wxt/src/core/zip.ts @@ -26,11 +26,10 @@ export async function zip(config?: InlineConfig): Promise { wxt.logger.info('Zipping extension...'); const zipFiles: string[] = []; + const packageJson = await getPackageJson(); const projectName = wxt.config.zip.name ?? - safeFilename( - (await getPackageJson())?.name || path.basename(process.cwd()), - ); + safeFilename(packageJson?.name || path.basename(process.cwd())); const applyTemplate = (template: string): string => template .replaceAll('{{name}}', projectName) @@ -39,6 +38,7 @@ export async function zip(config?: InlineConfig): Promise { '{{version}}', output.manifest.version_name ?? output.manifest.version, ) + .replaceAll('{{packageVersion}}', packageJson?.version) .replaceAll('{{mode}}', wxt.config.mode) .replaceAll('{{manifestVersion}}', `mv${wxt.config.manifestVersion}`); diff --git a/packages/wxt/src/types.ts b/packages/wxt/src/types.ts index 7d394aa7..b1ef253b 100644 --- a/packages/wxt/src/types.ts +++ b/packages/wxt/src/types.ts @@ -147,6 +147,7 @@ export interface InlineConfig { * * - `{{name}}` - The project's name converted to kebab-case * - `{{version}}` - The version_name or version from the manifest + * - `{{packageVersion}}` - The version from the package.json * - `{{browser}}` - The target browser from the `--browser` CLI flag * - `{{mode}}` - The current mode * - `{{manifestVersion}}` - Either "2" or "3" @@ -171,6 +172,7 @@ export interface InlineConfig { * * - `{{name}}` - The project's name converted to kebab-case * - `{{version}}` - The version_name or version from the manifest + * - `{{packageVersion}}` - The version from the package.json * - `{{browser}}` - The target browser from the `--browser` CLI flag * - `{{mode}}` - The current mode * - `{{manifestVersion}}` - Either "2" or "3"