-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added cli tooling, improved configurations
- Loading branch information
Showing
33 changed files
with
4,299 additions
and
3,497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/node_modules | ||
/.cert | ||
/.log | ||
/logs | ||
/lib | ||
/storage | ||
/tmp | ||
/coverage | ||
/tests/helpers/unreadable.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env node | ||
const args = require('args'); | ||
const { App } = require('../lib'); | ||
|
||
const serveScriptOptions = (module.exports.serveScriptOptions = [ | ||
{ | ||
name: 'port', | ||
description: 'the port on which the server will be running', | ||
}, | ||
{ | ||
name: 'env', | ||
description: | ||
'The environment the server will be running on. either prod or dev. defaults to dev', | ||
defaultValue: 'dev', | ||
}, | ||
]); | ||
|
||
args.options(serveScriptOptions); | ||
|
||
const run = () => { | ||
const { port, ...config } = args.parse(process.argv); | ||
|
||
const server = new App({ | ||
config, | ||
}); | ||
|
||
return server.listen(port); | ||
}; | ||
|
||
run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env node | ||
const { getEntryPath } = require('@teclone/node-utils'); | ||
const args = require('args'); | ||
const { App } = require('../lib'); | ||
const { resolve } = require('path'); | ||
const { statSync } = require('fs'); | ||
|
||
const startScriptOptions = (module.exports.startScriptOptions = [ | ||
{ | ||
name: 'port', | ||
description: 'the port on which the server will be running', | ||
}, | ||
{ | ||
name: 'entry', | ||
description: | ||
'relative path to the entry file containing your app/server export, defaults to app.js', | ||
defaultValue: 'app.js', | ||
}, | ||
]); | ||
|
||
args.options(startScriptOptions); | ||
|
||
const run = () => { | ||
const { port, entry, ...config } = args.parse(process.argv); | ||
const entryPath = getEntryPath(); | ||
|
||
const entryFilePath = resolve(entryPath, entry); | ||
|
||
try { | ||
const stats = statSync(entryFilePath); | ||
if (stats.isFile()) { | ||
const app = require(entryFilePath); | ||
app.listen(port); | ||
} | ||
} catch (ex) { | ||
console.log(ex); | ||
} | ||
}; | ||
|
||
run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export { App } from './modules/App'; | ||
|
||
export { setErrorCallback } from './modules/Utils'; | ||
|
||
export { Router } from './modules/Router'; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.