phenomnomnominal / betterer

betterer makes it easier to make incremental improvements to your codebase
MIT License
569 stars 38 forks source link

VSCode extension not running per project/library in NX-workspace #1183

Open work933k opened 6 months ago

work933k commented 6 months ago

Describe the bug I tried this VSCode extension in a NX-monorepository which is a integrated-workspace. This means that not all projects/libraries have a package.json file, but rely on the package.json in the root. Per project/library i've set-up a specific betterer configuration, but the vscode extension does not take this structure into account.

To Reproduce If possible please share a repo with the issue, or another repository which demonstrates the issue. If possible please include the .betterer.ts file, and the .betterer.results file if applicable. At a minimum please share the command you are using to run Betterer.

Expected behavior I expected that upon saving this VSCode extension would start at the directory of the saved file and then traverse upwards until it finds a .betterer.ts file.

Screenshots If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

Additional context I see this in the log output:

[Info  - 2:21:51 PM] Server: file:///root/OurNx/libs/myproduct/profile/src/lib/pages/profile-children-page/profile-children-page.component.ts saved, validating:
[Info  - 2:21:51 PM] Server: Adding "file:///root/OurNx/libs/myproduct/profile/src/lib/pages/profile-children-page/profile-children-page.component.ts" to validation queue at 2023-12-07T13:21:51.037Z
[Info  - 2:21:51 PM] Server: Processing queue at 2023-12-07T13:21:51.037Z
[Info  - 2:21:51 PM] Server: Validating document "file:///root/OurNx/libs/myproduct/profile/src/lib/pages/profile-children-page/profile-children-page.component.ts".
[Info  - 2:21:51 PM] Validator: Folders: 1, Documents: 1
[Info  - 2:21:51 PM] Validator: About to run Betterer.
[Info  - 2:21:51 PM] Validator: Setting CWD to "/root/OurNx".
[Info  - 2:21:51 PM] Validator: Getting Betterer for "/root/OurNx".
[Info  - 2:21:51 PM] Validator: Getting Betterer config.
[Info  - 2:21:51 PM] {"cache":true,"cachePath":"/root/OurNx/.betterer.cache","configPaths":["/root/OurNx/.betterer.ts"],"cwd":"/root/OurNx","filters":[".*"],"resultsPath":"/root/OurNx/.betterer.results","silent":true}
[Info  - 2:21:51 PM] Validator: Running Betterer in "/root/OurNx".
[Info  - 2:21:51 PM] Validator: Running Betterer on "["/root/OurNx/libs/myproduct/profile/src/lib/pages/profile-children-page/profile-children-page.component.ts"]."
[Error - 2:21:51 PM] Validator: Error: could not find config file at "/root/OurNx/.betterer.ts". 😔
[Info  - 2:21:51 PM] Validator: Restoring CWD to "/mnt/c/Users/me/AppData/Local/Programs/Microsoft VS Code".

I would expect that the /root/OurNx/libs/myproduct/profile/.betterer.ts would be used for validation.

Installed VSCode extension: v5.2.1