mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +00:00
Move update-distro script to mjs
This commit is contained in:
parent
76a647c33c
commit
9a8a8e6c8b
|
@ -1,18 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
//@ts-check
|
||||
const cp = require('child_process');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const rootPath = path.dirname(path.dirname(path.dirname(__dirname)));
|
||||
const vscodePath = path.join(rootPath, 'vscode');
|
||||
const distroPath = path.join(rootPath, 'vscode-distro');
|
||||
const commit = cp.execSync('git rev-parse HEAD', { cwd: distroPath, encoding: 'utf8' }).trim();
|
||||
const packageJsonPath = path.join(vscodePath, 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
|
||||
packageJson.distro = commit;
|
||||
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
18
build/npm/update-distro.mjs
Normal file
18
build/npm/update-distro.mjs
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { execSync } from 'child_process';
|
||||
import { join, resolve } from 'path';
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const rootPath = resolve(fileURLToPath(import.meta.url), '..', '..', '..', '..');
|
||||
const vscodePath = join(rootPath, 'vscode');
|
||||
const distroPath = join(rootPath, 'vscode-distro');
|
||||
const commit = execSync('git rev-parse HEAD', { cwd: distroPath, encoding: 'utf8' }).trim();
|
||||
const packageJsonPath = join(vscodePath, 'package.json');
|
||||
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
||||
|
||||
packageJson.distro = commit;
|
||||
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
@ -43,7 +43,7 @@
|
|||
"tsec-compile-check": "node node_modules/tsec/bin/tsec -p src/tsconfig.tsec.json",
|
||||
"vscode-dts-compile-check": "tsc -p src/tsconfig.vscode-dts.json && tsc -p src/tsconfig.vscode-proposed-dts.json",
|
||||
"valid-layers-check": "node build/lib/layersChecker.js",
|
||||
"update-distro": "node build/npm/update-distro.js",
|
||||
"update-distro": "node build/npm/update-distro.mjs",
|
||||
"web": "echo 'yarn web' is replaced by './scripts/code-server' or './scripts/code-web'",
|
||||
"compile-web": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-web",
|
||||
"watch-web": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js watch-web",
|
||||
|
|
Loading…
Reference in a new issue