Use simpler dirname

This commit is contained in:
Matt Bierner
2025-11-11 17:13:51 -08:00
parent 723aa849c9
commit f3c8fabb47
11 changed files with 10 additions and 15 deletions

View File

@@ -21,7 +21,7 @@ import { fileURLToPath } from 'url';
const { debounce } = utilModule;
const { createReporter } = reporterModule;
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname
const root = 'cli';
const rootAbs = path.resolve(__dirname, '..', root);

View File

@@ -2,9 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
import gulp from 'gulp';
import util from './lib/util.js';
import date from './lib/date.js';

View File

@@ -2,9 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
import gulp from 'gulp';
import * as path from 'path';
import util from './lib/util.js';
@@ -20,10 +18,9 @@ import monacoapi from './lib/monaco-api.js';
import * as fs from 'fs';
import filter from 'gulp-filter';
import reporterModule from './lib/reporter.js';
import { fileURLToPath } from 'url';
import monacoPackage from './monaco/package.json' with { type: 'json' };
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname
const { getVersion } = getVersionModule;
const { createReporter } = reporterModule;
const root = path.dirname(__dirname);

View File

@@ -23,7 +23,7 @@ import { fileURLToPath } from 'url';
EventEmitter.defaultMaxListeners = 100;
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname
const { getVersion } = getVersionModule;
const { createReporter } = reporterModule;
const root = path.dirname(__dirname);

View File

@@ -17,7 +17,7 @@ import util from './lib/util.js';
EventEmitter.defaultMaxListeners = 100;
const require = createRequire(import.meta.url);
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname
const { transpileTask, compileTask, watchTask, compileApiProposalNamesTask, watchApiProposalNamesTask } = compilation;

View File

@@ -40,7 +40,7 @@ const { getVersion } = getVersionModule;
const { getProductionDependencies } = dependenciesModule;
const { readISODate } = dateModule;
const { fetchUrls, fetchGithub } = fetchModule;
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname
const REPO_ROOT = path.dirname(__dirname);
const commit = getVersion(REPO_ROOT);

View File

@@ -16,7 +16,7 @@ import { fileURLToPath } from 'url';
const { config } = electronConfigModule;
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname
const root = path.dirname(__dirname);
const BUILD_TARGETS = [

View File

@@ -23,7 +23,7 @@ import { fileURLToPath } from 'url';
const { rimraf } = utilModule;
const { getVersion } = getVersionModule;
const { recommendedDeps: debianRecommendedDependencies } = depLists;
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname
const exec = promisify(cp.exec);
const root = path.dirname(__dirname);
const commit = getVersion(root);

View File

@@ -43,7 +43,7 @@ const { config } = electronModule;
const { createAsar } = asarModule;
const glob = promisify(globCallback);
const rcedit = promisify(rceditCallback);
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname
const root = path.dirname(__dirname);
const commit = getVersion(root);

View File

@@ -27,7 +27,7 @@ import { fileURLToPath } from 'url';
const { getVersion } = getVersionModule;
const { readISODate } = dateModule;
const { getProductionDependencies } = dependenciesModule;
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname
const REPO_ROOT = path.dirname(__dirname);
const BUILD_ROOT = path.dirname(REPO_ROOT);

View File

@@ -16,7 +16,7 @@ import rcedit from 'rcedit';
import { createRequire } from 'module';
import { fileURLToPath } from 'url';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const __dirname = import.meta.dirname;
const repoPath = path.dirname(__dirname);
const buildPath = (/** @type {string} */ arch) => path.join(path.dirname(repoPath), `VSCode-win32-${arch}`);
const setupDir = (/** @type {string} */ arch, /** @type {string} */ target) => path.join(repoPath, '.build', `win32-${arch}`, `${target}-setup`);