@zenuml/core 3.41.6 → 3.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenuml/core",
3
- "version": "3.41.6",
3
+ "version": "3.42.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -4,6 +4,7 @@ import { defineConfig } from "vite";
4
4
  import react from "@vitejs/plugin-react";
5
5
  import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6
6
  import svgr from "vite-plugin-svgr";
7
+ import { execSync } from "child_process";
7
8
  import { readFileSync } from "fs";
8
9
 
9
10
  // Read version from package.json
@@ -11,6 +12,13 @@ const packageJson = JSON.parse(
11
12
  readFileSync(resolve(__dirname, "package.json"), "utf-8"),
12
13
  );
13
14
 
15
+ const gitHash = process.env.DOCKER
16
+ ? ""
17
+ : execSync("git rev-parse --short HEAD").toString().trim();
18
+ const gitBranch = process.env.DOCKER
19
+ ? ""
20
+ : execSync("git branch --show-current").toString().trim();
21
+
14
22
  export default defineConfig({
15
23
  build: {
16
24
  // https://vitejs.dev/guide/build.html#library-mode
@@ -50,5 +58,7 @@ export default defineConfig({
50
58
  define: {
51
59
  "process.env.NODE_ENV": '"production"',
52
60
  "process.env.VITE_VERSION": JSON.stringify(packageJson.version),
61
+ "import.meta.env.VITE_APP_GIT_HASH": JSON.stringify(gitHash),
62
+ "import.meta.env.VITE_APP_GIT_BRANCH": JSON.stringify(gitBranch),
53
63
  },
54
64
  });
package/vite.config.ts CHANGED
@@ -5,10 +5,10 @@ import { execSync } from "child_process";
5
5
  import { readFileSync } from "fs";
6
6
  import svgr from "vite-plugin-svgr";
7
7
 
8
- process.env.VITE_APP_GIT_HASH = process.env.DOCKER
8
+ const gitHash = process.env.DOCKER
9
9
  ? ""
10
10
  : execSync("git rev-parse --short HEAD").toString().trim();
11
- process.env.VITE_APP_GIT_BRANCH = process.env.DOCKER
11
+ const gitBranch = process.env.DOCKER
12
12
  ? ""
13
13
  : execSync("git branch --show-current").toString().trim();
14
14
 
@@ -45,6 +45,8 @@ export default defineConfig(({ mode }) => ({
45
45
  "process.env.NODE_ENV": JSON.stringify(mode),
46
46
  "process.env.VITE_BUILD_TIME": JSON.stringify(new Date().toISOString()),
47
47
  "process.env.VITE_VERSION": JSON.stringify(packageJson.version),
48
+ "import.meta.env.VITE_APP_GIT_HASH": JSON.stringify(gitHash),
49
+ "import.meta.env.VITE_APP_GIT_BRANCH": JSON.stringify(gitBranch),
48
50
  },
49
51
  css: {
50
52
  preprocessorOptions: {