From 63b7353dcc7cb857bc19db13cea78e0e3da8da66 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Wed, 25 Oct 2023 14:11:21 -0700 Subject: [PATCH] Remove ignore code to see if it fixes it --- bin/main.js | 4 ++++ lib/copy.js | 1 + lib/utils/apply-action-sync.js | 23 ++++++++++++++++++++--- lib/utils/apply-action.js | 21 +++++++++++++++++++-- 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/bin/main.js b/bin/main.js index c22d1ca..1d70177 100644 --- a/bin/main.js +++ b/bin/main.js @@ -172,10 +172,14 @@ module.exports = function main (source, outDir, args) { if (outputPath !== sourcePath) { return copyFile(sourcePath, outputPath, options).then(() => { log(`Copied: ${sourcePath} --> ${outputPath}`) + }).catch(err => { + console.error(err) + throw err }) } return Promise.resolve() }).catch(error => { + console.error(error) console.error(`Failed to copy: ${error.message}.`) process.exit(1) }) diff --git a/lib/copy.js b/lib/copy.js index 1f6d1b2..7897bb3 100644 --- a/lib/copy.js +++ b/lib/copy.js @@ -75,6 +75,7 @@ module.exports = async function copy (source, outputDir, options, callback) { // Copy const copied = await applyAction(options.source, options, sourcePath => { const outputPath = options.toDestination(sourcePath) + console.log({ outputPath, sourcePath }) if (outputPath !== sourcePath) { return copyFile(sourcePath, outputPath, options) } diff --git a/lib/utils/apply-action-sync.js b/lib/utils/apply-action-sync.js index 8107e54..fe252ad 100644 --- a/lib/utils/apply-action-sync.js +++ b/lib/utils/apply-action-sync.js @@ -35,16 +35,32 @@ module.exports = function applyActionSync (pattern, options, action) { nodir: !options.includeEmptyDirs, follow: Boolean(options.dereference), ignore: { - ignored: p => { + ignored: (p) => { try { - return p.relativePosix() ? ig.ignores(p.relativePosix()) : false + if (p.relativePosix()) { + const relPath = p.relativePosix() + const ignores = ig.ignores(relPath) + console.log({ relPath, ignores, name: p.name, fn: 'sync-ignored' }) + return ignores + } else { + console.log({ name: p.name, fn: 'sync-ignored' }) + return false + } } catch (err) { console.error(err) } }, childrenIgnored: (p) => { try { - return p.relativePosix() ? ig.ignores(p.relativePosix()) : false + if (p.relativePosix()) { + const relPath = p.relativePosix() + const ignores = ig.ignores(relPath) + console.log({ relPath, ignores, name: p.name, fn: 'sync-childrenIgnored' }) + return ignores + } else { + console.log({ name: p.name, fn: 'sync-childrenIgnored' }) + return false + } } catch (err) { console.error(err) } @@ -53,6 +69,7 @@ module.exports = function applyActionSync (pattern, options, action) { } const results = [] for (const sourcePath of globSync(pattern, globOptions)) { + console.log({ sourcePath, pattern }) const result = action(sourcePath) results.push(result) } diff --git a/lib/utils/apply-action.js b/lib/utils/apply-action.js index ba1bb99..7a078b8 100644 --- a/lib/utils/apply-action.js +++ b/lib/utils/apply-action.js @@ -38,14 +38,30 @@ module.exports = async function applyAction (pattern, options, action) { ignore: { ignored: (p) => { try { - return p.relativePosix() ? ig.ignores(p.relativePosix()) : false + if (p.relativePosix()) { + const relPath = p.relativePosix() + const ignores = ig.ignores(relPath) + console.log({ relPath, name: p.name, ignores, fn: 'async-ignored' }) + return ignores + } else { + console.log({ name: p.name, fn: 'async-ignored' }) + return false + } } catch (err) { console.error(err) } }, childrenIgnored: (p) => { try { - return p.relativePosix() ? ig.ignores(p.relativePosix()) : false + if (p.relativePosix()) { + const relPath = p.relativePosix() + const ignores = ig.ignores(relPath) + console.log({ relPath, ignores, name: p.name, fn: 'async-childrenIgnored' }) + return ignores + } else { + console.log({ name: p.name, fn: 'async-childrenIgnored' }) + return false + } } catch (err) { console.error(err) } @@ -53,6 +69,7 @@ module.exports = async function applyAction (pattern, options, action) { } } const sourcePaths = await glob(pattern, globOptions) + console.log({ sourcePaths, pattern }) const pMap = (await pMapPromise).default return pMap(sourcePaths, action, { concurrency: 5 }) }