diff --git a/packages/opencensus-core/package.json b/packages/opencensus-core/package.json index f35c6af80..5f5a72f9f 100644 --- a/packages/opencensus-core/package.json +++ b/packages/opencensus-core/package.json @@ -9,7 +9,7 @@ "test": "nyc -x '**/test/**' --reporter=html --reporter=text mocha 'build/test/**/*.js'", "clean": "rimraf build/*", "check": "gts check", - "compile": "tsc -p .", + "compile": "tsc -p . && cp package.json build/", "fix": "gts fix", "prepare": "npm run compile", "pretest": "npm run compile", diff --git a/packages/opencensus-core/src/common/version.ts b/packages/opencensus-core/src/common/version.ts new file mode 100644 index 000000000..1ed54cde5 --- /dev/null +++ b/packages/opencensus-core/src/common/version.ts @@ -0,0 +1,19 @@ + +/** + * Copyright 2018, OpenCensus Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const pjson = require('../../package.json'); +export const version: string = pjson.version; diff --git a/packages/opencensus-core/src/index.ts b/packages/opencensus-core/src/index.ts index fc9e3c53d..566695782 100644 --- a/packages/opencensus-core/src/index.ts +++ b/packages/opencensus-core/src/index.ts @@ -55,5 +55,4 @@ import * as logger from './common/console-logger'; export {logger}; // version -const version: string = require('../package.json').version; -export { version }; +export * from './common/version';