Skip to content

Commit

Permalink
Remove ignore code to see if it fixes it
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Oct 25, 2023
1 parent b01f1c6 commit 63b7353
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
4 changes: 4 additions & 0 deletions bin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
1 change: 1 addition & 0 deletions lib/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
23 changes: 20 additions & 3 deletions lib/utils/apply-action-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
21 changes: 19 additions & 2 deletions lib/utils/apply-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,38 @@ 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)
}
}
}
}
const sourcePaths = await glob(pattern, globOptions)
console.log({ sourcePaths, pattern })
const pMap = (await pMapPromise).default
return pMap(sourcePaths, action, { concurrency: 5 })
}

0 comments on commit 63b7353

Please sign in to comment.