Closed lishaduck closed 3 months ago
Note: I haven't added tests yet. I wanted to make sure this implementation was fine first. I'm not a big fan of adding code about a different file to a service about package.json
s, but fixing that seemed a bit like the diff might... erm... explode. So I just pretended pnpm-workspace
was a package.json
file.
Forgot to remove a console.log. I'll get it :)
Could you rebase this PR? I merged the other one!
Yay! I found a bug in npm 🤣
Currently, it works... well, CI fails.
I was going to say... It works, but it's not polished. It currently grabs all the package.json files multiple times at least. I did drop some old polyfills at least 😁
Ok, it works locally, but apparently Node 22.5 broke npm: npm/cli#7657
Almost to a point I'm happy. I've got it reusing the package.json, now I just want to extract out fs to an interface so I can just mock the fs in tests instead of the cod, which should help readability (and code coverage).
And then I'll need to clean up the history a bit more...
Looks good! Just gotta get CI to pass now.
Yup. I'll also need to get some tests (which I suppose is needed for CI). Can you revert node to 22.4.x? 22.5.x still hasn't had a patch for npm.
CI uses current
so it'll always pull the latest. Let's give it another day, I'm sure they'll release a patch soon.
CI uses
current
so it'll always pull the latest. Let's give it another day, I'm sure they'll release a patch soon.
Ok, fair enough. See ya then! (I'm working through tests. Almost done (I hope))
Added some tests, should be 100% coverage, but I don't have a good way of checking.
Added some tests, should be 100% coverage, but I don't have a good way of checking.
npm run cover
that should do it
How is this line untested? https://github.com/jeffijoe/typesync/blob/c69636bbc0c0d98818cfcae15638fd6f099fe66a/src/workspace-resolver.ts#L95
It's just a function declaration. And it's causing branch coverage problems? What?
Ok, that was weird. I guess parameter defaults get considered as the declaration line, and branching %s factor in how high into the call stack it is???
Were you able to get the last branch covered?
Also, looks like the bug has been fixed, we're just waiting for a release.
Were you able to get the last branch covered?
Yup. 18605181c3d5dfc689658947b3ec316c72ab3a73
Also, looks like the bug has been fixed, we're just waiting for a release.
Yup. https://nodejs.org/en/blog/release/v22.5.1
Can I get a CI rerun?
@jeffijoe, ping :) Can you retrigger ci?
Thanks! I’ll release this tomorrow. :) nice work!
Thanks! I’ll release this tomorrow. :) nice work!
Thanks to you! It was a pleasure to write, nicely architectured (I'll admit I'm not a big fan of dependency injection containers, but they do serve a purpose). It was lots of fun, entirely worthwhile, and feel free to ask me to fix monorepo support again if it breaks and you're not in mood to fix it yourself becuase I actually want to find an excuse to write some more code here 😉[^1]
[^1]: And, of course, it'll come at the wrong time and I'll regret saying so. But for now, feel free. 😜
Closes: #118.
~~Depends on #117. Diff (GH doesn't like stacked PRs from forks): https://github.com/lishaduck/typesync/compare/fix-monorepos...pnpm~~