Move the version number into Vite config.
This commit is contained in:
parent
163f838ffc
commit
0aa26aa809
|
@ -2,7 +2,6 @@
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Queue",
|
"name": "Queue",
|
||||||
"description": "A WebExtension for queueing links.",
|
"description": "A WebExtension for queueing links.",
|
||||||
"version": "0.2.2",
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"contextMenus",
|
"contextMenus",
|
||||||
"storage",
|
"storage",
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Queue",
|
"name": "Queue",
|
||||||
"description": "A WebExtension for queueing links.",
|
"description": "A WebExtension for queueing links.",
|
||||||
"version": "0.2.2",
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"contextMenus",
|
"contextMenus",
|
||||||
"storage",
|
"storage",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
|
import fsp from 'node:fs/promises';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
import url from 'node:url';
|
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 currentDir = path.dirname(url.fileURLToPath(import.meta.url));
|
||||||
const sourceDir = path.join(currentDir, 'source');
|
const sourceDir = path.join(currentDir, 'source');
|
||||||
|
|
||||||
|
const queueVersion = '0.2.2';
|
||||||
|
|
||||||
const targetBrowser = process.env.VITE_BROWSER ?? 'firefox';
|
const targetBrowser = process.env.VITE_BROWSER ?? 'firefox';
|
||||||
process.env.VITE_BROWSER = targetBrowser;
|
process.env.VITE_BROWSER = targetBrowser;
|
||||||
|
|
||||||
|
@ -52,7 +55,19 @@ export default defineConfig({
|
||||||
webExtension({
|
webExtension({
|
||||||
assets: 'assets',
|
assets: 'assets',
|
||||||
browser: targetBrowser,
|
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,
|
webExtConfig,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue