forked from microsoft/vscode-extension-telemetry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
injectVersion.js
17 lines (14 loc) · 1.08 KB
/
injectVersion.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const fs = require('fs');
// Reads dist/node/common/util.js and replaces PACKAGE_JSON_VERSION with the number from the package.json
const packageJson = require('./package.json');
const baseUtil = fs.readFileSync('./dist/node/common/util.js', 'utf8');
const newBaseUtil = baseUtil.replace(/PACKAGE_JSON_VERSION/g, packageJson.version);
fs.writeFileSync('./dist/node/common/util.js', newBaseUtil);
// Reads dist/browser/common/util.js and replaces PACKAGE_JSON_VERSION with the number from the package.json
const baseUtilBrowser = fs.readFileSync('./dist/browser/common/util.js', 'utf8');
const newBaseUtilBrowser = baseUtilBrowser.replace(/PACKAGE_JSON_VERSION/g, packageJson.version);
fs.writeFileSync('./dist/browser/common/util.js', newBaseUtilBrowser);