coralite-scripts 0.28.1 → 0.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/libs/server.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
> ⚠️ **NOTE: This is a read-only mirror.** Development happens on [Codeberg](https://codeberg.org/tjdavid/coralite).
|
|
2
|
-
|
|
3
1
|
# Coralite Development Environment Guide
|
|
4
2
|
|
|
5
3
|
Welcome to **Coralite starter script**, a lightweight Static Site Generator (SSG) built for rapid development and clean output. This guide walks you through setting up your local development environment using the provided `coralite-scripts` package and configuration files.
|
package/libs/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import colours from 'kleur'
|
|
|
3
3
|
import localAccess from 'local-access'
|
|
4
4
|
import chokidar from 'chokidar'
|
|
5
5
|
import buildSass from './build-sass.js'
|
|
6
|
-
import { displayError, displayInfo, displaySuccess, toCode, toMS, toTime } from './build-utils.js'
|
|
6
|
+
import { displayError, displayInfo, displaySuccess, toCode, toMS, toTime, deleteDirectoryRecursive } from './build-utils.js'
|
|
7
7
|
import { extname, join, normalize, relative, sep } from 'path'
|
|
8
8
|
import { access, constants, mkdir, writeFile } from 'fs/promises'
|
|
9
9
|
import Coralite from 'coralite'
|
|
@@ -474,6 +474,14 @@ async function server (config, options) {
|
|
|
474
474
|
process.stdout.write(PAD + `${colours.bold('- Network:')} ${access.network}\n\n`)
|
|
475
475
|
process.stdout.write(border + colours.inverse(' LOGS ') + border + '\n\n')
|
|
476
476
|
})
|
|
477
|
+
|
|
478
|
+
const gracefulShutdown = () => {
|
|
479
|
+
deleteDirectoryRecursive(config.output)
|
|
480
|
+
process.exit(0)
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
process.on('SIGINT', gracefulShutdown)
|
|
484
|
+
process.on('SIGTERM', gracefulShutdown)
|
|
477
485
|
} catch (error) {
|
|
478
486
|
displayError('Failed to start server', error)
|
|
479
487
|
}
|