all repos — archive/homestead @ a5c463603d54d55bcca5fdd4e04117a4d027a3e6

My future indieweb platform

feat(cli): accept argument for site directory Add a script at the same time to enable using the test files for manual testing

Alan Pearce
commit

a5c463603d54d55bcca5fdd4e04117a4d027a3e6

parent

d3dfbb13b7037c9382bd8418e475ac4208216f39

1 file changed, 12 insertions(+), 7 deletions(-)

changed files
M src/index.jssrc/index.js
@@ -1,13 +1,18 @@
-'use strict' +"use strict"; -const config = require('./modules/config.js') +const config = require("./modules/config.js"); -const PORT = process.env.PORT || config.server.port +const PORT = process.env.PORT || config.server.port; +const targetDir = process.argv[2]; + +if (targetDir) { + process.chdir(targetDir); +} -const app = require('./app.js') +const app = require("./app.js"); -module.exports = app +module.exports = app; app.listen(PORT, () => { - console.log(`App listening on port ${PORT}`) -}) + console.log(`App listening on port ${PORT}`); +});