Skip to content

Commit

Permalink
[dev-tool] Work around two minor issues (#33250)
Browse files Browse the repository at this point in the history
### Packages impacted by this PR

`dev-tool`

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

One issue is VS Code using up a ton of memory and the TS language
service crashing when viewing a `.js` file. This was fixed by adding a
`jsconfig.json` file. I figured this out from this comment:
microsoft/vscode#235547 (comment)

The other issue is I wanted to be able to run dev-tool from outside of a
project folder when using admin commands (like listing all projects,
checking migration progress, etc) but `register.js` always tries to load
a local `package.json` and throws if you are in a folder without one so
I put a simple check to see if the file exists.
  • Loading branch information
xirzec authored Mar 3, 2025
1 parent 535cfb0 commit fabbcb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions common/tools/dev-tool/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"exclude": ["node_modules/**"]
}
5 changes: 4 additions & 1 deletion common/tools/dev-tool/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ const { name: hostPackageName } = main.require("./package.json");
// If we're bootstrapping a dev-tool command, we need to patch the package from
// CWD instead. This will still end up being dev-tool if we end up in a
// self-hosting situation where dev-tool calls itself from its own scripts.
const packageJsonPath = path.join(cwd, "package.json");
const packageNameToPatch =
hostPackageName === "@azure/dev-tool"
? require(path.join(cwd, "package.json")).name
? existsSync(packageJsonPath)
? require(packageJsonPath).name
: hostPackageName
: hostPackageName;

if (process.env.DEBUG) {
Expand Down

0 comments on commit fabbcb1

Please sign in to comment.