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

Support using a glob to find a file and output the file #56

Closed
wants to merge 2 commits into from
Closed

Support using a glob to find a file and output the file #56

wants to merge 2 commits into from

Conversation

skovy
Copy link

@skovy skovy commented May 21, 2019

Resolves #27.

For example, copying { source: "./dist/*.js", destination: "./testing/testingglob.js" } should copy the file that matches the glob "./dist/*.js" to "./testing/testingglob.js" but today it copies as a directory with the glob pattern within ./testing/testingglob.js/*.js.

@skovy
Copy link
Author

skovy commented May 21, 2019

@gregnb do you have thoughts or opinions on approaching a fix for this? I tried to quickly make the following code change but realize we need a way to glob match files which would require including a package like glob? It looks like cpx package only supports the output being a directory?

+      // if the destination contains an extension assume it's a file, even if
+      // provided a glob.
+      const isFile = path.extname(command.destination);

-      if (matches === null) {
+      if (matches === null || isFile) {

@skovy skovy marked this pull request as ready for review May 21, 2019 00:54
@skovy skovy closed this May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Something strange while copying file and renaming it
1 participant