1
0
Fork 0
mirror of https://github.com/seejohnrun/haste-server.git synced 2024-11-22 20:51:21 +00:00

fix pr comments

This commit is contained in:
Yusuf Yilmaz 2022-06-03 11:28:41 +02:00
parent 30c1c486f6
commit ab47249505
6 changed files with 127 additions and 122 deletions

View file

@ -1,3 +1,2 @@
**/*.min.js **/*.min.js
config config
config.js

View file

@ -1,7 +1,7 @@
{ {
"tabWidth": 2, "tabWidth": 2,
"semi": false, "semi": false,
"trailingComma": "all", "trailingComma": "none",
"printWidth": 80, "printWidth": 80,
"arrowParens": "avoid", "arrowParens": "avoid",
"singleQuote": true "singleQuote": true

View file

@ -1,6 +1,6 @@
FROM node:16-slim as base FROM node:16-slim as base
ARG user ARG user node
RUN mkdir /app && chown -R $user:$user /app RUN mkdir /app && chown -R $user:$user /app
USER $user USER $user
WORKDIR /app WORKDIR /app

View file

@ -31,23 +31,24 @@ STDOUT. Check the README there for more details and usages.
1. Download the package, and expand it 1. Download the package, and expand it
3. `yarn install` 3. `yarn install`
## Development ## Running the project
1. Explore the settings inside of config.js, but the defaults should be good > Explore the settings inside of config.js, but the defaults should be good
2. `yarn install`
3. `yarn dev` (you may specify an optional `<config-path>` as well)
## Production ### Development
1. Explore the settings inside of config.js, but the defaults should be good 1. `yarn install`
2. `yarn install` 2. `yarn dev` (you may specify an optional `<config-path>` as well)
3. `yarn build` to build the package
4. `yarn start` to start the server
## Production with Docker ### Production
1. Explore the settings inside of config.js, but the defaults should be good 1. `yarn install`
2. `docker compose up` 2. `yarn build` to build the package
3. `yarn start` to start the server
### Production with Docker
1. `docker compose up`
## Settings ## Settings

View file

@ -20,7 +20,8 @@ if (config.logging) {
addLogging(config) addLogging(config)
} }
buildDocumenthandler(config).then((documentHandler: DocumentHandler) => { buildDocumenthandler(config)
.then((documentHandler: DocumentHandler) => {
// Compress the static javascript assets // Compress the static javascript assets
if (config.recompressStaticAssets) { if (config.recompressStaticAssets) {
const list = fs.readdirSync(getStaticDirectory(__dirname)) const list = fs.readdirSync(getStaticDirectory(__dirname))
@ -30,9 +31,10 @@ buildDocumenthandler(config).then((documentHandler: DocumentHandler) => {
item.indexOf('.js') === item.length - 3 && item.indexOf('.js') === item.length - 3 &&
item.indexOf('.min.js') === -1 item.indexOf('.min.js') === -1
) { ) {
const dest = `${item.substring(0, item.length - 3)}.min${item.substring( const dest = `${item.substring(
0,
item.length - 3, item.length - 3,
)}` )}.min${item.substring(item.length - 3)}`
const origCode = fs.readFileSync( const origCode = fs.readFileSync(
getStaticItemDirectory(__dirname, item), getStaticItemDirectory(__dirname, item),
'utf8', 'utf8',
@ -134,4 +136,7 @@ buildDocumenthandler(config).then((documentHandler: DocumentHandler) => {
app.listen(config.port, config.host, () => { app.listen(config.port, config.host, () => {
winston.info(`listening on ${config.host}:${config.port}`) winston.info(`listening on ${config.host}:${config.port}`)
}) })
}) })
.catch(e => {
winston.error(`server couldn't start, an error occured on ${e.message}`)
})