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 | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/quartz/build.ts b/quartz/build.ts
index 45595e7..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,21 +54,16 @@
if (argv.serve) {
const server = http.createServer(async (req, res) => {
- let status = 200
- const result = await serveHandler(req, res, {
+ await serveHandler(req, res, {
public: output,
directoryListing: false,
- }, {
- async sendError() {
- status = 404
- },
})
+ const status = res.statusCode
const statusString = status === 200 ? chalk.green(`[${status}]`) : chalk.red(`[${status}]`)
console.log(statusString + chalk.grey(` ${req.url}`))
- return result
})
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