Files
Jeff FisherandGitHub 3c84063ae8 Migrate dev-tool from CommonJS to ESM with native TypeScript support (#37255)
### Packages impacted by this PR

`@azure/dev-tool`

### Issues associated with this PR

https://github.com/Azure/azure-sdk-for-js/issues/36819

### Describe the problem that is addressed by this PR

Replace tsx runtime with Node's native TypeScript execution. This
simplifies the bootstrap chain and removes the tsx dependency.

Key changes:
- Add "type": "module" to package.json and set engines >= 22.6.0
- Convert launch.js, dtx.js to TypeScript with strip-types shebangs
- Delete register.js/register.d.ts (tsx loader no longer needed)
- Update tsconfig: module/moduleResolution to NodeNext, add
allowImportingTsExtensions and noEmit
- Replace all __dirname usage with import.meta.dirname
- Replace dynamic require() in resolveProject.ts with createRequire()
- Add .ts extensions to all relative imports (~82 files)
- Add JSON import assertions (with { type: "json" })
- Upgrade chalk from v4 to v5 (ESM-only)
- Remove tsx from dependencies
2026-05-05 15:33:34 -05:00

32 lines
681 B
JavaScript
Executable File

#!/usr/bin/env node
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* This command is an alias for `dev-tool run vendored`
*/
import { spawn } from "node:child_process";
import { resolve } from "node:path";
const engine = process.argv0;
const args = [
resolve(import.meta.dirname, "launch.ts"),
"run",
"vendored",
...process.argv.slice(2),
];
const subProcess = spawn(engine, args, { stdio: "inherit" });
subProcess.on("exit", (code, signal) => {
console.error(`subprocess exited with ${code} and signal ${signal}`);
process.exit(code ?? 0);
});
subProcess.on("error", (error) => {
console.error(error);
process.exit(1);
});