Skip to content

Commit 9045edd

Browse files
committed
First commit
0 parents  commit 9045edd

19 files changed

+1180
-0
lines changed

.gitignore

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Project build
2+
dist/*
3+
apidoc/*
4+
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
10+
# Node
11+
node_modules/*
12+
typings/*
13+
14+
# JetBrains
15+
.idea
16+
.project
17+
.settings
18+
.idea/*
19+
*.iml
20+
21+
# Windows
22+
Thumbs.db
23+
Desktop.ini
24+
25+
# Mac
26+
.DS_Store
27+
**/.DS_Store
28+
29+
# SVN
30+
.svn
31+
32+
# Runtime data
33+
pids
34+
*.pid
35+
*.seed
36+
37+
# Directory for instrumented libs generated by jscoverage/JSCover
38+
lib-cov
39+
40+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
41+
.grunt
42+
43+
# node-waf configuration
44+
.lock-wscript
45+
46+
# Optional npm cache directory
47+
.npm

.vscode/launch.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "1.0",
3+
"configurations": [
4+
{
5+
"name": "Launch",
6+
"type": "node",
7+
"request": "launch",
8+
"program": "${workspaceRoot}/src/server.ts",
9+
"stopOnEntry": false,
10+
"args": [],
11+
"cwd": "${workspaceRoot}/dist",
12+
"runtimeExecutable": null,
13+
"runtimeArgs": [
14+
"--nolazy"
15+
],
16+
"env": {
17+
"NODE_ENV": "development"
18+
},
19+
"externalConsole": false,
20+
"sourceMaps": true,
21+
"outDir": "${workspaceRoot}/dist"
22+
},
23+
{
24+
"name": "Attach to server",
25+
"type": "node",
26+
"request": "attach",
27+
"port": 41234
28+
}
29+
]
30+
}

.vscode/settings.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
// Configure glob patterns for excluding files and folders.
4+
"files.exclude": {
5+
"/**/.git": true,
6+
"/**/.DS_Store": true,
7+
".svn": true,
8+
"DB": true
9+
},
10+
"tslint.configFile": "./tslint.json"
11+
}

.vscode/tasks.json

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
// Available variables which can be used inside of strings.
2+
// ${workspaceRoot}: the root folder of the team
3+
// ${file}: the current opened file
4+
// ${fileBasename}: the current opened file's basename
5+
// ${fileDirname}: the current opened file's dirname
6+
// ${fileExtname}: the current opened file's extension
7+
// ${cwd}: the current working directory of the spawned process
8+
9+
// A task runner configuration for gulp. Gulp provides a less task
10+
// which compiles less to css.
11+
{
12+
"version": "0.1.0",
13+
"command": "gulp",
14+
"isShellCommand": true,
15+
"tasks": [
16+
{
17+
"taskName": "tsc",
18+
// Make this the default build command.
19+
"isBuildCommand": true,
20+
// Show the output window only if unrecognized errors occur.
21+
"showOutput": "silent",
22+
// Use the standard less compilation problem matcher.
23+
"problemMatcher": "$lessCompile"
24+
}
25+
]
26+
}
27+
28+
// Uncomment the following section to use jake to build a workspace
29+
// cloned from https://github.com/Microsoft/TypeScript.git
30+
/*
31+
{
32+
"version": "0.1.0",
33+
// Task runner is jake
34+
"command": "jake",
35+
// Need to be executed in shell / cmd
36+
"isShellCommand": true,
37+
"showOutput": "silent",
38+
"tasks": [
39+
{
40+
// TS build command is local.
41+
"taskName": "local",
42+
// Make this the default build command.
43+
"isBuildCommand": true,
44+
// Show the output window only if unrecognized errors occur.
45+
"showOutput": "silent",
46+
// Use the redefined Typescript output problem matcher.
47+
"problemMatcher": [
48+
"$tsc"
49+
]
50+
}
51+
]
52+
}
53+
*/
54+
55+
// Uncomment the section below to use msbuild and generate problems
56+
// for csc, cpp, tsc and vb. The configuration assumes that msbuild
57+
// is available on the path and a solution file exists in the
58+
// workspace folder root.
59+
/*
60+
{
61+
"version": "0.1.0",
62+
"command": "msbuild",
63+
"args": [
64+
// Ask msbuild to generate full paths for file names.
65+
"/property:GenerateFullPaths=true"
66+
],
67+
"taskSelector": "/t:",
68+
"showOutput": "silent",
69+
"tasks": [
70+
{
71+
"taskName": "build",
72+
// Show the output window only if unrecognized errors occur.
73+
"showOutput": "silent",
74+
// Use the standard MS compiler pattern to detect errors, warnings
75+
// and infos in the output.
76+
"problemMatcher": "$msCompile"
77+
}
78+
]
79+
}
80+
*/
81+
82+
// Uncomment the following section to use msbuild which compiles Typescript
83+
// and less files.
84+
/*
85+
{
86+
"version": "0.1.0",
87+
"command": "msbuild",
88+
"args": [
89+
// Ask msbuild to generate full paths for file names.
90+
"/property:GenerateFullPaths=true"
91+
],
92+
"taskSelector": "/t:",
93+
"showOutput": "silent",
94+
"tasks": [
95+
{
96+
"taskName": "build",
97+
// Show the output window only if unrecognized errors occur.
98+
"showOutput": "silent",
99+
// Use the standard MS compiler pattern to detect errors, warnings
100+
// and infos in the output.
101+
"problemMatcher": [
102+
"$msCompile",
103+
"$lessCompile"
104+
]
105+
}
106+
]
107+
}
108+
*/
109+
// A task runner example that defines a problemMatcher inline instead of using
110+
// a predefined one.
111+
/*
112+
{
113+
"version": "0.1.0",
114+
"command": "tsc",
115+
"isShellCommand": true,
116+
"args": ["HelloWorld.ts"],
117+
"showOutput": "silent",
118+
"problemMatcher": {
119+
// The problem is owned by the typescript language service. Ensure that the problems
120+
// are merged with problems produced by Visual Studio's language service.
121+
"owner": "typescript",
122+
// The file name for reported problems is relative to the current working directory.
123+
"fileLocation": ["relative", "${cwd}"],
124+
// The actual pattern to match problems in the output.
125+
"pattern": {
126+
// The regular expression. Matches HelloWorld.ts(2,10): error TS2339: Property 'logg' does not exist on type 'Console'.
127+
"regexp": "^([^\\s].*)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$",
128+
// The match group that denotes the file containing the problem.
129+
"file": 1,
130+
// The match group that denotes the problem location.
131+
"location": 2,
132+
// The match group that denotes the problem's severity. Can be omitted.
133+
"severity": 3,
134+
// The match group that denotes the problem code. Can be omitted.
135+
"code": 4,
136+
// The match group that denotes the problem's message.
137+
"message": 5
138+
}
139+
}
140+
}
141+
*/

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Typescript Express Seed
2+
3+
Seed for ExpressJS RESTful api with Typescript

apidoc.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "Typescript Express Seed",
3+
"version": "1.0.0",
4+
"description": "This project is a Seed to ExpressJS/NodeJS in Typescript",
5+
"title": "Seed for Developers",
6+
"url" : "http://localhost:3000",
7+
"sampleUrl": "http://localhost:3000",
8+
"template": {
9+
"forceLanguage": "en",
10+
"withCompare": true,
11+
"withGenerator": true
12+
}
13+
}

gulpfile.js

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
var path = require('path');
2+
var gulp = require('gulp');
3+
var server = require('gulp-develop-server');
4+
var tsc = require('gulp-typescript');
5+
var tslint = require("gulp-tslint");
6+
var lintreporter = require('gulp-tslint-stylish');
7+
var sourcemaps = require('gulp-sourcemaps');
8+
var merge = require('merge2');
9+
var tsconfig = require('./tsconfig.json');
10+
11+
var cwd = process.cwd();
12+
13+
tsconfig.compilerOptions.typescript = require('typescript');
14+
tsconfig.compilerOptions.rootDir = undefined;
15+
tsconfig.compilerOptions.outDir = undefined;
16+
var tsProject = tsc.createProject(tsconfig.compilerOptions);
17+
18+
gulp.task('tsc', function (done) {
19+
var tscFiles = [path.join(cwd,'src/**/*.ts'), path.join(cwd, 'typings/main.d.ts')];
20+
var tsResult = gulp.src(tscFiles)
21+
.pipe(sourcemaps.init())
22+
.pipe(tsc(tsProject));
23+
var stream = tsResult.js
24+
.pipe(sourcemaps.write())
25+
.pipe(gulp.dest(path.join(cwd, 'dist')));
26+
stream.on('end', done);
27+
stream.on('error', done);
28+
});
29+
30+
gulp.task('tslint', function (done) {
31+
var tslintFiles = [path.join(cwd,'src/**/*.ts')];
32+
var stream = gulp.src(tslintFiles)
33+
.pipe(tslint())
34+
//.pipe(tslint.report('verbose'));
35+
.pipe(tslint.report(lintreporter, {
36+
emitError: false,
37+
sort: true,
38+
bell: true
39+
}));
40+
stream.on('end', done);
41+
stream.on('error', done);
42+
});
43+
44+
gulp.task('watch', ['tsc', 'tslint'], function (done) {
45+
var srcFiles = [path.join(cwd,'src/**/*.ts')];
46+
gulp.watch(srcFiles, ['tsc']);
47+
done();
48+
});
49+
50+
// run server
51+
gulp.task('server:start', ['tsc', 'tslint'], function (done) {
52+
process.chdir('dist');
53+
server.listen({
54+
path: 'server.js',
55+
env: {
56+
NODE_ENV: 'production'
57+
}
58+
});
59+
done();
60+
});
61+
62+
gulp.task('server:start:debug', ['tsc', 'tslint'], function (done) {
63+
process.chdir('dist');
64+
server.listen({
65+
path: 'server.js',
66+
env: {
67+
NODE_ENV: 'development'
68+
},
69+
execArgv : ['--debug-brk=41234', '--nolazy']
70+
});
71+
done();
72+
});
73+
74+
gulp.task('server:restart', ['tsc', 'tslint'], function (done) {
75+
console.log('reiniciou');
76+
server.restart();
77+
done();
78+
});
79+
80+
// restart server if app.js changed
81+
gulp.task('serve', ['server:start'], function () {
82+
var srcFiles = [path.join(cwd,'src/**/*.ts')];
83+
gulp.watch(srcFiles, ['server:restart']);
84+
});
85+
86+
gulp.task('serve:debug', ['server:start:debug'], function () {
87+
var srcFiles = [path.join(cwd,'src/**/*.ts')];
88+
gulp.watch(srcFiles, ['server:restart']);
89+
});

package.json

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "typescript-express-seed",
3+
"version": "1.0.0",
4+
"description": "This project is a Seed to ExpressJS/NodeJS in Typescript",
5+
"author": "Carcamano and Bigous",
6+
"license": "MIT",
7+
"scripts": {
8+
"tsc": "gulp tsc",
9+
"watch": "gulp watch",
10+
"lint": "gulp tslint",
11+
"serve": "gulp serve",
12+
"start": "gulp serve",
13+
"debug": "gulp serve:debug",
14+
"postinstall": "typings install"
15+
},
16+
"dependencies": {
17+
"bluebird": "^3.0.5",
18+
"body-parser": "^1.14.1",
19+
"cors": "^2.7.1",
20+
"express": "^4.13.3",
21+
"express-jwt": "^3.3.0",
22+
"jsonwebtoken": "^5.7.0",
23+
"moment": "^2.10.6",
24+
"moment-timezone": "^0.4.1",
25+
"mysql": "^2.10.2",
26+
"source-map-support": "^0.4.0"
27+
},
28+
"engines": {
29+
"node": ">=4.0.0"
30+
},
31+
"devDependencies": {
32+
"d-ts-gen": "^0.2.0",
33+
"gulp": "^3.9.1",
34+
"gulp-develop-server": "^0.5.0",
35+
"gulp-install": "^0.6.0",
36+
"gulp-sourcemaps": "^1.6.0",
37+
"gulp-tslint": "^4.3.0",
38+
"gulp-tslint-stylish": "^1.1.1",
39+
"gulp-typescript": "^2.10.0",
40+
"merge2": "^0.3.6",
41+
"node-es6": "^0.3.1",
42+
"tslint": "^3.5.0",
43+
"typescript": "^1.7.5",
44+
"typings": "^0.6.8"
45+
}
46+
}

0 commit comments

Comments
 (0)