Added --version support
This commit is contained in:
parent
d1c4b46cea
commit
035fb0d7d0
1 changed files with 10 additions and 0 deletions
10
bin.mjs
10
bin.mjs
|
@ -1,5 +1,8 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import path from 'path'
|
||||||
|
import { fileURLToPath } from 'url'
|
||||||
|
import fs from 'fs'
|
||||||
import config from './lib/config.mjs'
|
import config from './lib/config.mjs'
|
||||||
import SPServer from './lib/spserver.mjs'
|
import SPServer from './lib/spserver.mjs'
|
||||||
|
|
||||||
|
@ -17,6 +20,13 @@ if (config.get('config')) {
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.get('version')) {
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
const pckg = JSON.parse(fs.readFileSync(path.resolve(path.join(__dirname, './package.json'))))
|
||||||
|
console.log(`spserver ${pckg.version}`)
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
if (displayHelp) {
|
if (displayHelp) {
|
||||||
console.log(`Run static server for static files, simple servers or pure MVVM projects.
|
console.log(`Run static server for static files, simple servers or pure MVVM projects.
|
||||||
Specifying either file or folder serving is required.
|
Specifying either file or folder serving is required.
|
||||||
|
|
Loading…
Reference in a new issue