Jimmy He
2024-01-01 002bbc37b140d177276cd655049e7de2072fa537
fix: Continue setup even if a file to delete is not found (#663)

* Continue setup even if a file to delete is not found

For various reasons, `.gitkeep` may be deleted already.

(In my case, even though I followed the [Getting Started](https://quartz.jzhao.xyz) instructions exactly, my first run resulted in an `fatal: 'upstream' does not appear to be a git repository`)

If we try to delete `.gitkeep` again and don't ignore `ENOENT`, then the whole setup fails.

* Use fs.existsSync
1 files modified
5 ■■■■ changed files
quartz/cli/handlers.js 5 ●●●● patch | view | raw | blame | history
quartz/cli/handlers.js
@@ -113,7 +113,10 @@
    }
  }
  await fs.promises.unlink(path.join(contentFolder, ".gitkeep"))
  const gitkeepPath = path.join(contentFolder, ".gitkeep")
  if (fs.existsSync(gitkeepPath)) {
    await fs.promises.unlink(gitkeepPath)
  }
  if (setupStrategy === "copy" || setupStrategy === "symlink") {
    let originalFolder = sourceDirectory