|
@ -3,8 +3,9 @@ import {resolve} from 'path' |
|
|
|
|
|
|
|
|
// Packages
|
|
|
// Packages
|
|
|
import flatten from 'arr-flatten' |
|
|
import flatten from 'arr-flatten' |
|
|
import unique from 'array-unique' |
|
|
|
|
|
import ignore from 'ignore' |
|
|
import ignore from 'ignore' |
|
|
|
|
|
import Mode from 'stat-mode' |
|
|
|
|
|
import unique from 'array-unique' |
|
|
import {stat, readdir, readFile} from 'fs-promise' |
|
|
import {stat, readdir, readFile} from 'fs-promise' |
|
|
|
|
|
|
|
|
// Ours
|
|
|
// Ours
|
|
@ -51,13 +52,22 @@ export async function npm(path, pkg, { |
|
|
).createFilter() |
|
|
).createFilter() |
|
|
|
|
|
|
|
|
const prefixLength = path.length + 1 |
|
|
const prefixLength = path.length + 1 |
|
|
const accepts = function (file) { |
|
|
const accepts = async function (file) { |
|
|
const relativePath = file.substr(prefixLength) |
|
|
const relativePath = file.substr(prefixLength) |
|
|
|
|
|
|
|
|
if (relativePath === '') { |
|
|
if (relativePath === '') { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const st = await stat(file) |
|
|
|
|
|
const mode = new Mode(st) |
|
|
|
|
|
if (!(mode.isDirectory() || mode.isFile() || mode.isSymbolicLink())) { |
|
|
|
|
|
if (debug) { |
|
|
|
|
|
console.log('> [debug] ignoring special file "%s"', file) |
|
|
|
|
|
} |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const accepted = filter(relativePath) |
|
|
const accepted = filter(relativePath) |
|
|
if (!accepted && debug) { |
|
|
if (!accepted && debug) { |
|
|
console.log('> [debug] ignoring "%s"', file) |
|
|
console.log('> [debug] ignoring "%s"', file) |
|
@ -135,13 +145,22 @@ export async function docker(path, { |
|
|
).createFilter() |
|
|
).createFilter() |
|
|
|
|
|
|
|
|
const prefixLength = path.length + 1 |
|
|
const prefixLength = path.length + 1 |
|
|
const accepts = function (file) { |
|
|
const accepts = async function (file) { |
|
|
const relativePath = file.substr(prefixLength) |
|
|
const relativePath = file.substr(prefixLength) |
|
|
|
|
|
|
|
|
if (relativePath === '') { |
|
|
if (relativePath === '') { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const st = await stat(file) |
|
|
|
|
|
const mode = new Mode(st) |
|
|
|
|
|
if (!(mode.isDirectory() || mode.isFile() || mode.isSymbolicLink())) { |
|
|
|
|
|
if (debug) { |
|
|
|
|
|
console.log('> [debug] ignoring special file "%s"', file) |
|
|
|
|
|
} |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const accepted = filter(relativePath) |
|
|
const accepted = filter(relativePath) |
|
|
if (!accepted && debug) { |
|
|
if (!accepted && debug) { |
|
|
console.log('> [debug] ignoring "%s"', file) |
|
|
console.log('> [debug] ignoring "%s"', file) |
|
@ -187,7 +206,7 @@ const explode = async function (paths, {accepts}) { |
|
|
let path = file |
|
|
let path = file |
|
|
let s |
|
|
let s |
|
|
|
|
|
|
|
|
if (!accepts(file)) { |
|
|
if (!(await accepts(file))) { |
|
|
return null |
|
|
return null |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|