From 140787ad473c993f9ef4b158e7b87bf185cdf34c Mon Sep 17 00:00:00 2001 From: Charles Teague Date: Sun, 25 Feb 2024 10:15:10 -0500 Subject: [PATCH] =?UTF-8?q?Project=20Create=20-=20Don=E2=80=99t=20Overwrit?= =?UTF-8?q?e=20Supporting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t overwrite supporting files. Already doesn’t overwrite project or scaffolding files. Fixes #8873 --- news/changelog-1.5.md | 1 + src/project/project-create.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/news/changelog-1.5.md b/news/changelog-1.5.md index 0cb70cf4ff..01d3a20ab8 100644 --- a/news/changelog-1.5.md +++ b/news/changelog-1.5.md @@ -98,5 +98,6 @@ All changes included in 1.5: - ([#8540](https://github.com/quarto-dev/quarto-cli/issues/8540)): Allow title to be specifed separately when creating a project - ([#8652](https://github.com/quarto-dev/quarto-cli/issues/8652)): Make code cell detection in IDE tooling consistent across editor modes. - ([#8779](https://github.com/quarto-dev/quarto-cli/issues/8779)): Resolve shortcode includes before engine and target determination. +- ([#8873](https://github.com/quarto-dev/quarto-cli/issues/8873)): Don't overwrite supporting files when creating a project. - Add support for `{{< lipsum >}}` shortcode, which is useful for emitting placeholder text. Specify a specific number of paragraphs (`{{< lipsum 3 >}}`). - Increase v8's max heap size by default, to avoid out-of-memory errors when rendering large documents (also cf. https://github.com/denoland/deno/issues/18935). diff --git a/src/project/project-create.ts b/src/project/project-create.ts index 60abd21103..1bc28b5f28 100644 --- a/src/project/project-create.ts +++ b/src/project/project-create.ts @@ -137,11 +137,12 @@ export async function projectCreate(options: ProjectCreateOptions) { dest = join(options.dir, supporting.to); displayName = supporting.to; } - - ensureDirSync(dirname(dest)); - copyTo(src, dest); - if (!options.quiet) { - info("- Created " + displayName, { indent: 2 }); + if (!existsSync(dest)) { + ensureDirSync(dirname(dest)); + copyTo(src, dest); + if (!options.quiet) { + info("- Created " + displayName, { indent: 2 }); + } } } }