Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/dist-server
/tmp
/out-tsc
src/environments/version.ts

# test coverage
/coverage
Expand All @@ -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
4 changes: 4 additions & 0 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
},
Expand Down
39 changes: 17 additions & 22 deletions frontend/git-version.js → frontend/build-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
9 changes: 4 additions & 5 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
"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",
"prettier:fix": "prettier --write ./src",
"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": {
Expand Down Expand Up @@ -122,12 +121,12 @@
"@vitest/browser": "4.1.5",
"@vitest/browser-playwright": "4.1.5",
"@vitest/coverage-v8": "4.1.5",
"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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ nz-content {
padding: 5px 0;
}

#git-commit-id {
#build-number {
position: absolute;
left: 5px;
bottom: 5px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export class ExecuteWorkflowService {

const workflowExecuteRequest = {
executionName: executionName,
engineVersion: version.hash,
engineVersion: version.buildNumber,
logicalPlan: logicalPlan,
replayFromExecution: replayExecutionInfo,
workflowSettings: workflowSettings,
Expand Down
27 changes: 27 additions & 0 deletions frontend/src/environments/version.ts
Original file line number Diff line number Diff line change
@@ -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,
};
1 change: 1 addition & 0 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compileOnSave": false,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"paths": {
"path": [
"./node_modules/path-browserify"
Expand Down
27 changes: 11 additions & 16 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -11094,6 +11089,7 @@ __metadata:
"@vitest/coverage-v8": "npm:4.1.5"
ai: "npm:5.0.93"
ajv: "npm:8.10.0"
build-number-generator: "npm:3.1.0"
concaveman: "npm:2.0.0"
concurrently: "npm:7.4.0"
d3-shape: "npm:2.1.0"
Expand All @@ -11104,7 +11100,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"
Expand Down
Loading