Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ export class DomStack {
this.#src = src
this.#dest = dest

const copyDirs = opts?.copy ?? []
const copyDirs = (opts?.copy ?? []).map(dir => resolve(dir))

this.opts = {
...opts,
copy: copyDirs,
ignore: [
...DEFAULT_IGNORES,
basename(dest),
Expand All @@ -172,12 +173,11 @@ export class DomStack {
],
}

if (copyDirs && copyDirs.length > 0) {
if (copyDirs.length > 0) {
const absDest = resolve(this.#dest)
for (const copyDir of copyDirs) {
// Copy dirs can be in the src dir (nested builds), but not in the dest dir.
const absCopyDir = resolve(copyDir)
const relToDest = relative(absDest, absCopyDir)
const relToDest = relative(absDest, copyDir)
if (relToDest === '' || !relToDest.startsWith('..')) {
throw new Error(`copyDir ${copyDir} is within the dest directory`)
}
Expand Down