Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/npm/update-distro.mjs
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
import { execSync } from 'child_process';
6
import { join, resolve } from 'path';
7
import { readFileSync, writeFileSync } from 'fs';
8
import { fileURLToPath } from 'url';
9
10
const rootPath = resolve(fileURLToPath(import.meta.url), '..', '..', '..', '..');
11
const vscodePath = join(rootPath, 'vscode');
12
const distroPath = join(rootPath, 'vscode-distro');
13
const commit = execSync('git rev-parse HEAD', { cwd: distroPath, encoding: 'utf8' }).trim();
14
const packageJsonPath = join(vscodePath, 'package.json');
15
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
16
17
packageJson.distro = commit;
18
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
19
20