-
Notifications
You must be signed in to change notification settings - Fork 136
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
Feature/ Support regex path names #74
Conversation
index.js
Outdated
@@ -86,6 +107,16 @@ var clean = function() { | |||
webpackDir = upperCaseWindowsRoot(webpackDir); | |||
} | |||
|
|||
// Resolve RegExp paths. | |||
_this.paths.reduce((acc, currentPath) => { |
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 should be assigning the result of this .reduce
back again to _this.paths
. Better else, You can instead map the regex to resolved paths and assign it to _this.paths
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.
Hey, okay I'll look into it!
index.js
Outdated
|
||
const resolvedPaths = []; | ||
|
||
rootChildren.forEach(child => { |
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 codebase is very ES5 right now. I believe we can maintain one style for now. We can later on rewrite the entire plugin in one go with ES6.
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.
Okay :D
@aulisius I resolved those issues ^-^, I'll work on the tests now. |
Regex Support Fixes
index.js
Outdated
rootChildren.forEach(function (child) { | ||
if (pattern.test(child) === true) { | ||
resolvedPaths.push(child); | ||
return rootChildren.reduce(function(paths, child) { |
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.
This can be written with .filter
as
return rootChildren.filter(pattern.test)
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.
@aulisius Enhanced! :D
All looks good. Thoughts? @chrisblossom @johnagan |
Some updates on this? Imo a must have feature for this plugin. |
@DenizTemizer waiting for @chrisblossom and @johnagan to review I guess. |
Ping. |
Ping @chrisblossom @johnagan |
I will just close it if no one comments :/ |
Hey @buoyantair 👋 thank you for the PR. I'm just getting around to using webpack again and I'll check this PR out soon. |
## The devDependency [clean-webpack-plugin](https://github.com/johnagan/clean-webpack-plugin) was updated from `1.0.1` to `2.0.0`. This version is **not covered** by your **current version range**. If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update. --- <details> <summary>Release Notes for v2.0.0</summary> <p><a href="https://urls.greenkeeper.io/chrisblossom/clean-webpack-plugin/blob/2.0/README.md">README.md</a></p> <p>Changes:</p> <ul> <li>No configuration is needed for standard usage (cleans webpack's <code>output.path</code>)</li> <li>By default during webpack's watch mode, only files created by webpack are removed</li> <li>Because <a href="https://www.npmjs.com/package/del" rel="nofollow">del</a> is used, globbing is supported</li> <li>Plugin is tested directly via webpack</li> <li>All supported versions are tested</li> <li>Windows is tested via <a href="https://www.appveyor.com/" rel="nofollow">appveyor</a> (no mocked tests)</li> <li>Complete build system including prepublish hooks and git prepush/commit hooks</li> <li>Written with Typescript</li> </ul> <p>Additional notes:</p> <ul> <li>Moved to <a href="https://circleci.com/" rel="nofollow">CircleCI</a> because <a href="https://news.ycombinator.com/item?id=18978251" rel="nofollow">Travis CI was sold</a> and <a href="https://news.ycombinator.com/item?id=19218036" rel="nofollow">looks to now be in maintenance mode</a>.</li> <li>Replaced Coveralls with <a href="https://codecov.io/" rel="nofollow">codecov</a> because automatic build merging works. This is important because of windows/different webpack version testing</li> </ul> <p>Please discuss the current API and suggest any changes.</p> <p>Closes Issues: <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="228815640" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#53" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/53/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/53">#53</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="231858021" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#55" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/55/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/55">#55</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="261623866" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#67" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/67/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/67">#67</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="295742643" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#73" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/73/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/73">#73</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="310004405" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#80" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/80/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/80">#80</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="324754162" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#85" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/85/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/85">#85</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="336239767" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#86" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/86/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/86">#86</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="350539725" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#89" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/89/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/89">#89</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="355469528" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#91" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/91/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/91">#91</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="359168546" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#92" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/92/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/92">#92</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="360576175" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#93" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/93/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/93">#93</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="395851254" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#98" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/98/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/98">#98</a><br> Closes PRs: <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="203192494" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#39" data-hovercard-type="pull_request" data-hovercard-url="/johnagan/clean-webpack-plugin/pull/39/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/pull/39">#39</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="296175694" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#74" data-hovercard-type="pull_request" data-hovercard-url="/johnagan/clean-webpack-plugin/pull/74/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/pull/74">#74</a></p> <p>Massive props to <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=1595871" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/chrisblossom">@chrisblossom</a> for working on this and pushing it through.</p> </details> <details> <summary>Commits</summary> <p>The new version differs by 16 commits.</p> <ul> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/2e7f7f63699460d827329c04779001a237113f57"><code>2e7f7f6</code></a> <code>2.0.0</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/e90a300fdab0f36e671461bb2ccfbd93f288554c"><code>e90a300</code></a> <code>remove unused babel plugins</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/0ff10f0260aaf4dfd20a0a23850a188b64f856a6"><code>0ff10f0</code></a> <code>windows test fixes</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/d6e2e3821fcca8edd9e68ca4cf57198a82e86bb8"><code>d6e2e38</code></a> <code>use *<em>/</em> instead of ** and update packages</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/e19b19d13f5f9f4bc6495afb4d51773dff8d616a"><code>e19b19d</code></a> <code>reorder option types</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/03d12acc097de106d6b218e5954059beae55a04a"><code>03d12ac</code></a> <code>add protectWebpackAssets option</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/f506dc612bb7c9e946f8fa4f1014db7a74a23a67"><code>f506dc6</code></a> <code>add cleanStaleWebpackAssets option</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/c730f4513f80de9192255cdee4ed831d1d94e199"><code>c730f45</code></a> <code>cleanAfterEveryBuildPatterns should not remove webpack assets</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/6d6b34185ab3bc8ce657d7d46023f5311d4ed612"><code>6d6b341</code></a> <code>initialPatterns renamed to cleanOnceBeforeBuildPatterns, customPatterns renamed to cleanAfterEveryBuildPatterns</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/5e5a51914123e35c07ece8f2c8cadaff9f9f39df"><code>5e5a519</code></a> <code>do not include customPatterns in initialPatterns</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/3830778a378b17d26a40c83310a8b4b04a3dfe62"><code>3830778</code></a> <code>use circleci instead of travis</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/bdb5099c7ea65eca177ca5c8c0306338aa39ab1d"><code>bdb5099</code></a> <code>readme updates</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/d2ac5160892d9ebfe2d1056f5d72edd9b3e217e9"><code>d2ac516</code></a> <code>require dangerouslyAllowCleanPatternsOutsideProject to explicitly set dry to false</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/68893e872f716c4e2efc79746bc114aead323748"><code>68893e8</code></a> <code>allowExternal renamed to dangerouslyAllowCleanPatternsOutsideProject</code></li> <li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/816732823b3178420565fac5cb1b2208b5bdb809"><code>8167328</code></a> <code>by default remove all files once prior to compilation, add allowExternal option, migrate dryRun to dry</code></li> </ul> <p>There are 16 commits in total.</p> <p>See the <a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/compare/277811552e04b705b1ad840365eb493a54f6457e...2e7f7f63699460d827329c04779001a237113f57">full diff</a></p> </details> <details> <summary>FAQ and help</summary> There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new). </details> --- Your [Greenkeeper](https://greenkeeper.io) bot 🌴
Closed in |
I was reading through this plugin yesterday and thought "Hey, why not support regex, that way I dont have to pass in an array of names!" and I tried to implement it.
The tests don't work out at all, I am having a hard time debugging them, but I think I'm on the right path.
This is not complete but If there''s anyone willing to help out and write these tests, it would be awesome!
Thanks =3