vscode-extension-telemetry/injectVersion.js

17 строки
1.1 KiB
JavaScript
Исходник Обычный вид История

2022-09-01 22:31:47 +03:00
/*---------------------------------------------------------------------------------------------
* 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
2022-09-01 22:31:47 +03:00
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);
2022-09-01 22:31:47 +03:00
// 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);