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
special/webpack improvements #449
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.
LGTM just fix the linting issues please 👍
} | ||
|
||
export default function parseWebpack(content, filepath, deps) { | ||
const filename = path.basename(filepath); | ||
if (webpackConfigRegex.test(filename)) { | ||
const module = require(filepath).module || {}; // eslint-disable-line global-require | ||
const wpConfig = require(filepath); // eslint-disable-line global-require |
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.
You changed the regex to include .ts config files, wouldn't this fail for a ts file?
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 am working with TypeScript, and it's working like a charm… 😄
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.
Actually, I've got a doubt. It's working with my project but I'm calling depcheck from a TypeScript file using ts-node. Maybe it'd be a requirement in order to use this feature.
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.
Ok so yeah it works for you because of ts-node.
I think we should revert the ts loading until we find a good way of dealing with this
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'll do some more tests directly using the command line.
But anyway, will it hurt to keep this commit? I mean, at worst, if people is not using it with the same requisites as I do, it will fail while reading the config file, and therefore, work as before. So it should be improved, but already can be a useful feature…
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.
The cli could fail for users where it didn't fail before. At least could you make a PR and make it so that it uses the tryRequire
?
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.
So, after my tests, I can confirm that:
- when using
ts-node
, it works well, even with command line (I tested withnpx ts-node ~/depcheck/bin/depcheck.js --specials=bin,tslint,webpack
); - when executing depcheck with
node
, the webpack configuration file is ignored, but the rest of the process is working correctly.
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.
Great then, nothing broke :)
Codecov Report
@@ Coverage Diff @@
## master #449 +/- ##
==========================================
+ Coverage 99.13% 99.15% +0.02%
==========================================
Files 36 36
Lines 697 714 +17
==========================================
+ Hits 691 708 +17
Misses 6 6
Continue to review full report at Codecov.
|
Beautiful, thanks! |
Correcting some issues about webpack special parser.
Tests included.
This is correcting issues #246, #446 and #448.