Skip to content

Commit

Permalink
- upgrade @plotdb/srcbuild` from v0.0.43 to v0.0.45 with customizabl…
Browse files Browse the repository at this point in the history
…e watcher root

 - support customizable `feroot` in server init option.
 - bump version
  • Loading branch information
zbryikt committed May 3, 2022
1 parent 7a5f480 commit 62db0ce
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 23 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## v2.3.36

- upgrade @plotdb/srcbuild` from v0.0.43 to v0.0.45 with customizable watcher root
- support customizable `feroot` in server init option.


## v2.3.35

- upgrade minimist for vulnerability fixing
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ server.init accepts config with following options:
- `startTime` - optional time for providing initialization elapsed time information.
- `api` - functions for customizing server. executed before server started
- `open` - true to open browser page when server starts. default false
- `feroot` - frontend root for serving static file and building view files. default `.`.
- `i18n` - i18n options including:
- `enabled` - true if i18n is enabled. default `true`.
- `lng` - list of locales. default `['zh-tw']`. mapped to folders under `locales/` directory.
Expand Down
14 changes: 7 additions & 7 deletions bin/lib/server.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions lib/server.ls
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@ server = do
i18n(opt.i18n)
.then (i18n) ~>
@app = app = express!
cwd = process.cwd!
cwd = path.resolve(opt.feroot or '.')

if i18n => app.use i18next-http-middleware.handle i18n, {ignoreRoutes: <[]>}

# we precompile all view pug into .view folder, which can be used by our custom pug view engine.
app.engine 'pug', pug({logger: @log, i18n: i18n, viewdir: '.view', srcdir: 'src/pug', desdir: 'static'})
app.engine 'pug', pug({
logger: @log
i18n: i18n,
viewdir: path.join(cwd, '.view')
srcdir: path.join(cwd, 'src/pug')
desdir: path.join(cwd, 'static')
})
app.set 'view engine', 'pug'
app.set 'views', path.join(cwd, './src/pug/')
app.locals.viewdir = path.join(cwd, './.view/')
app.set 'views', path.join(cwd, 'src/pug/')
app.locals.viewdir = path.join(cwd, '.view/')
app.locals.basedir = app.get \views

if opt.api => opt.api @
app.use \/, express.static \static
app.use \/, express.static path.join(cwd, \static)
@log.info "express initialized in #{app.get \env} mode".green

(res, rej) <~ new Promise _
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"main": "bin/lib/index.js",
"description": "simple, quick template for bootstrap a page",
"version": "2.3.35",
"version": "2.3.36",
"files": [
"bin/**/*"
],
Expand All @@ -21,7 +21,7 @@
"start": "./bin/cli.js -o true"
},
"dependencies": {
"@plotdb/srcbuild": "^0.0.43",
"@plotdb/srcbuild": "^0.0.45",
"@plotdb/colors": "^0.0.1",
"chokidar": "^3.0.0",
"express": "^4.16.4",
Expand Down

0 comments on commit 62db0ce

Please sign in to comment.