Comparing version 0.3.0 to 0.3.1
12
index.js
@@ -100,4 +100,14 @@ 'use strict'; | ||
var filepath = path.resolve(opts.cwd, filename); | ||
if (utils.isDirectory(filepath)) { | ||
next() | ||
return; | ||
} | ||
copyOne(filepath, dir, opts, next); | ||
}, cb); | ||
}, function(err, arr) { | ||
if (err) { | ||
cb(err); | ||
return; | ||
} | ||
cb(null, arr.filter(Boolean)); | ||
}); | ||
} | ||
@@ -104,0 +114,0 @@ |
@@ -30,2 +30,9 @@ 'use strict'; | ||
/** | ||
* Gets the file stats for a File object. | ||
* | ||
* @param {Object} `file` File object that has a `path` property. | ||
* @return {Object} `fs.stat` object if successful. Otherwise an empty object. | ||
*/ | ||
utils.stat = function(file) { | ||
@@ -39,2 +46,21 @@ try { | ||
/** | ||
* Checks if the file is a directory using `fs.lstatSync`. | ||
* | ||
* @param {String|Object} `file` filepath as a string or a file object with a `path` property. | ||
* @return {Boolean} Returns `true` when the filepath is a directory. | ||
*/ | ||
utils.isDirectory = function(file) { | ||
if (typeof file === 'string') { | ||
file = {path: file} | ||
} | ||
var stat = utils.stat(file); | ||
if (stat.isDirectory) { | ||
return stat.isDirectory(); | ||
} | ||
return false; | ||
}; | ||
/** | ||
* Get the base filepath from a glob. | ||
@@ -41,0 +67,0 @@ * |
{ | ||
"name": "copy", | ||
"description": "Copy files or directories using globs.", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"homepage": "https://github.com/jonschlinkert/copy", | ||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"contributors": [ | ||
"Brian Leathem (blog.bleathem.ca)", | ||
"Brian Woodward (https://twitter.com/doowb)", | ||
"gaozhenze (https://github.com/SoulRIver2015)", | ||
"Guilherme Santiago (https://gsantiago.github.io)", | ||
"Joakim Carlstein (http://joakim.beng.se)", | ||
"Jon Schlinkert (http://twitter.com/jonschlinkert)" | ||
], | ||
"repository": "jonschlinkert/copy", | ||
@@ -19,3 +27,4 @@ "bugs": { | ||
"bin": { | ||
"copy": "bin/cli.js" | ||
"copy": "bin/cli.js", | ||
"copy-cli": "bin/cli.js" | ||
}, | ||
@@ -22,0 +31,0 @@ "engines": { |
@@ -1,6 +0,6 @@ | ||
# copy [![NPM version](https://img.shields.io/npm/v/copy.svg?style=flat)](https://www.npmjs.com/package/copy) [![NPM downloads](https://img.shields.io/npm/dm/copy.svg?style=flat)](https://npmjs.org/package/copy) [![Build Status](https://img.shields.io/travis/jonschlinkert/copy.svg?style=flat)](https://travis-ci.org/jonschlinkert/copy) | ||
# copy [![NPM version](https://img.shields.io/npm/v/copy.svg?style=flat)](https://www.npmjs.com/package/copy) [![NPM monthly downloads](https://img.shields.io/npm/dm/copy.svg?style=flat)](https://npmjs.org/package/copy) [![NPM total downloads](https://img.shields.io/npm/dt/copy.svg?style=flat)](https://npmjs.org/package/copy) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/copy.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/copy) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/copy.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/copy) | ||
Copy files or directories using globs. | ||
> Copy files or directories using globs. | ||
## TOC | ||
## Table of Contents | ||
@@ -13,8 +13,3 @@ - [Install](#install) | ||
- [History](#history) | ||
- [Related projects](#related-projects) | ||
- [Contributing](#contributing) | ||
- [Building docs](#building-docs) | ||
- [Running tests](#running-tests) | ||
- [Author](#author) | ||
- [License](#license) | ||
- [About](#about) | ||
@@ -107,3 +102,3 @@ _(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ | ||
### [.copy.one](index.js#L122) | ||
### [.copy.one](index.js#L132) | ||
@@ -163,5 +158,5 @@ Copy a single `file` to the given `dest` directory, using the specified options and callback function. | ||
## Related projects | ||
## About | ||
You might also be interested in these projects: | ||
### Related projects | ||
@@ -173,27 +168,38 @@ * [expand-config](https://www.npmjs.com/package/expand-config): Expand tasks, targets and files in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-config "Expand tasks, targets and files in a declarative configuration.") | ||
* [export-files](https://www.npmjs.com/package/export-files): node.js utility for exporting a directory of files as modules. | [homepage](https://github.com/jonschlinkert/export-files "node.js utility for exporting a directory of files as modules.") | ||
* [write](https://www.npmjs.com/package/write): Write files to disk, creating intermediate directories if they don't exist. | [homepage](https://github.com/jonschlinkert/write "Write files to disk, creating intermediate directories if they don't exist.") | ||
* [write](https://www.npmjs.com/package/write): Write data to a file, replacing the file if it already exists and creating any… [more](https://github.com/jonschlinkert/write) | [homepage](https://github.com/jonschlinkert/write "Write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Thin wrapper around node's native fs methods.") | ||
## Contributing | ||
### Contributing | ||
This document was generated by [verb-readme-generator](https://github.com/verbose/verb-readme-generator) (a [verb](https://github.com/verbose/verb) generator), please don't edit directly. Any changes to the readme must be made in [.verb.md](.verb.md). See [Building Docs](#building-docs). | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). Or visit the [verb-readme-generator](https://github.com/verbose/verb-readme-generator) project to submit bug reports or pull requests for the readme layout template. | ||
### Contributors | ||
## Building docs | ||
| **Commits** | **Contributor** | | ||
| --- | --- | | ||
| 61 | [jonschlinkert](https://github.com/jonschlinkert) | | ||
| 2 | [joakimbeng](https://github.com/joakimbeng) | | ||
| 1 | [bleathem](https://github.com/bleathem) | | ||
| 1 | [doowb](https://github.com/doowb) | | ||
| 1 | [gsantiago](https://github.com/gsantiago) | | ||
| 1 | [SoulRIver2015](https://github.com/SoulRIver2015) | | ||
Generate readme and API documentation with [verb](https://github.com/verbose/verb): | ||
### Building docs | ||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ | ||
To generate the readme, run the following command: | ||
```sh | ||
$ npm install -g verb verb-readme-generator && verb | ||
$ npm install -g verbose/verb#dev verb-generate-readme && verb | ||
``` | ||
## Running tests | ||
### Running tests | ||
Install dev dependencies: | ||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: | ||
```sh | ||
$ npm install -d && npm test | ||
$ npm install && npm test | ||
``` | ||
## Author | ||
### Author | ||
@@ -203,11 +209,11 @@ **Jon Schlinkert** | ||
* [github/jonschlinkert](https://github.com/jonschlinkert) | ||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) | ||
## License | ||
### License | ||
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Released under the [MIT license](https://github.com/jonschlinkert/copy/blob/master/LICENSE). | ||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Released under the [MIT License](LICENSE). | ||
*** | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on June 19, 2016._ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on September 01, 2017._ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25803
18787
561
214