From 75e6be37bb228d1c03e9bbda86d130b3e9450ac4 Mon Sep 17 00:00:00 2001 From: Colloque Tsui Date: Sun, 2 Feb 2020 16:14:47 +0800 Subject: [PATCH] Initial Commit --- .babelrc | 3 +++ .gitignore | 41 +++++++++++++++++++++++++++++++++++++++++ package.json | 30 ++++++++++++++++++++++++++++++ src/index.ts | 5 +++++ tsconfig.json | 17 +++++++++++++++++ 5 files changed, 96 insertions(+) create mode 100644 .babelrc create mode 100644 .gitignore create mode 100644 package.json create mode 100644 src/index.ts create mode 100644 tsconfig.json diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..8aa924d --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@babel/preset-env"] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4afb8ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +*.swp + +pids +logs +results +tmp + +# Build +public/css/main.css + +# Coverage reports +coverage + +# API keys and secrets +.env + +# Dependency directory +node_modules +bower_components + +# Editors +.idea +*.iml + +# OS metadata +.DS_Store +Thumbs.db + +# Ignore built ts files +dist/**/* + +# ignore yarn.lock +yarn.lock \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..0ff7f25 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "typescript-nodejs-template", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "npm run serve", + "build": "npm run npm run build-ts && npm run lint", + "serve": "node dist/index.js", + "watch-node": "nodemon dist/index.js", + "watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run watch-node\"", + "build-ts": "tsc", + "watch-ts": "tsc -w", + "lint": "tsc --noEmit && eslint \"**/*.{js,ts}\" --quiet --fix" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "typescript": "^3.7.3" + }, + "devDependencies": { + "@babel/cli": "^7.7.5", + "@babel/core": "^7.7.5", + "@babel/preset-env": "^7.7.6", + "@types/concurrently": "^4.1.0", + "@types/node-fetch": "^2.5.4", + "concurrently": "^5.0.0" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..d85d17e --- /dev/null +++ b/src/index.ts @@ -0,0 +1,5 @@ +function init(firstName: string, lastName: string) { + return `${firstName} ${lastName}`; +} + +console.log(init('Hello', 'world')); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6d6aeda --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "target": "es6", + "noImplicitAny": true, + "moduleResolution": "node", + "sourceMap": true, + "outDir": "dist", + "baseUrl": ".", + "paths": { + "*": ["node_modules/*", "src/types/*"] + } + }, + "include": ["src/**/*"] +}