building: avoid modification of source

Massimo Melina committed Jan 9, 2022 at 14:18 UTC 7aebb3b9751b1afb13e2882592ff4ad1ccb02c93
4 files changed +8 -4
README.md
+1 -1
@@ -90,7 +90,7 @@ For this reason HFS needs that your accounts file is writable.
90
91 You'll find the output in `dist` folder.
92
93 -Now to run it you should `cd dist` and `node .`
93 +Now you can run it with `node dist`.
94
95 # Plug-ins
96
package.json
+1 -1
@@ -13,7 +13,7 @@
13 "watch-server": "nodemon --ignore tests/ --watch src -e ts,tsx --exec ts-node src/index.ts",
14 "start-frontend": "cd frontend && npm run start",
15 "start": "node dist",
16 - "build": "npm install && node timestamp && tsc --target es2018 && cp package*.json dist && cd dist && npm ci --production && cd .. && npm run build-prune",
16 + "build": "npm install && tsc --target es2018 && node timestamp && cp package*.json dist && cd dist && npm ci --production && cd .. && npm run build-prune",
17 "build-prune": "cd dist/node_modules/yaml/dist && mv doc do_c && cd ../.. && mkdir lodash2 && cp lodash/lodash.min.js lodash2/lodash.js && cp lodash/package.json lodash2 && rm -rf lodash && mv lodash2 lodash && cd .. && nm-prune --force && cd node_modules/yaml/dist && mv do_c doc",
18 "build-all": "rm -rf dist && npm run build && cd frontend && npm install && npm run build && echo COMPLETED",
19 "test": "mocha -r ts-node/register 'tests/**/*.ts'",
timestamp.js
+4 -2
@@ -1,3 +1,5 @@
1 const fs = require('fs')
2 -const FN = 'src/index.ts'
3 -fs.writeFileSync(FN, fs.readFileSync(FN,'utf8').replace(/(BUILD_TIMESTAMP = ")(.*)"/, '$1'+new Date().toISOString()+'"'))
2 +const FN = 'dist/index.js'
3 +fs.writeFileSync(FN,
4 + fs.readFileSync(FN,'utf8')
5 + .replace(/(BUILD_TIMESTAMP = ")(.*)"/, '$1'+new Date().toISOString()+'"'))
todo.md
+2
@@ -1,4 +1,6 @@
1 # To do
2 +- case insensitive usernames
3 +- api to get config
4 - update tests to SRP login
5 - anti-csrf
6 - upload