Skip to content

Commit e89f115

Browse files
author
hirsch88
committed
Merge branch 'release/2.0.0-beta.3'
2 parents 8276ded + a07d866 commit e89f115

File tree

18 files changed

+81
-63
lines changed

18 files changed

+81
-63
lines changed

.env.example

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
#
22
# APPLICATION
33
#
4-
APP_NAME=express-typescript-boilerplate
5-
APP_ENV=local
6-
APP_HOST=http://localhost
7-
APP_URL_PREFIX=/api
4+
APP_NAME="express-typescript-boilerplate"
5+
APP_ENV="local"
6+
APP_HOST="http://localhost"
7+
APP_URL_PREFIX="/api"
88
APP_PORT=3000
99

1010
#
1111
# LOGGING
1212
#
13-
LOG_LEVEL=debug
14-
LOG_ADAPTER=winston
13+
LOG_LEVEL="debug"
14+
LOG_ADAPTER="winston"
1515

1616
#
1717
# API Info
1818
#
1919
API_INFO_ENABLED=true
20-
API_INFO_ROUTE=/info
20+
API_INFO_ROUTE="/info"
2121

2222
#
2323
# Swagger Documentation
2424
#
2525
SWAGGER_ENABLED=true
26-
SWAGGER_ROUTE=/docs
27-
SWAGGER_FILE=/src/api/swagger.json
26+
SWAGGER_ROUTE="/docs"
27+
SWAGGER_FILE="/src/api/swagger.json"
2828

2929
#
3030
# Monitor
3131
#
3232
MONITOR_ENABLED=true
33-
MONITOR_ROUTE=/status
33+
MONITOR_ROUTE="/status"
3434

3535
#
3636
# DATABASE
3737
#
3838
# MySql
39-
DB_CLIENT=mysql
40-
DB_CONNECTION=mysql://root@localhost:3306/my_database
39+
DB_CLIENT="mysql"
40+
DB_CONNECTION="mysql://root@localhost:3306/my_database"
4141

4242
# PostGres
4343
#DB_CLIENT=pg
@@ -46,12 +46,12 @@ DB_CONNECTION=mysql://root@localhost:3306/my_database
4646
# Knex
4747
DB_POOL_MIN=0
4848
DB_POOL_MAX=7
49-
DB_MIGRATION_DIR=./src/database/migrations
50-
DB_MIGRATION_TABLE=version
51-
DB_SEEDS_DIR=./src/database/seeds
49+
DB_MIGRATION_DIR="./src/database/migrations"
50+
DB_MIGRATION_TABLE="version"
51+
DB_SEEDS_DIR="./src/database/seeds"
5252

5353
#
5454
# Auth0
5555
#
56-
# AUTH0_HOST=https://w3tecch.auth0.com
57-
AUTH0_HOST=http://localhost:3333
56+
# AUTH0_HOST="https://w3tecch.auth0.com"
57+
AUTH0_HOST="http://localhost:3333"

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ install:
55
- yarn install
66
scripts:
77
- npm test
8+
- npm run build
89
notifications:
910
email: false

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Express Typescript Boilerplate
2-
[![Dependency Status](https://david-dm.org/w3tecch/express-typescript-boilerplate/status.svg?style=flat)](https://david-dm.org/w3tecch/express-typescript-boilerplate) [![Build Status](https://travis-ci.org/w3tecch/express-typescript-boilerplate.svg?branch=master)](https://travis-ci.org/w3tecch/express-typescript-boilerplate)
2+
[![Dependency Status](https://david-dm.org/w3tecch/express-typescript-boilerplate/status.svg?style=flat)](https://david-dm.org/w3tecch/express-typescript-boilerplate)
3+
[![Build Status](https://travis-ci.org/w3tecch/express-typescript-boilerplate.svg?branch=master)](https://travis-ci.org/w3tecch/express-typescript-boilerplate)
4+
[![Build status](https://ci.appveyor.com/api/projects/status/f8e7jdm8v58hcwpq/branch/master?svg=true&passingText=Windows%20passing&pendingText=Windows%20pending&failingText=Windows%20failing)](https://ci.appveyor.com/project/dweber019/express-typescript-boilerplate/branch/master)
35

46
> A delightful way to building a RESTful API with NodeJs & TypeScript.
57

appveyor.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
environment:
2+
nodejs_version: "7"
3+
4+
install:
5+
- ps: Install-Product node $env:nodejs_version
6+
- yarn install
7+
8+
build_script:
9+
- npm run build
10+
11+
test_script:
12+
- npm test

favicon.ico

1.12 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "express-typescript-boilerplate",
3-
"version": "2.0.0-beta.2",
3+
"version": "2.0.0-beta.3",
44
"description": "A delightful way to building a RESTful API with NodeJs & TypeScript",
55
"main": "src/app.ts",
66
"scripts": {
@@ -34,9 +34,6 @@
3434
"ts-node:fast": "./node_modules/.bin/ts-node -F"
3535
},
3636
"repository": "git+ssh://git@github.com/w3tec/express-typescript-boilerplate.git",
37-
"engines": {
38-
"node": "^7.7.3"
39-
},
4037
"keywords": [
4138
"NodeJS",
4239
"TypeScript",

src/console/UpdateTargetsCommand.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* This script reads all the api files and generate the
66
* needed ioc targets file.
77
*/
8+
import * as path from 'path';
89
import * as _ from 'lodash';
910
import * as glob from 'glob';
1011
import * as handlebars from 'handlebars';
@@ -40,40 +41,40 @@ export class UpdateTargetsCommand extends AbstractCommand {
4041
return json.replace(/\"([^(\")"]+)\":/g, '$1:').replace(/"/g, '\'');
4142
});
4243

43-
const path = __dirname.replace('console', 'constants') + `/${this.targetFile}`;
44-
await existsFile(path, true);
45-
await writeTemplate(this.template, path, context);
44+
const filepath = path.join(__dirname.replace('console', 'constants'), this.targetFile);
45+
await existsFile(filepath, true);
46+
await writeTemplate(this.template, filepath, context);
4647

4748
}
4849

4950
private async getFiles(): Promise<string[]> {
5051
return new Promise<string[]>((resolve, reject) => {
51-
const path = __dirname.replace('console', 'api');
52-
glob(`${path}/**/*.ts`, (err: any, files: string[]) => {
52+
const filepath = path.normalize(__dirname.replace('console', 'api'));
53+
glob(`${path.join(filepath, '**', '*.ts')}`, (err: any, files: string[]) => {
5354
if (err) {
5455
return reject(err);
5556
}
5657
files = files
57-
.map((f) => f.replace(path + '/', ''))
58+
.map(f => path.normalize(f))
59+
.map((f) => f.replace(filepath + path.sep, ''))
5860
.map((f) => f.replace('.ts', ''));
59-
6061
resolve(files);
6162
});
6263
});
6364
}
6465

6566
private divideFilePath(filePath: string): any {
66-
const fs = filePath.split('/');
67+
const fs = filePath.split(path.sep);
6768
const key = fs[0];
6869
fs.splice(0, 1);
6970
return {
7071
key,
71-
path: fs.join('/')
72+
path: fs.join(path.sep)
7273
};
7374
}
7475

7576
private parseFilePath(filePath: string): any {
76-
if (filePath.indexOf('/') !== -1) {
77+
if (filePath.indexOf(path.sep) !== -1) {
7778
const obj = this.divideFilePath(filePath);
7879
return {
7980
[obj.key]: this.parseFilePath(obj.path)

src/console/lib/AbstractMakeCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class AbstractMakeCommand {
7676
return (name: string) => {
7777
let ns = name.split('/');
7878
ns = ns.map((v) => _.camelCase(v));
79-
ns[ns.length - 1] = _.capitalize(ns[ns.length - 1]);
79+
ns[ns.length - 1] = _.upperFirst(ns[ns.length - 1]);
8080
return (ns.join('/')) + prefix + suffix;
8181
};
8282
}

src/console/lib/console.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import * as path from 'path';
1515
import * as commander from 'commander';
1616
import * as figlet from 'figlet';
1717
import * as chalk from 'chalk';
18-
import { isWindows } from './../../core/helpers/Path';
1918

2019
// It also loads the .env file into the 'process.env' variable.
2120
import { config } from 'dotenv';
@@ -39,7 +38,7 @@ figlet('console', (error: any, data: any) => {
3938
.filter(m => m.search(/\/lib/g) <= 0)
4039
.map(m => ({
4140
path: m,
42-
name: m.replace((isWindows() ? __dirname.replace(/\\/g, '/') : __dirname).replace('/lib', ''), '').replace('.ts', '').substring(1)
41+
name: m.replace(__dirname.split(path.sep).join('/').replace('/lib', ''), '').replace('.ts', '').substring(1)
4342
}));
4443

4544
const commands = files.map(f => require(f.path)[f.name]);

src/console/lib/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ export const existsFile = async (filePath: string, stop: boolean = false, isTest
4646
fs.exists(filePath, async (exists) => {
4747

4848
if (exists) {
49-
let fileName = filePath.split('/src/')[1];
49+
let fileName = filePath.split(path.normalize('/src/'))[1];
5050
if (isTest) {
51-
fileName = filePath.split('/test/')[1];
51+
fileName = filePath.split(path.normalize('/test/'))[1];
5252
}
5353
const answer = await prompt([
5454
{
5555
type: 'confirm',
5656
name: 'override',
57-
message: `Override "${isTest ? 'test' : 'src'}/${fileName}"?`,
57+
message: `Override "${path.join(isTest ? 'test' : 'src', fileName)}"?`,
5858
default: true
5959
}
6060
]);

0 commit comments

Comments
 (0)