Browse Source

get-files: side-loading of `pkg` to avoid double fs lookups

master
Guillermo Rauch 9 years ago
parent
commit
43734fe951
  1. 8
      lib/get-files.js

8
lib/get-files.js

@ -14,9 +14,11 @@ import IGNORED from './ignored';
* @return {Array} comprehensive list of paths to sync * @return {Array} comprehensive list of paths to sync
*/ */
export default async function getFiles (path) { export default async function getFiles (path, pkg) {
const pkgData = await read(resolve(path, 'package.json'), 'utf8'); if (!pkg) {
const pkg = JSON.parse(pkgData); const pkgData = await read(resolve(path, 'package.json'), 'utf8');
pkg = JSON.parse(pkgData);
}
let search = (pkg.files || ['.']).concat('package.json'); let search = (pkg.files || ['.']).concat('package.json');
if (pkg.main) search = search.concat(pkg.main); if (pkg.main) search = search.concat(pkg.main);

Loading…
Cancel
Save