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

lower copy's zero check level when from is glob pattern #105

Closed
wants to merge 0 commits into from

Conversation

tarol
Copy link
Contributor

@tarol tarol commented Apr 28, 2018

fix eslint error passingly

@SBoudrias
Copy link
Owner

Can you explain the use case to allow glob to not match any files? In which case is this really useful?

@tarol
Copy link
Contributor Author

tarol commented May 2, 2018

English is not my native language; please excuse typing errors.
i use this package in yeoman-generator
my scaffold has serveral projects, but them use the same writing function
this function handle files according to the suffix, such as .ejs、.less、.js
i use glob pattern in this function to distinguish files, but one of project maybe has no .ejs files, then throw the error
i dont think this error should be throw, because glob pattern matched no files is a latent rule

if (Array.isArray(pattern)) {
return pattern.some(arrayHasMagic);
}
return glob.hasMagic(pattern);
}

exports.copy = function (from, to, options) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of checking for magic in the pattern, let's add an option ignoreNoMatch: true. When true, we don't throw the error: assert(options.ignoreNoMatch || files.length > 0, ...

@SBoudrias
Copy link
Owner

Thanks for explaining, let's just do some minor changes so we maintain backward compatibility.

@SBoudrias
Copy link
Owner

SBoudrias commented May 6, 2018

Note: fix #104 & #82

@SBoudrias
Copy link
Owner

Hey @tarol are you still planning to make changes and have this PR merged?

@tarol tarol closed this Jul 2, 2018
SBoudrias pushed a commit that referenced this pull request Apr 2, 2019
## The dependency [globby](https://github.com/sindresorhus/globby) was updated from `8.0.2` to `9.1.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 v9.1.0</summary>

<ul>
<li>Add TypeScript definition (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="416512295" data-permission-text="Issue title is private" data-url="sindresorhus/globby#111" data-hovercard-type="pull_request" data-hovercard-url="/sindresorhus/globby/pull/111/hovercard" href="https://urls.greenkeeper.io/sindresorhus/globby/pull/111">#111</a>)  <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/sindresorhus/globby/commit/9a9cf1e53f3033f465d682487c3e23bd61696c37/hovercard" href="https://urls.greenkeeper.io/sindresorhus/globby/commit/9a9cf1e53f3033f465d682487c3e23bd61696c37"><tt>9a9cf1e</tt></a></li>
<li>Add check to ensure <code>cwd</code> is a directory (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="414218230" data-permission-text="Issue title is private" data-url="sindresorhus/globby#110" data-hovercard-type="pull_request" data-hovercard-url="/sindresorhus/globby/pull/110/hovercard" href="https://urls.greenkeeper.io/sindresorhus/globby/pull/110">#110</a>)  <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/sindresorhus/globby/commit/59f4b48e92445d530bbf43a39842314b3dd6e42e/hovercard" href="https://urls.greenkeeper.io/sindresorhus/globby/commit/59f4b48e92445d530bbf43a39842314b3dd6e42e"><tt>59f4b48</tt></a></li>
<li>Deduplicate identical file patterns (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="398284025" data-permission-text="Issue title is private" data-url="sindresorhus/globby#102" data-hovercard-type="pull_request" data-hovercard-url="/sindresorhus/globby/pull/102/hovercard" href="https://urls.greenkeeper.io/sindresorhus/globby/pull/102">#102</a>)  <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/sindresorhus/globby/commit/22946186ff2f0f89893382d6e13d7a6215231dc0/hovercard" href="https://urls.greenkeeper.io/sindresorhus/globby/commit/22946186ff2f0f89893382d6e13d7a6215231dc0"><tt>2294618</tt></a></li>
</ul>
<p><a class="commit-link" href="https://urls.greenkeeper.io/sindresorhus/globby/compare/v9.0.0...v9.1.0"><tt>v9.0.0...v9.1.0</tt></a></p>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 19 commits ahead by 19, behind by 2.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/89cee24d7dd225279549f59023f905a9062c96b5"><code>89cee24</code></a> <code>9.1.0</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/59f4b48e92445d530bbf43a39842314b3dd6e42e"><code>59f4b48</code></a> <code>Add check to ensure <code>cwd</code> is a directory (#110)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/9a9cf1e53f3033f465d682487c3e23bd61696c37"><code>9a9cf1e</code></a> <code>Add TypeScript definition (#111)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/eb26c7e906ef30f2981dfa6c437cd6e13650dfda"><code>eb26c7e</code></a> <code>Meta tweaks</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/d77a623a5d397260d952c84830c0240955ece808"><code>d77a623</code></a> <code>Add failing test for #105 (#108)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/22946186ff2f0f89893382d6e13d7a6215231dc0"><code>2294618</code></a> <code>Deduplicate identical file patterns (#102)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/ba9c267a2a0f85b440138f539def02f0c0220929"><code>ba9c267</code></a> <code>Add failing test for #97 (#100)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/71b9c58f86b4625b58ae241360016f4418dac288"><code>71b9c58</code></a> <code>9.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/39ad0d9a72794a74c777a2656fa5edef70e1170d"><code>39ad0d9</code></a> <code>Update dependencies</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/d80422881de179c23726bbddd02c0402a797186b"><code>d804228</code></a> <code>Fix compatibility with latest <code>dir-glob</code> release (#99)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/7f9f31b663dfe84769a4f42dd26bd315cac92169"><code>7f9f31b</code></a> <code>Fix Travis badge (#95)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/94cef2f69bc58a9becb592f00b7b676155cdc0bb"><code>94cef2f</code></a> <code>CI updates (#96)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/c1c744dd7848d15ea277db6b75cec7a1e4d7576e"><code>c1c744d</code></a> <code>Rename the <code>opts</code> property returned from <code>.generateGlobTasks</code> to <code>options</code></code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/8815ee8ca3cd1a05e52a2a0c0cc15918aa63bce9"><code>8815ee8</code></a> <code>Require Node.js 6 and upgrade dependencies</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/globby/commit/84632f11de790c5b6abeb7aa0bdd35c77126dcfc"><code>84632f1</code></a> <code>Fix <code>expandDirectories</code> and <code>ignores</code> option working together (#88)</code></li>
</ul>
<p>There are 19 commits in total.</p>
<p>See the <a href="https://urls.greenkeeper.io/sindresorhus/globby/compare/946fcea913beb06817d91d8ffb5b4dfe09719a1c...89cee24d7dd225279549f59023f905a9062c96b5">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 🌴
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants