Fix core version grabbing
This commit is contained in:
parent
afdfadd34e
commit
724d59daba
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wms-core",
|
"name": "wms-core",
|
||||||
"version": "0.10.21",
|
"version": "0.10.22",
|
||||||
"description": "Node web framework",
|
"description": "Node web framework",
|
||||||
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
|
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
|
||||||
"author": "Alice Gaudon <alice@gaudon.pro>",
|
"author": "Alice Gaudon <alice@gaudon.pro>",
|
||||||
|
@ -14,6 +14,16 @@ export default class NunjucksComponent extends ApplicationComponent<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async start(app: Express, router: Router): Promise<void> {
|
public async start(app: Express, router: Router): Promise<void> {
|
||||||
|
let coreVersion = 'unknown';
|
||||||
|
try {
|
||||||
|
coreVersion = require('../../package.json').version;
|
||||||
|
} catch (e) {
|
||||||
|
try {
|
||||||
|
coreVersion = require('../package.json').version;
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const env = nunjucks.configure(this.viewsPath, {
|
const env = nunjucks.configure(this.viewsPath, {
|
||||||
autoescape: true,
|
autoescape: true,
|
||||||
express: app,
|
express: app,
|
||||||
@ -26,7 +36,7 @@ export default class NunjucksComponent extends ApplicationComponent<void> {
|
|||||||
return path;
|
return path;
|
||||||
})
|
})
|
||||||
.addGlobal('app_version', this.app!.getVersion())
|
.addGlobal('app_version', this.app!.getVersion())
|
||||||
.addGlobal('core_version', require('../../package.json').version)
|
.addGlobal('core_version', coreVersion)
|
||||||
.addFilter('hex', (v: number) => {
|
.addFilter('hex', (v: number) => {
|
||||||
return v.toString(16);
|
return v.toString(16);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user