1
Fork 0

Add a $version global.

This commit is contained in:
Bauke 2023-07-15 15:57:17 +02:00
parent 2fa59f14d6
commit 44d33d41ae
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 4 additions and 1 deletions

View File

@ -35,9 +35,10 @@ const sourceDir = toAbsolutePath("../source");
await fsp.mkdir(outDir, {recursive: true}); await fsp.mkdir(outDir, {recursive: true});
// Write the WebExtension manifest file. // Write the WebExtension manifest file.
const manifest = createManifest(browser);
await fsp.writeFile( await fsp.writeFile(
path.join(outDir, "manifest.json"), path.join(outDir, "manifest.json"),
JSON.stringify(createManifest(browser)), JSON.stringify(manifest),
); );
// Write the web-ext configuration file. // Write the web-ext configuration file.
@ -73,6 +74,7 @@ const options: esbuild.BuildOptions = {
$browser: JSON.stringify(browser), $browser: JSON.stringify(browser),
$dev: JSON.stringify(dev), $dev: JSON.stringify(dev),
$test: JSON.stringify(test), $test: JSON.stringify(test),
$version: JSON.stringify(manifest.version),
}, },
entryPoints: [ entryPoints: [
path.join(sourceDir, "background/setup.ts"), path.join(sourceDir, "background/setup.ts"),

1
source/types.d.ts vendored
View File

@ -12,4 +12,5 @@ declare global {
const $browser: "chromium" | "firefox"; const $browser: "chromium" | "firefox";
const $dev: boolean; const $dev: boolean;
const $test: boolean; const $test: boolean;
const $version: string;
} }