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
16 changes: 7 additions & 9 deletions frontend/git-version.js → frontend/build-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,12 @@
* under the License.
*/

const { gitDescribeSync } = require("git-describe");
const { generate } = require("build-number-generator");
const { version } = require("./package.json");
const { resolve, relative } = require("path");
const { writeFileSync, existsSync, mkdirSync } = require("fs-extra");

const gitInfo = gitDescribeSync({
dirtyMark: false,
dirtySemver: false,
});

gitInfo.version = version;
const buildNumber = generate(version);
Comment on lines 21 to +25
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we simply call this method in source code, instead of doing so in post install script? I think we can get rid of such a post install script.


if (!existsSync(__dirname + "/src/environments")) {
mkdirSync(__dirname + "/src/environments");
Expand All @@ -37,10 +32,13 @@ writeFileSync(
file,
`// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
/* tslint:disable */
export const Version = ${JSON.stringify(gitInfo, null, 4)};
export const Version = {
"buildNumber": ${JSON.stringify(buildNumber)},
"version": ${JSON.stringify(version)}
};
/* tslint:enable */
`,
{ encoding: "utf-8" }
);

console.log(`Wrote version info ${gitInfo.raw} to ${relative(resolve(__dirname, ".."), file)}`);
console.log(`Wrote build number ${buildNumber} to ${relative(resolve(__dirname, ".."), file)}`);
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"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"
"postinstall": "node build-version.js"
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -122,12 +122,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: 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