Files
vscode/extensions/git/esbuild.mts
Ladislau Szomoru c3b9417517 Git - second attempt to adopt the @vscode/fs-copyfile package (#301443)
* Reapply "Git - adopt the new package to use copy-on-write for the worktree include files (#299583)" (#300448)

This reverts commit c56c7bc071.

* Attempt to fix tests

* Fix build

* build: copy node_modules into extension bundle

* Regenerate lock file

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2026-03-16 14:14:06 +00:00

39 lines
1.4 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import { run } from '../esbuild-extension-common.mts';
const srcDir = path.join(import.meta.dirname, 'src');
const outDir = path.join(import.meta.dirname, 'dist');
async function copyNonTsFiles(outDir: string): Promise<void> {
const entries = await fs.readdir(srcDir, { withFileTypes: true, recursive: true });
for (const entry of entries) {
if (!entry.isFile() || entry.name.endsWith('.ts')) {
continue;
}
const srcPath = path.join(entry.parentPath, entry.name);
const relativePath = path.relative(srcDir, srcPath);
const destPath = path.join(outDir, relativePath);
await fs.mkdir(path.dirname(destPath), { recursive: true });
await fs.copyFile(srcPath, destPath);
}
}
run({
platform: 'node',
entryPoints: {
'main': path.join(srcDir, 'main.ts'),
'askpass-main': path.join(srcDir, 'askpass-main.ts'),
'git-editor-main': path.join(srcDir, 'git-editor-main.ts'),
},
srcDir,
outdir: outDir,
additionalOptions: {
external: ['vscode', '@vscode/fs-copyfile'],
},
}, process.argv, copyNonTsFiles);