mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-20 17:52:51 +00:00
Convert supervisor_version module to typescript, and add typings for json
Change-type: patch Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
parent
1b0fd82f51
commit
c5acb2f66d
@ -1,6 +0,0 @@
|
||||
# Parses package.json and returns resin-supervisor's version
|
||||
_ = require 'lodash'
|
||||
version = require('../../package.json').version
|
||||
tagExtra = process.env.SUPERVISOR_TAG_EXTRA
|
||||
version += '+' + tagExtra if !_.isEmpty(tagExtra)
|
||||
module.exports = version
|
9
src/lib/supervisor-version.ts
Normal file
9
src/lib/supervisor-version.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import * as packageJson from '../../package.json';
|
||||
let version = (packageJson as any).version;
|
||||
const tagExtra = process.env.SUPERVISOR_TAG_EXTRA;
|
||||
if (!_.isEmpty(tagExtra)) {
|
||||
version += '+' + tagExtra;
|
||||
}
|
||||
export = version;
|
5
typings/typings.d.ts
vendored
Normal file
5
typings/typings.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
// Allow importing of json files with typescript
|
||||
declare module "*.json" {
|
||||
const value: { [key: string]: any};
|
||||
export default value;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user