Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add resolveLockfile #14

Merged
merged 3 commits into from Sep 6, 2022
Merged

feat: add resolveLockfile #14

merged 3 commits into from Sep 6, 2022

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Jul 10, 2022

for implementing nuxt/nuxt#11074 and unjs/nitro#149.

Q: We could also have a utility for detecting a version controlled root? Some monorepos don't have a lockfile in their root, e.g. just a client and server directory, or similar - but I think allowing users to configure likely covers that case.

@danielroe danielroe added the enhancement New feature or request label Jul 10, 2022
@danielroe danielroe requested a review from pi0 July 10, 2022 06:19
@danielroe danielroe self-assigned this Jul 10, 2022
@danielroe danielroe changed the title feat: add findWorkspaceRoot feat: add resolveRootPackageJSON Jul 12, 2022
@pi0 pi0 changed the title feat: add resolveRootPackageJSON feat: add resolveLockfile Jul 29, 2022
@pi0
Copy link
Member

pi0 commented Jul 29, 2022

I like the idea of having this building block to write workspace resolution logic but let's give it precise name as it does.

@danielroe
Copy link
Member Author

But, more precisely, it resolves a package.json that is either alongside a lockfile or contains a workspaces key. I don't think it would be that useful to resolve the lockfile itself, and in some cases the root package.json might not be accompanied by a lockfile.

@pi0
Copy link
Member

pi0 commented Jul 29, 2022

Yeah it is complexer than this to find actual workspace root. I kinda liked the idea to have small utility and combine some heuristics after you renamed from findWorkspaceDir to try best to find workspace root.

currently if we have a lockfile in subdir, like docs/yarn.lock and docs/package.json, it considers nested lock as rootfile.

@pi0
Copy link
Member

pi0 commented Jul 29, 2022

Better way to say: We can probably guess root better if do several find attempts or extract information once and check it more than once (instead of finding nearest pkg+lock combo). Something like .git is more reliable than even (closest)lockfile

@pi0 pi0 mentioned this pull request Sep 6, 2022
@codecov
Copy link

codecov bot commented Sep 6, 2022

Codecov Report

Merging #14 (eb32854) into main (9189bca) will decrease coverage by 96.33%.
The diff coverage is n/a.

❗ Current head eb32854 differs from pull request most recent head 577c91f. Consider uploading reports for the commit 577c91f to get more accurate results

@@           Coverage Diff            @@
##             main   nuxt/nuxt.js#10939       +/-   ##
========================================
- Coverage   96.33%     0   -96.34%     
========================================
  Files           5     0        -5     
  Lines         109     0      -109     
  Branches       26     0       -26     
========================================
- Hits          105     0      -105     
+ Misses          4     0        -4     
Impacted Files Coverage Δ
src/index.ts
src/utils.ts
src/types/packagejson.ts
src/types/index.ts
src/types/tsconfig.ts

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pi0 pi0 merged commit 6b12948 into main Sep 6, 2022
@pi0 pi0 deleted the feat/workspace-dir branch September 6, 2022 11:17
@pi0 pi0 mentioned this pull request Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants