Convert a few more build scripts to TypeScript

For #277526
This commit is contained in:
Matt Bierner
2025-11-21 09:20:38 -08:00
parent daaf36b4f5
commit f0e7fe3775
34 changed files with 146 additions and 155 deletions

24
build/lib/node.ts Normal file
View File

@@ -0,0 +1,24 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import path from 'path';
import fs from 'fs';
const root = path.dirname(path.dirname(import.meta.dirname));
const npmrcPath = path.join(root, 'remote', '.npmrc');
const npmrc = fs.readFileSync(npmrcPath, 'utf8');
const version = /^target="(.*)"$/m.exec(npmrc)?.[1];
if (!version) {
throw new Error('Failed to extract Node version from .npmrc');
}
const platform = process.platform;
const arch = process.arch;
const node = platform === 'win32' ? 'node.exe' : 'node';
const nodePath = path.join(root, '.build', 'node', `v${version}`, `${platform}-${arch}`, node);
console.log(nodePath);