This is an automated email from the ASF dual-hosted git repository.

Yicong-Huang pushed a commit to branch release/v1.2
in repository https://gitbox.apache.org/repos/asf/texera.git


The following commit(s) were added to refs/heads/release/v1.2 by this push:
     new 542f39fb87 fix: replace git hash with build number in UI footer (#5153)
542f39fb87 is described below

commit 542f39fb871f9bb2c97e914af2b30eddcd8f1cf2
Author: Matthew B. <[email protected]>
AuthorDate: Sat Jun 6 21:17:49 2026 +0000

    fix: replace git hash with build number in UI footer (#5153)
    
    ### What changes were proposed in this PR?
    - Replaced `frontend/git-version.js` with `frontend/build-version.js`,
    which uses `build-number-generator` to stamp a version + timestamp build
    number instead of shelling out to `git describe`.
    - Swapped the `git-describe` devDependency for `build-number-generator`,
    and pointed the `postinstall` script at the new file.
    - Simplified `src/environments/version.ts` schema to `{ buildNumber,
    version }`, since the old `git-describe` output fields had a single
    consumer.
    - Renamed `DashboardComponent.gitCommitHash` to `buildNumber`, updated
    the footer label to `Build:`, and renamed the `#git-commit-id` CSS id to
    `#build-number`.
    
    #### Old Design
    <img width="865" height="312" alt="image"
    
src="https://github.com/user-attachments/assets/88bbc91a-e682-4b5e-889a-0b233034db6e";
    />
    
      #### New Design
    
    <img width="1070" height="425" alt="Screenshot From 2026-05-30 23-40-28"
    
src="https://github.com/user-attachments/assets/8b0cfc0d-c827-4707-935c-7c75ad3f6664";
    />
    
      ### Any related issues, documentation, or discussions?
      closes: #3613
      ### How was this PR tested?
    - Ran `node build-version.js` directly and confirmed it wrote a valid
    `version.ts` with the new `buildNumber` field.
      ### Was this PR authored or co-authored using generative AI tooling?
      Co-authored with Claude Opus 4.7 in compliance with ASF
    
    ---------
    
    (backported from commit e9f2b8ed35679d2fa0338f7bbf74865b9a1f4246)
    
    Signed-off-by: Matthew B. <[email protected]>
---
 frontend/.gitignore                                |  4 ++-
 frontend/angular.json                              |  4 +++
 frontend/{git-version.js => build-version.js}      | 39 ++++++++++------------
 frontend/package.json                              |  9 +++--
 .../dashboard/component/dashboard.component.html   |  2 +-
 .../dashboard/component/dashboard.component.scss   |  2 +-
 .../app/dashboard/component/dashboard.component.ts |  2 +-
 .../execute-workflow/execute-workflow.service.ts   |  2 +-
 frontend/src/environments/version.ts               | 27 +++++++++++++++
 frontend/tsconfig.json                             |  1 +
 frontend/yarn.lock                                 | 27 ++++++---------
 11 files changed, 71 insertions(+), 48 deletions(-)

diff --git a/frontend/.gitignore b/frontend/.gitignore
index 72bce9bf8d..d5db9ad993 100644
--- a/frontend/.gitignore
+++ b/frontend/.gitignore
@@ -7,7 +7,6 @@
 /dist-server
 /tmp
 /out-tsc
-src/environments/version.ts
 
 # test coverage
 /coverage
@@ -31,3 +30,6 @@ src/environments/version.ts
 
 # nx migration
 /migrations.json
+
+# Generated by build-version.js on prod builds.
+/src/environments/version.prod.ts
diff --git a/frontend/angular.json b/frontend/angular.json
index 47f16d1656..bc0fbca234 100644
--- a/frontend/angular.json
+++ b/frontend/angular.json
@@ -62,6 +62,10 @@
                 {
                   "replace": "src/environments/environment.ts",
                   "with": "src/environments/environment.prod.ts"
+                },
+                {
+                  "replace": "src/environments/version.ts",
+                  "with": "src/environments/version.prod.ts"
                 }
               ]
             },
diff --git a/frontend/git-version.js b/frontend/build-version.js
similarity index 53%
rename from frontend/git-version.js
rename to frontend/build-version.js
index 54cfdf8d3f..089c0dcb45 100644
--- a/frontend/git-version.js
+++ b/frontend/build-version.js
@@ -17,30 +17,25 @@
  * under the License.
  */
 
-const { gitDescribeSync } = require("git-describe");
-const { version } = require("./package.json");
-const { resolve, relative } = require("path");
-const { writeFileSync, existsSync, mkdirSync } = require("fs-extra");
-
-const gitInfo = gitDescribeSync({
-  dirtyMark: false,
-  dirtySemver: false,
-});
+// Runs as the first step of `yarn build` / `yarn build:ci`. Writes
+// version.prod.ts with a timestamped build number; Angular's production
+// fileReplacements (angular.json) swaps version.ts for version.prod.ts.
+// Dev builds (`yarn start`) keep the static "dev" string in version.ts.
 
-gitInfo.version = version;
+const { generate } = require("build-number-generator");
+const { version } = require("./package.json");
+const { resolve } = require("path");
+const { writeFileSync } = require("fs");
 
-if (!existsSync(__dirname + "/src/environments")) {
-  mkdirSync(__dirname + "/src/environments");
-}
-const file = resolve(__dirname, "src", "environments", "version.ts");
+const buildNumber = generate(version);
+const out = resolve(__dirname, "src", "environments", "version.prod.ts");
 writeFileSync(
-  file,
-  `// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
-/* tslint:disable */
-export const Version = ${JSON.stringify(gitInfo, null, 4)};
-/* tslint:enable */
+  out,
+  `// AUTO-GENERATED by build-version.js — do not edit or commit.
+export const Version = {
+  buildNumber: ${JSON.stringify(buildNumber)},
+  version: ${JSON.stringify(version)},
+};
 `,
-  { encoding: "utf-8" }
 );
-
-console.log(`Wrote version info ${gitInfo.raw} to 
${relative(resolve(__dirname, ".."), file)}`);
+console.log(`build-version: ${buildNumber}`);
diff --git a/frontend/package.json b/frontend/package.json
index 70deb95e26..a0f47ce382 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -7,8 +7,8 @@
   "license": "Apache-2.0",
   "scripts": {
     "start": "concurrently --kill-others \"npx y-websocket\" \"ng serve\"",
-    "build": "node --max-old-space-size=8192 
./node_modules/@angular/cli/bin/ng build --configuration=production 
--progress=false --source-map=false",
-    "build:ci": "node --max-old-space-size=8192 
./node_modules/nx/dist/bin/nx.js build --configuration=production 
--progress=false --source-map=false",
+    "build": "node build-version.js && node --max-old-space-size=8192 
./node_modules/@angular/cli/bin/ng build --configuration=production 
--progress=false --source-map=false",
+    "build:ci": "node build-version.js && node --max-old-space-size=8192 
./node_modules/nx/dist/bin/nx.js build --configuration=production 
--progress=false --source-map=false",
     "analyze": "ng build --configuration=production --stats-json && 
webpack-bundle-analyzer dist/stats.json",
     "test": "ng test --watch=false",
     "test:ci": "node --max-old-space-size=8192 
./node_modules/nx/dist/bin/nx.js test --watch=false --progress=false --coverage 
--coverage-reporters=lcovonly",
@@ -16,8 +16,7 @@
     "lint": "eslint ./src",
     "eslint:fix": "yarn eslint --fix ./src",
     "format:fix": "yarn prettier-eslint --write 
\"src/**/*.{ts,js,html,scss,less,json}\"",
-    "format:ci": "yarn prettier-eslint --list-different 
\"src/**/*.{ts,js,html,scss,less,json}\" && yarn eslint ./src",
-    "postinstall": "node git-version.js"
+    "format:ci": "yarn prettier-eslint --list-different 
\"src/**/*.{ts,js,html,scss,less,json}\" && yarn eslint ./src"
   },
   "private": true,
   "dependencies": {
@@ -123,12 +122,12 @@
     "@vitest/browser-playwright": "4.1.6",
     "@vitest/coverage-v8": "4.1.6",
     "buffer": "5.7.1",
+    "build-number-generator": "3.1.0",
     "concurrently": "7.4.0",
     "eslint": "8.57.0",
     "eslint-plugin-rxjs": "5.0.3",
     "eslint-plugin-rxjs-angular": "2.0.1",
     "fs-extra": "10.0.1",
-    "git-describe": "4.1.0",
     "jsdom": "25.0.1",
     "nodecat": "2.0.0",
     "nx": "22.7.0",
diff --git a/frontend/src/app/dashboard/component/dashboard.component.html 
b/frontend/src/app/dashboard/component/dashboard.component.html
index ba3f74fa3a..9014ea37e5 100644
--- a/frontend/src/app/dashboard/component/dashboard.component.html
+++ b/frontend/src/app/dashboard/component/dashboard.component.html
@@ -201,7 +201,7 @@
         <span>About</span>
       </li>
     </ul>
-    <span id="git-commit-id">Git hash: {{ gitCommitHash }}</span>
+    <span id="build-number">Build: {{ buildNumber }}</span>
     <span
       *ngIf="!isCollapsed && config.env.attributionEnabled"
       id="powered-by">
diff --git a/frontend/src/app/dashboard/component/dashboard.component.scss 
b/frontend/src/app/dashboard/component/dashboard.component.scss
index edbe88658f..3e404ecf6f 100644
--- a/frontend/src/app/dashboard/component/dashboard.component.scss
+++ b/frontend/src/app/dashboard/component/dashboard.component.scss
@@ -100,7 +100,7 @@ nz-content {
   padding: 5px 0;
 }
 
-#git-commit-id {
+#build-number {
   position: absolute;
   left: 5px;
   bottom: 5px;
diff --git a/frontend/src/app/dashboard/component/dashboard.component.ts 
b/frontend/src/app/dashboard/component/dashboard.component.ts
index aadf07d54b..8dc5d601dd 100644
--- a/frontend/src/app/dashboard/component/dashboard.component.ts
+++ b/frontend/src/app/dashboard/component/dashboard.component.ts
@@ -83,7 +83,7 @@ export class DashboardComponent implements OnInit {
 
   isAdmin: boolean = this.userService.isAdmin();
   isLogin = this.userService.isLogin();
-  public gitCommitHash: string = Version.raw;
+  public buildNumber: string = Version.buildNumber;
   displayForum: boolean = true;
   displayNavbar: boolean = true;
   isCollapsed: boolean = false;
diff --git 
a/frontend/src/app/workspace/service/execute-workflow/execute-workflow.service.ts
 
b/frontend/src/app/workspace/service/execute-workflow/execute-workflow.service.ts
index d3d7d23d17..eb86194e7c 100644
--- 
a/frontend/src/app/workspace/service/execute-workflow/execute-workflow.service.ts
+++ 
b/frontend/src/app/workspace/service/execute-workflow/execute-workflow.service.ts
@@ -248,7 +248,7 @@ export class ExecuteWorkflowService {
 
     const workflowExecuteRequest = {
       executionName: executionName,
-      engineVersion: version.hash,
+      engineVersion: version.buildNumber,
       logicalPlan: logicalPlan,
       replayFromExecution: replayExecutionInfo,
       workflowSettings: workflowSettings,
diff --git a/frontend/src/environments/version.ts 
b/frontend/src/environments/version.ts
new file mode 100644
index 0000000000..34748af22b
--- /dev/null
+++ b/frontend/src/environments/version.ts
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { version } from "../../package.json";
+
+// Dev placeholder. Production builds replace this file with the generated
+// version.prod.ts (see angular.json fileReplacements + 
frontend/build-version.js).
+export const Version = {
+  buildNumber: "dev",
+  version,
+};
diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json
index 57bd0161cc..5407b53efc 100644
--- a/frontend/tsconfig.json
+++ b/frontend/tsconfig.json
@@ -2,6 +2,7 @@
   "compileOnSave": false,
   "compilerOptions": {
     "allowSyntheticDefaultImports": true,
+    "resolveJsonModule": true,
     "paths": {
       "path": [
         "./node_modules/path-browserify"
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index 2beefe4b1c..0bef4a41a2 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -6397,7 +6397,7 @@ __metadata:
   languageName: node
   linkType: hard
 
-"@types/semver@npm:^7.3.12, @types/semver@npm:^7.3.8":
+"@types/semver@npm:^7.3.12":
   version: 7.7.1
   resolution: "@types/semver@npm:7.7.1"
   checksum: 
10c0/c938aef3bf79a73f0f3f6037c16e2e759ff40c54122ddf0b2583703393d8d3127130823facb880e694caa324eb6845628186aac1997ee8b31dc2d18fafe26268
@@ -8135,6 +8135,15 @@ __metadata:
   languageName: node
   linkType: hard
 
+"build-number-generator@npm:3.1.0":
+  version: 3.1.0
+  resolution: "build-number-generator@npm:3.1.0"
+  bin:
+    buildnumgen: bin/buildnumgen.js
+  checksum: 
10c0/10d2366b74493a12aa7390e08dc5cd27f77ba600234c757e59ae9436eb7b7dde837322d34f0e177de5e5da3f4e5cabb089a03f9fcb32195ceaecd3ebab0b3c5b
+  languageName: node
+  linkType: hard
+
 "bundle-name@npm:^4.1.0":
   version: 4.1.0
   resolution: "bundle-name@npm:4.1.0"
@@ -10869,20 +10878,6 @@ __metadata:
   languageName: node
   linkType: hard
 
-"git-describe@npm:4.1.0":
-  version: 4.1.0
-  resolution: "git-describe@npm:4.1.0"
-  dependencies:
-    "@types/semver": "npm:^7.3.8"
-    lodash: "npm:^4.17.21"
-    semver: "npm:^5.6.0"
-  dependenciesMeta:
-    semver:
-      optional: true
-  checksum: 
10c0/2e5cbb0f5aa4a6f4dc9135276a85a29ec627a88dd0d73b63d1a3cd2ec2477a8d1d5fc83ae480a00c587c0ea8a193c6a9696a5b549dc6af02db0be74cdfac0eb5
-  languageName: node
-  linkType: hard
-
 "glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2":
   version: 5.1.2
   resolution: "glob-parent@npm:5.1.2"
@@ -11095,6 +11090,7 @@ __metadata:
     ai: "npm:5.0.93"
     ajv: "npm:8.10.0"
     buffer: "npm:5.7.1"
+    build-number-generator: "npm:3.1.0"
     concaveman: "npm:2.0.0"
     concurrently: "npm:7.4.0"
     d3-shape: "npm:2.1.0"
@@ -11105,7 +11101,6 @@ __metadata:
     file-saver: "npm:2.0.5"
     fs-extra: "npm:10.0.1"
     fuse.js: "npm:6.5.3"
-    git-describe: "npm:4.1.0"
     html2canvas: "npm:1.4.1"
     jointjs: "npm:3.5.4"
     jsdom: "npm:25.0.1"

Reply via email to