From 44d33d41ae016d7eb14fee08669592f85e5b1d52 Mon Sep 17 00:00:00 2001 From: Bauke Date: Sat, 15 Jul 2023 15:57:17 +0200 Subject: [PATCH] Add a $version global. --- source/build.ts | 4 +++- source/types.d.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/build.ts b/source/build.ts index 787f59a..a0686dc 100644 --- a/source/build.ts +++ b/source/build.ts @@ -35,9 +35,10 @@ const sourceDir = toAbsolutePath("../source"); await fsp.mkdir(outDir, {recursive: true}); // Write the WebExtension manifest file. +const manifest = createManifest(browser); await fsp.writeFile( path.join(outDir, "manifest.json"), - JSON.stringify(createManifest(browser)), + JSON.stringify(manifest), ); // Write the web-ext configuration file. @@ -73,6 +74,7 @@ const options: esbuild.BuildOptions = { $browser: JSON.stringify(browser), $dev: JSON.stringify(dev), $test: JSON.stringify(test), + $version: JSON.stringify(manifest.version), }, entryPoints: [ path.join(sourceDir, "background/setup.ts"), diff --git a/source/types.d.ts b/source/types.d.ts index 4f233f1..50f4d28 100644 --- a/source/types.d.ts +++ b/source/types.d.ts @@ -12,4 +12,5 @@ declare global { const $browser: "chromium" | "firefox"; const $dev: boolean; const $test: boolean; + const $version: string; }