From 617d70ab41503f4f225eecdb537e41999435ea76 Mon Sep 17 00:00:00 2001 From: Mike Barkmin Date: Mon, 9 Sep 2024 00:14:09 +0200 Subject: [PATCH] fix hyperbook.json already present --- .changeset/blue-readers-punch.md | 5 +++++ packages/hyperbook/build.ts | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .changeset/blue-readers-punch.md diff --git a/.changeset/blue-readers-punch.md b/.changeset/blue-readers-punch.md new file mode 100644 index 00000000..308e6377 --- /dev/null +++ b/.changeset/blue-readers-punch.md @@ -0,0 +1,5 @@ +--- +"hyperbook": patch +--- + +Fix hyperbook.json already present, which leads to build errors in docker container. diff --git a/packages/hyperbook/build.ts b/packages/hyperbook/build.ts index cfffbcb0..f56275df 100644 --- a/packages/hyperbook/build.ts +++ b/packages/hyperbook/build.ts @@ -96,16 +96,19 @@ module.exports = { const orig = path.join(root, "hyperbook.json"); const temp = path.join(root, ".hyperbook", "hyperbook.json"); - console.log(`${chalk.blue(`[${prefix}]`)} Copying hyperbook.json from ${orig} to ${temp}.`); - fs.cpSync( - orig, - temp, - { - force: true, - }, + console.log( + `${chalk.blue(`[${prefix}]`)} Copying hyperbook.json from ${orig} to ${temp}.`, ); + fs.rmSync(temp, { + force: true, + }); + fs.cpSync(orig, temp, { + force: true, + }); - console.log(`${chalk.blue(`[${prefix}]`)} Updating temporarily created hyperbook.json.`); + console.log( + `${chalk.blue(`[${prefix}]`)} Updating temporarily created hyperbook.json.`, + ); fs.writeFileSync( path.join(root, ".hyperbook", "hyperbook.json"), JSON.stringify(hyperbookJson, null, 2),