Skip to content

Commit 63b92cd

Browse files
committed
Merge branch 'release/0.3.0'
2 parents ba11e26 + da06371 commit 63b92cd

File tree

6 files changed

+64
-99
lines changed

6 files changed

+64
-99
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ branches:
55

66
language: node_js
77
node_js:
8-
- '6.1'
8+
- '6.7'
99

1010
script: true

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
- [x] [Typescript 2](https://blogs.msdn.microsoft.com/typescript/2016/07/11/announcing-typescript-2-0-beta/)
99
- [x] [Webpack Dashboard](https://github.com/FormidableLabs/webpack-dashboard)
1010
![Imgur](http://i.imgur.com/pETTX85.png)
11+
1112
# Getting started
1213

1314
## Clone Typescript Webpack Starter
15+
1416
```bash
1517
git clone https://github.com/emyann/typescript-webpack-starter.git
1618
cd typescript-webpack-starter
@@ -19,17 +21,25 @@ npm install
1921
```
2022

2123
## Run
22-
Run a Webpack dev server
24+
25+
Start a Webpack dev server
26+
```bash
27+
npm start
28+
```
29+
30+
Start a Webpack server with the production configuration
2331
```bash
24-
npm run server
32+
npm run server:prod
2533
```
2634

35+
2736
## Build Only
2837
Build a development release
2938
```bash
3039
npm run build
3140
```
3241

42+
3343
Build a production release
3444
```bash
3545
npm run build:prod

config/webpack/webpack.prod.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

package.json

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@
44
"description": "A damn simple starter for Typescript and Webpack",
55
"main": "src/index.ts",
66
"scripts": {
7-
"rimraf": "rimraf",
8-
"webpack": "webpack",
9-
"webpack-dev-server": "webpack-dev-server",
10-
"build": "npm run build:dev",
11-
"prebuild:dev": "npm run rimraf -- dist",
12-
"build:dev": "webpack --config config/webpack/webpack.dev.js --progress --profile --color --display-error-details --display-cached",
13-
"prebuild:prod": "npm run rimraf -- dist",
14-
"build:prod": "webpack --config config/webpack/webpack.prod.js --progress --profile --color --display-error-details --display-cached --bail",
7+
"start": "npm run server:dev",
158
"server": "npm run server:dev",
16-
"server:dev": "webpack-dashboard -- webpack-dev-server --config config/webpack/webpack.dev.js --port 3000 --host 0.0.0.0 --hot --inline --progress --profile --watch --content-base dist/",
17-
"test": "echo \"Error: no test specified\" && exit 1",
18-
"postinstall": "typings i"
9+
"server:dev": "webpack-dashboard -- webpack-dev-server --config ./webpack.config.js --port 3000 --host 0.0.0.0 --hot --inline --progress --profile --watch --content-base dist/",
10+
"server:prod": "cross-env NODE_ENV=production webpack-dashboard -- webpack-dev-server --config ./webpack.config.js --port 3000 --host 0.0.0.0 --hot --inline --progress --profile --watch --content-base dist/",
11+
"build": "npm run build:dev",
12+
"build:dev": "webpack --config ./webpack.config.js --progress --profile --color --display-error-details --display-cached",
13+
"build:prod": "cross-env NODE_ENV=production webpack --config ./webpack.config.js --progress --profile --color --display-error-details --display-cached --bail",
14+
"clean": "npm cache clear && rimraf -- dist",
15+
"test": "echo \"Error: no test specified\" && exit 1"
1916
},
2017
"repository": {
2118
"type": "git",
@@ -24,23 +21,25 @@
2421
"author": "yrenaudin",
2522
"license": "ISC",
2623
"devDependencies": {
27-
"css-loader": "^0.25.0",
24+
"@types/lodash": "^4.14.50",
25+
"cross-env": "^3.1.4",
26+
"css-loader": "^0.26.1",
2827
"ejs-loader": "^0.3.0",
28+
"eslint": "^3.14.0",
2929
"expose-loader": "^0.7.1",
3030
"html-loader": "^0.4.4",
31-
"html-webpack-plugin": "^2.22.0",
31+
"html-webpack-plugin": "^2.26.0",
3232
"rimraf": "^2.5.4",
3333
"style-loader": "^0.13.1",
34-
"ts-loader": "^0.8.2",
35-
"tslint": "^3.15.1",
36-
"tslint-loader": "^2.1.5",
37-
"typescript": "^2.0.0",
38-
"typings": "^1.3.3",
34+
"ts-loader": "^2.0.0",
35+
"tslint": "^4.3.1",
36+
"tslint-loader": "^3.3.0",
37+
"typescript": "^2.1.5",
3938
"webpack": "^2.1.0-beta.22",
40-
"webpack-dashboard": "^0.1.8",
41-
"webpack-dev-server": "^1.15.2"
39+
"webpack-dashboard": "^0.2.1",
40+
"webpack-dev-server": "2.2.0"
4241
},
4342
"dependencies": {
44-
"lodash": "^4.15.0"
43+
"lodash": "^4.17.4"
4544
}
46-
}
45+
}

src/index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<!DOCTYPE html>
22
<html lang="">
3+
34
<head>
45
<meta charset="utf-8">
56
<meta http-equiv="x-ua-compatible" content="ie=edge">
67
<meta name="viewport" content="width=device-width, initial-scale=1">
78

8-
<title><%= htmlWebpackPlugin.options.title %></title>
9+
<title>
10+
<%= htmlWebpackPlugin.options.title %>
11+
</title>
912

1013
<meta name="description" content="<%= htmlWebpackPlugin.options.title %>">
1114

1215
</head>
1316

1417
<body>
15-
<div> You have successfully started your Typescript application using Webpack</div>
18+
<div> You have successfully started your Typescript application using Webpack. By <a href="https://twitter.com/renaudin_yann">@renaudin_yann</a> </div>
1619
</body>
20+
1721
</html>

config/webpack/webpack.dev.js renamed to webpack.config.js

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ const webpack = require('webpack');
22
const path = require('path');
33
const HtmlWebpackPlugin = require('html-webpack-plugin');
44
const DashboardPlugin = require('webpack-dashboard/plugin');
5+
const nodeEnv = process.env.NODE_ENV || 'development';
6+
const isProd = nodeEnv === 'production';
57

68
var config = {
7-
devtool: 'cheap-eval-source-map',
9+
devtool: isProd ? 'hidden-source-map' : 'cheap-eval-source-map',
810
context: path.resolve('./src'),
911
entry: {
1012
app: './index.ts',
@@ -19,20 +21,22 @@ var config = {
1921
}
2022
},
2123
module: {
22-
preLoaders: [
23-
{ test: /\.ts$/, exclude: ["node_modules"], loader: "tslint" }
24-
],
25-
loaders: [
26-
{ test: /\.ts$/, exclude: ["node_modules"], loader: 'ts-loader' },
24+
rules: [
25+
{ enforce: 'pre', test: /\.ts$/, exclude: ["node_modules"], loader: 'ts-loader' },
2726
{ test: /\.html$/, loader: "html" },
2827
{ test: /\.css$/, loaders: ['style', 'css'] }
2928
]
3029
},
3130
resolve: {
32-
extensions: ["", ".ts", ".js"],
31+
extensions: [".ts", ".js"],
3332
modules: [path.resolve('./src'), 'node_modules']
3433
},
3534
plugins: [
35+
new webpack.DefinePlugin({
36+
'process.env': { // eslint-disable-line quote-props
37+
NODE_ENV: JSON.stringify(nodeEnv)
38+
}
39+
}),
3640
new HtmlWebpackPlugin({
3741
title: 'Typescript Webpack Starter',
3842
template: '!!ejs-loader!src/index.html'
@@ -43,16 +47,20 @@ var config = {
4347
filename: 'vendor.bundle.js'
4448
}),
4549
new webpack.optimize.UglifyJsPlugin({
46-
compress: {warnings: false},
47-
output: {comments: false},
50+
compress: { warnings: false },
51+
output: { comments: false },
4852
sourceMap: false
4953
}),
50-
new DashboardPlugin()
51-
],
52-
tslint: {
53-
emitErrors: false,
54-
failOnHint: false
55-
},
54+
new DashboardPlugin(),
55+
new webpack.LoaderOptionsPlugin({
56+
options: {
57+
tslint: {
58+
emitErrors: true,
59+
failOnHint: true
60+
}
61+
}
62+
})
63+
]
5664
};
5765

58-
module.exports = config;
66+
module.exports = config;

0 commit comments

Comments
 (0)