From 5f3d8314f9e46f613c5d55646809cfdfff3d6306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Mur=C3=A7a?= Date: Sun, 27 Nov 2022 12:34:39 -0300 Subject: [PATCH] Add app version provider --- package.json | 2 +- src/utils/env.js | 6 ++++++ vite.config.js | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/utils/env.js diff --git a/package.json b/package.json index 350b7c9..fe224fe 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "embroidery-viewer", "private": true, - "version": "0.0.0", + "version": "1.0.0", "type": "module", "scripts": { "dev": "vite", diff --git a/src/utils/env.js b/src/utils/env.js new file mode 100644 index 0000000..9734172 --- /dev/null +++ b/src/utils/env.js @@ -0,0 +1,6 @@ +// @ts-nocheck +function appVersion() { + return APP_VERSION; +} + +export { appVersion }; diff --git a/vite.config.js b/vite.config.js index 5ac8ecf..338cb28 100644 --- a/vite.config.js +++ b/vite.config.js @@ -4,4 +4,7 @@ import { svelte } from "@sveltejs/vite-plugin-svelte"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [svelte()], + define: { + APP_VERSION: JSON.stringify(process.env.npm_package_version), + }, });