From c1d882bae6ba7885cf2541a96ac58a1f8ac78f7e Mon Sep 17 00:00:00 2001 From: Jonathan Ling Date: Wed, 26 Sep 2018 16:06:15 -0400 Subject: [PATCH] Build a better workflow without grunt. --- bin/www | 18 ------------------ package.json | 4 ++-- src/HttpHelper/HttpHelper.ts | 2 +- src/index.ts | 16 ++++++++++++++++ tsconfig.json | 4 ++-- 5 files changed, 21 insertions(+), 23 deletions(-) delete mode 100644 bin/www create mode 100644 src/index.ts diff --git a/bin/www b/bin/www deleted file mode 100644 index d29f3eb..0000000 --- a/bin/www +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env node -"use strict"; - -//module dependencies -var HttpHelper = require("../build/HttpHelper/HttpHelper").default; -var Server = require("../build/Server/Server").default; -var http = require("http"); -var httpServer; -//create http server - -var app = Server.bootstrap().app; -var httpPort = HttpHelper.normalizePort(process.env.PORT, 8080); -app.set("port", httpPort); -httpServer = HttpHelper.createServer({ - app, - httpPort, - debugFunc: (str) => { console.log(str); } -}, true); diff --git a/package.json b/package.json index 910dcd6..3a2cbbe 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "main": "app.js", "scripts": { "build": "tsc -p .", - "dev": "cross-env NODE-ENV=development nodemon ./bin/www", - "start": "node ./bin/www", + "dev": "cross-env NODE-ENV=development nodemon --exec ./node_modules/.bin/ts-node -- ./src/index.ts", + "start": "node ./build/index.js", "test": "ts-mocha -p src/ src/**/*.spec.ts" }, "repository": { diff --git a/src/HttpHelper/HttpHelper.ts b/src/HttpHelper/HttpHelper.ts index 7f5abe2..3cef3e2 100644 --- a/src/HttpHelper/HttpHelper.ts +++ b/src/HttpHelper/HttpHelper.ts @@ -69,7 +69,7 @@ export default class HttpHelper { const bind = typeof addr === "string" ? "pipe " + addr : "port " + addr.port; - debug("Listening on " + bind); + debug("Listening on balls and a half num," + bind); }); // listen on provided ports diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..fc02f4b --- /dev/null +++ b/src/index.ts @@ -0,0 +1,16 @@ +#!/usr/bin/env node +"use strict"; + +// module dependencies +import HttpHelper from "./HttpHelper/HttpHelper"; +import Server from "./Server/Server"; +// create http server + +const app = Server.bootstrap().app; +const httpPort = HttpHelper.normalizePort(process.env.PORT, 8080); +app.set("port", httpPort); +const httpServer = HttpHelper.createServer({ + app, + debugFunc: (str: string) => { console.log(str); }, + httpPort, +}, true); diff --git a/tsconfig.json b/tsconfig.json index 3dc7911..a690f11 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,13 +7,13 @@ "noImplicitAny": true, "moduleResolution": "node", "sourceMap": true, - "outDir": "../build", + "outDir": "./build", "baseUrl": "." }, "exclude": [ "**/*.spec.ts" ], "include": [ - "src/**/*.ts" + "**/*.ts" ] }