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:
Cameron Diver 2018-06-11 23:34:45 +01:00
parent 1b0fd82f51
commit c5acb2f66d
No known key found for this signature in database
GPG Key ID: 69264F9C923F55C1
3 changed files with 14 additions and 6 deletions

View File

@ -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

View 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
View File

@ -0,0 +1,5 @@
// Allow importing of json files with typescript
declare module "*.json" {
const value: { [key: string]: any};
export default value;
}