From 9a8a8e6c8b2971b5fbdbeb7085e1fd0a00ed2115 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 28 Feb 2022 14:56:38 -0800 Subject: [PATCH] Move update-distro script to mjs --- build/npm/update-distro.js | 18 ------------------ build/npm/update-distro.mjs | 18 ++++++++++++++++++ package.json | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 build/npm/update-distro.js create mode 100644 build/npm/update-distro.mjs diff --git a/build/npm/update-distro.js b/build/npm/update-distro.js deleted file mode 100644 index 5ca891a77fb..00000000000 --- a/build/npm/update-distro.js +++ /dev/null @@ -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)); diff --git a/build/npm/update-distro.mjs b/build/npm/update-distro.mjs new file mode 100644 index 00000000000..655d9f2c243 --- /dev/null +++ b/build/npm/update-distro.mjs @@ -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)); diff --git a/package.json b/package.json index 9380dcba2a0..d8a11e8882f 100644 --- a/package.json +++ b/package.json @@ -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",