|
|
@ -24,11 +24,14 @@ const IGNORED = require('./ignored') |
|
|
|
* @return {Array} comprehensive list of paths to sync |
|
|
|
*/ |
|
|
|
|
|
|
|
async function npm(path, pkg, { |
|
|
|
async function npm(path, pkg, nowConfig = {}, { |
|
|
|
limit = null, |
|
|
|
debug = false |
|
|
|
} = {}) { |
|
|
|
const whitelist = pkg.now && pkg.now.files ? pkg.now.files : pkg.files |
|
|
|
const whitelist = nowConfig.files || pkg.files |
|
|
|
|
|
|
|
// the package.json `files` whitelist still
|
|
|
|
// honors ignores: https://docs.npmjs.com/files/package.json#files
|
|
|
|
const search_ = whitelist || ['.'] |
|
|
|
// convert all filenames into absolute paths
|
|
|
|
const search = Array.prototype.concat.apply([], (await Promise.all(search_.map(file => glob(file, {cwd: path, absolute: true, dot: true}))))) |
|
|
@ -125,12 +128,16 @@ const asAbsolute = function (path, parent) { |
|
|
|
* @return {Array} comprehensive list of paths to sync |
|
|
|
*/ |
|
|
|
|
|
|
|
async function docker(path, { |
|
|
|
async function docker(path, nowConfig = {}, { |
|
|
|
limit = null, |
|
|
|
debug = false |
|
|
|
} = {}) { |
|
|
|
const whitelist = nowConfig.files |
|
|
|
|
|
|
|
// base search path
|
|
|
|
const search_ = ['.'] |
|
|
|
// the now.json `files` whitelist still
|
|
|
|
// honors ignores: https://docs.npmjs.com/files/package.json#files
|
|
|
|
const search_ = whitelist || ['.'] |
|
|
|
|
|
|
|
// convert all filenames into absolute paths
|
|
|
|
const search = search_.map(file => asAbsolute(file, path)) |
|
|
@ -262,7 +269,7 @@ const explode = async function (paths, {accepts, debug}) { |
|
|
|
|
|
|
|
const maybeRead = async function (path, default_ = '') { |
|
|
|
try { |
|
|
|
return (await readFile(path, 'utf8')) |
|
|
|
return await readFile(path, 'utf8') |
|
|
|
} catch (err) { |
|
|
|
return default_ |
|
|
|
} |
|
|
|