UNPKG
create-serve
Version:
latest (1.0.1)
1.0.1
1.0.0
0.1.0
0.0.0
🍛 Ultralight http server with live reload. [CLI + API]
github.com/nativew/serve
nativew/serve
create-serve
/
src
/
utils
/
setRoot.js
10 lines
(7 loc)
•
241 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
import
fs
from
'fs'
;
import
{ options, defaultRoot }
from
'../index.js'
;
export
const
setRoot
= (
) => {
const
{ root } = options;
const
isRoot = !root || root ==
'.'
;
return
isRoot && fs.
existsSync
(defaultRoot) ? defaultRoot : root; };