From 08f8e3b4a4879dd7c91c16fbce80c4f2bc5e357f Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 10 Jul 2023 02:32:24 +0000
Subject: [PATCH] docs + various polish
---
quartz/build.ts | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/quartz/build.ts b/quartz/build.ts
index b96bf01..36e3210 100644
--- a/quartz/build.ts
+++ b/quartz/build.ts
@@ -14,7 +14,6 @@
directory: string
verbose: boolean
output: string
- clean: boolean
serve: boolean
port: number
}
@@ -34,11 +33,9 @@
}
// clean
- if (argv.clean) {
- perf.addEvent('clean')
- await rimraf(output)
- console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince('clean')}`)
- }
+ perf.addEvent('clean')
+ await rimraf(output)
+ console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince('clean')}`)
// glob
perf.addEvent('glob')
@@ -57,14 +54,16 @@
if (argv.serve) {
const server = http.createServer(async (req, res) => {
- console.log(chalk.grey(`[req] ${req.url}`))
- return serveHandler(req, res, {
+ await serveHandler(req, res, {
public: output,
directoryListing: false,
})
+ const status = res.statusCode
+ const statusString = status === 200 ? chalk.green(`[${status}]`) : chalk.red(`[${status}]`)
+ console.log(statusString + chalk.grey(` ${req.url}`))
})
server.listen(argv.port)
- console.log(`Started a Quartz server listening at http://localhost:${argv.port}`)
+ console.log(chalk.cyan(`Started a Quartz server listening at http://localhost:${argv.port}`))
console.log('hint: exit with ctrl+c')
}
}
--
Gitblit v1.10.0