Get version from package.json

This commit is contained in:
phil 2025-06-28 03:58:55 +02:00
parent bbffcd5aed
commit 5535df0334
4 changed files with 4 additions and 8 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "gisaf-frontend", "name": "gisaf-frontend",
"displayName": "Gisaf web front-end", "displayName": "Gisaf web front-end",
"version": "0.0.0", "version": "0.5.0",
"license": "GPL-3.0", "license": "GPL-3.0",
"description": "Gisaf Geomatics", "description": "Gisaf Geomatics",
"repository": { "repository": {
@ -18,8 +18,7 @@
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e", "e2e": "ng e2e",
"openapi-ts": "openapi-ts -i http://127.0.0.1:5080/openapi.json -o src/app/openapi --client angular", "openapi-ts": "openapi-ts -i http://127.0.0.1:5080/openapi.json -o src/app/openapi --client angular",
"source-map-explorer": "source-map-explorer dist/*.js", "source-map-explorer": "source-map-explorer dist/*.js"
"version": "echo \"{\\\"version\\\":\\\"$(git describe --tags --dirty --always)\\\"}\" > src/version.json"
}, },
"licenses": [ "licenses": [
{ {

View file

@ -10,7 +10,7 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog'
import { AuthenticationService } from './_services/authentication.service' import { AuthenticationService } from './_services/authentication.service'
import { LoginDialogComponent } from './login/login.component' import { LoginDialogComponent } from './login/login.component'
import versionJson from '../version.json' import packageJson from '../../package.json'
export class Version { export class Version {
public backend: string public backend: string
@ -61,7 +61,7 @@ export class AppComponent implements OnInit {
this.bootstrapService.get().subscribe({ this.bootstrapService.get().subscribe({
next: res => { next: res => {
this.version.backend = res.version this.version.backend = res.version
this.version.frontend = versionJson["version"] this.version.frontend = packageJson["version"]
this.title = res.title || this.title this.title = res.title || this.title
this.titleService.setTitle(res.windowTitle || this.title) this.titleService.setTitle(res.windowTitle || this.title)
this.configService.setConf(res) this.configService.setConf(res)

View file

View file

@ -1,3 +0,0 @@
{
"version": "0.0.0"
}