Move the version number into Vite config.
This commit is contained in:
parent
163f838ffc
commit
0aa26aa809
|
@ -2,7 +2,6 @@
|
|||
"manifest_version": 3,
|
||||
"name": "Queue",
|
||||
"description": "A WebExtension for queueing links.",
|
||||
"version": "0.2.2",
|
||||
"permissions": [
|
||||
"contextMenus",
|
||||
"storage",
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
"manifest_version": 2,
|
||||
"name": "Queue",
|
||||
"description": "A WebExtension for queueing links.",
|
||||
"version": "0.2.2",
|
||||
"permissions": [
|
||||
"contextMenus",
|
||||
"storage",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import fs from 'node:fs';
|
||||
import fsp from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
import url from 'node:url';
|
||||
|
@ -12,6 +13,8 @@ import webExtension from 'vite-plugin-web-extension';
|
|||
const currentDir = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
const sourceDir = path.join(currentDir, 'source');
|
||||
|
||||
const queueVersion = '0.2.2';
|
||||
|
||||
const targetBrowser = process.env.VITE_BROWSER ?? 'firefox';
|
||||
process.env.VITE_BROWSER = targetBrowser;
|
||||
|
||||
|
@ -52,7 +55,19 @@ export default defineConfig({
|
|||
webExtension({
|
||||
assets: 'assets',
|
||||
browser: targetBrowser,
|
||||
manifest: path.join(sourceDir, `${targetBrowser}-manifest.json`),
|
||||
async manifest() {
|
||||
const manifest = JSON.parse(
|
||||
await fsp.readFile(
|
||||
path.join(sourceDir, `${targetBrowser}-manifest.json`),
|
||||
// eslint-disable-next-line unicorn/prefer-json-parse-buffer
|
||||
'utf-8',
|
||||
),
|
||||
) as Record<string, unknown>;
|
||||
|
||||
manifest.version = queueVersion;
|
||||
|
||||
return manifest;
|
||||
},
|
||||
webExtConfig,
|
||||
}),
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue