-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Refactor] switch to an internal replacement for pkg-up
and read-pkg-up
#2047
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not super stoked on copy-pasting, but removing this dep is valuable.
The replacement const {dirname} = require('path');
const {accessSync} = require('fs');
function findUpSync(dir, file) {
const path = join(dir, file);
try {
accessSync(path);
return path;
} catch {}
const parent = dirname(dir);
return parent === dir ? null : findSync(parent, file);
} Use via |
Ergh, sorry for the failing tests. I didn't realize that My apologies if this is known issue and there's an established workflow for updating |
There isn’t; you could make the changes in two PRs, and we could land and publish the utils one first? altho i wouldn’t expect that to be needed - we use linklocal in this repo so everything should be using the latest local code. |
Oh, well in that case, maybe just switching the |
Also as you mentioned, the CVE got updated, so I guess closing this PR as moot would also make sense. 🤷🏻♂️ |
Another alternative from a bit ago is #1017. |
e3a44f8
to
6e9723d
Compare
6e9723d
to
9ccdcb7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
went ahead and replaced pkg-up
as well, and rebased. this should be good to go.
pkg-up
and read-pkg-up
Codecov Report
@@ Coverage Diff @@
## main #2047 +/- ##
==========================================
+ Coverage 84.02% 84.03% +0.01%
==========================================
Files 94 96 +2
Lines 3017 3032 +15
Branches 898 899 +1
==========================================
+ Hits 2535 2548 +13
- Misses 482 484 +2
Continue to review full report at Codecov.
|
Inspired by #2046, I dug into what
read-pkg-up
provides and found it to be very simple, for this particular case. Its downstream dependencies build in some safety and options that aren't necessary when you already know you're working with apackage.json
, and in this library's case, when you know you don't want to "normalize" it. Sinceread-pkg-up
drags several libraries along with it, at least two of which don't actually add any functionality toeslint-plugin-import
, and its use here is pretty straightforward, it seemed moderately reasonable to me to reproduce the functionality internally.