Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Closed
Changes from all 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
10 changes: 10 additions & 0 deletions packages/lu/src/parser/lubuild/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ export class Builder {
outPath = path.join(path.resolve(path.dirname(luconfig)), settingsContents[0].id)
} else if (out) {
outPath = path.join(path.resolve(out), settingsContents[0].id)
} else {
outPath = path.resolve(settingsContents[0].id)
}
writeContents.push(this.mergeSettingsContent(outPath, settingsContents))
}
Expand All @@ -235,6 +237,10 @@ export class Builder {
for (const content of writeContents) {
const outFilePath = path.join(path.resolve(out), path.basename(content.path))
if (force || !fs.existsSync(outFilePath)) {
if (!fs.existsSync(path.dirname(outFilePath))) {
fs.mkdirSync(path.dirname(outFilePath))
}

this.handler(`Writing to ${outFilePath}\n`)
await fs.writeFile(outFilePath, content.content, 'utf-8')
writeDone = true
Expand All @@ -243,6 +249,10 @@ export class Builder {
} else {
for (const content of writeContents) {
if (force || !fs.existsSync(content.path)) {
if (!fs.existsSync(path.dirname(content.path))) {
fs.mkdirSync(path.dirname(content.path))
}

this.handler(`Writing to ${content.path}\n`)
await fs.writeFile(content.path, content.content, 'utf-8')
writeDone = true
Expand Down