From 3201f83b70bb2ee1d1daeb585a26e8cd6b8ce95f Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sat, 19 Aug 2023 01:24:09 +0000
Subject: [PATCH] v4-alpha -> v4

---
 quartz/bootstrap-cli.mjs |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/quartz/bootstrap-cli.mjs b/quartz/bootstrap-cli.mjs
index 990022e..643733f 100755
--- a/quartz/bootstrap-cli.mjs
+++ b/quartz/bootstrap-cli.mjs
@@ -19,7 +19,7 @@
 
 const ORIGIN_NAME = "origin"
 const UPSTREAM_NAME = "upstream"
-const QUARTZ_SOURCE_BRANCH = "v4-alpha"
+const QUARTZ_SOURCE_BRANCH = "v4"
 const cwd = process.cwd()
 const cacheDir = path.join(cwd, ".quartz-cache")
 const cacheFile = "./.quartz-cache/transpiled-build.mjs"
@@ -192,7 +192,10 @@
 
       await rmContentFolder()
       if (setupStrategy === "copy") {
-        await fs.promises.cp(originalFolder, contentFolder, { recursive: true })
+        await fs.promises.cp(originalFolder, contentFolder, {
+          recursive: true,
+          preserveTimestamps: true,
+        })
       } else if (setupStrategy === "symlink") {
         await fs.promises.symlink(originalFolder, contentFolder, "dir")
       }
@@ -267,9 +270,15 @@
     spawnSync("npm", ["i"], { stdio: "inherit" })
     console.log(chalk.green("Done!"))
   })
-  .command("restore", "Try to restore your content folder from the cache", async () => {
-    await popContentFolder()
-  })
+  .command(
+    "restore",
+    "Try to restore your content folder from the cache",
+    CommonArgv,
+    async (argv) => {
+      const contentFolder = path.join(cwd, argv.directory)
+      await popContentFolder(contentFolder)
+    },
+  )
   .command("sync", "Sync your Quartz to and from GitHub.", SyncArgv, async (argv) => {
     const contentFolder = path.join(cwd, argv.directory)
     console.log(chalk.bgGreen.black(`\n Quartz v${version} \n`))
@@ -286,7 +295,6 @@
 
         // follow symlink and copy content
         await fs.promises.cp(linkTarg, contentFolder, {
-          force: true,
           recursive: true,
           preserveTimestamps: true,
         })
@@ -296,11 +304,12 @@
         dateStyle: "medium",
         timeStyle: "short",
       })
-      spawnSync("git", ["commit", "-am", `Quartz sync: ${currentTimestamp}`], { stdio: "inherit" })
+      spawnSync("git", ["add", "."], { stdio: "inherit" })
+      spawnSync("git", ["commit", "-m", `Quartz sync: ${currentTimestamp}`], { stdio: "inherit" })
 
       if (contentStat.isSymbolicLink()) {
         // put symlink back
-        await popContentFolder()
+        await popContentFolder(contentFolder)
       }
     }
 

--
Gitblit v1.10.0