Skip to content

Commit 18eab0f

Browse files
committed
Update dependencies and install test harness deps
1 parent 356419f commit 18eab0f

File tree

4 files changed

+57
-33
lines changed

4 files changed

+57
-33
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test/*.conf.js

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"no-shadow-restricted-names": 2,
2727
"handle-callback-err": 0,
2828
"no-lonely-if": 2,
29-
"space-return-throw-case": 2,
29+
"keyword-spacing": 2,
3030
"constructor-super": 2,
3131
"no-this-before-super": 2,
3232
"no-dupe-class-members": 2,

package.json

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
"version": "1.0.3",
44
"description": "Ready-to-go Preact starter project powered by webpack.",
55
"scripts": {
6-
"dev": "NODE_ENV=development webpack-dev-server --inline --progress",
7-
"start": "superstatic build -p ${PORT:-8080} --gzip -c '{\"routes\":{\"**\":\"index.html\"},\"cache_control\":{\"**\":86400}}'",
6+
"dev": "NODE_ENV=development webpack-dev-server --inline --hot --progress",
7+
"start": "superstatic build -p ${PORT:-8080} --host 0.0.0.0 --gzip -c '{\"rewrites\": [{\"source\":\"**\",\"destination\":\"index.html\"}],\"headers\":[{\"source\":\"**\",\"headers\":[{\"key\":\"Cache-Control\",\"value\":\"max-age=86400\"}]}]}'",
88
"prestart": "npm run build",
99
"build": "NODE_ENV=production webpack -p --progress",
1010
"prebuild": "mkdir -p build && ncp src/assets build/assets",
11-
"test": "eslint src tests/**/*.js"
11+
"test": "npm run -s lint && npm run -s test:karma",
12+
"test:karma": "karma start test/karma.conf.js --single-run",
13+
"lint": "eslint {src,test}"
1214
},
1315
"keywords": [
1416
"preact",
@@ -18,43 +20,55 @@
1820
"license": "MIT",
1921
"author": "Jason Miller <[email protected]>",
2022
"devDependencies": {
21-
"autoprefixer": "^6.3.1",
22-
"babel": "^6.3.26",
23-
"babel-core": "^6.4.0",
24-
"babel-eslint": "^5.0.0-beta6",
23+
"autoprefixer": "^6.3.3",
24+
"babel": "^6.5.2",
25+
"babel-core": "^6.7.2",
26+
"babel-eslint": "^5.0.0",
2527
"babel-loader": "^6.2.1",
2628
"babel-plugin-transform-decorators-legacy": "^1.3.4",
27-
"babel-plugin-transform-react-jsx": "^6.4.0",
28-
"babel-preset-es2015": "^6.3.13",
29+
"babel-plugin-transform-react-jsx": "^6.6.5",
30+
"babel-preset-es2015": "^6.6.0",
2931
"babel-preset-es2015-minimal": "^1.0.0",
30-
"babel-preset-stage-0": "^6.3.13",
31-
"babel-register": "^6.4.3",
32-
"babel-runtime": "^6.3.19",
32+
"babel-preset-stage-0": "^6.5.0",
33+
"babel-register": "^6.7.2",
34+
"babel-runtime": "^6.6.1",
3335
"chai": "^3.5.0",
34-
"core-js": "^2.0.3",
36+
"core-js": "^2.2.1",
3537
"css-loader": "^0.23.1",
36-
"eslint": "^1.10.3",
38+
"eslint": "^2.2.0",
3739
"extract-text-webpack-plugin": "^1.0.1",
3840
"file-loader": "^0.8.5",
3941
"html-webpack-plugin": "^1.7.0",
4042
"json-loader": "^0.5.4",
41-
"less": "^2.5.3",
43+
"karma": "^0.13.22",
44+
"karma-chai": "^0.1.0",
45+
"karma-chai-sinon": "^0.1.5",
46+
"karma-mocha": "^0.2.2",
47+
"karma-mocha-reporter": "^2.0.0",
48+
"karma-phantomjs-launcher": "^1.0.0",
49+
"karma-sourcemap-loader": "^0.3.7",
50+
"karma-webpack": "^1.7.0",
51+
"less": "^2.6.1",
4252
"less-loader": "^2.2.2",
53+
"mocha": "^2.4.5",
4354
"ncp": "^2.0.0",
44-
"npm-run-all": "^1.5.1",
45-
"postcss-loader": "^0.8.0",
55+
"phantomjs-prebuilt": "^2.1.6",
56+
"postcss-loader": "^0.8.2",
4657
"raw-loader": "^0.5.1",
58+
"sinon": "^1.17.3",
59+
"sinon-chai": "^2.8.0",
4760
"source-map-loader": "^0.1.5",
48-
"superstatic": "^3.0.0",
61+
"style-loader": "^0.13.0",
62+
"superstatic": "^4.0.2",
4963
"url-loader": "^0.5.7",
50-
"webpack": "^1.12.11",
64+
"webpack": "^1.12.14",
5165
"webpack-dev-server": "^1.14.1"
5266
},
5367
"dependencies": {
5468
"decko": "^1.1.3",
55-
"preact": "^2.8.2",
56-
"preact-compat": "^0.5.0",
57-
"preact-router": "^1.1.0",
58-
"proptypes": "^0.14.1"
69+
"preact": "^4.5.0",
70+
"preact-compat": "^1.6.1",
71+
"preact-router": "^1.3.0",
72+
"proptypes": "^0.14.3"
5973
}
6074
}

webpack.config.babel.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import HtmlWebpackPlugin from 'html-webpack-plugin';
44
import autoprefixer from 'autoprefixer';
55

66
const ENV = process.env.NODE_ENV || 'development';
7+
const CSS_MAPS = ENV!=='production';
78

89
module.exports = {
9-
entry: './src/index.js',
10+
context: `${__dirname}/src`,
11+
entry: './index.js',
1012

1113
output: {
12-
path: './build',
14+
path: `${__dirname}/build`,
1315
publicPath: '/',
1416
filename: 'bundle.js'
1517
},
@@ -46,16 +48,20 @@ module.exports = {
4648
{
4749
test: /\.(less|css)$/,
4850
include: /src\/components\//,
49-
loader: ExtractTextPlugin.extract([
50-
`css?sourceMap&modules&importLoaders=1&localIdentName=[local]${process.env.CSS_MODULES_IDENT || '_[hash:base64:5]'}`,
51+
loader: ExtractTextPlugin.extract('style', [
52+
`css?sourceMap=${CSS_MAPS}&modules&importLoaders=1&localIdentName=[local]${process.env.CSS_MODULES_IDENT || '_[hash:base64:5]'}`,
5153
'postcss',
52-
'less?sourceMap'
54+
`less?sourceMap=${CSS_MAPS}`
5355
].join('!'))
5456
},
5557
{
5658
test: /\.(less|css)$/,
5759
exclude: /src\/components\//,
58-
loader: ExtractTextPlugin.extract('css?sourceMap!postcss!less?sourceMap')
60+
loader: ExtractTextPlugin.extract('style', [
61+
`css?sourceMap=${CSS_MAPS}`,
62+
`postcss`,
63+
`less?sourceMap=${CSS_MAPS}`
64+
].join('!'))
5965
},
6066
{
6167
test: /\.json$/,
@@ -66,8 +72,8 @@ module.exports = {
6672
loader: 'raw'
6773
},
6874
{
69-
test: /\.(svg|woff|ttf|eot)(\?.*)?$/i,
70-
loader: 'file-loader?name=assets/fonts/[name]_[hash:base64:5].[ext]'
75+
test: /\.(svg|woff2?|ttf|eot|jpe?g|png|gif)(\?.*)?$/i,
76+
loader: ENV==='production' ? 'file?name=[path][name]_[hash:base64:5].[ext]' : 'url'
7177
}
7278
]
7379
},
@@ -78,7 +84,10 @@ module.exports = {
7884

7985
plugins: ([
8086
new webpack.NoErrorsPlugin(),
81-
new ExtractTextPlugin('style.css', { allChunks: true }),
87+
new ExtractTextPlugin('style.css', {
88+
allChunks: true,
89+
disabled: ENV!=='production'
90+
}),
8291
new webpack.optimize.DedupePlugin(),
8392
new webpack.DefinePlugin({
8493
'process.env.NODE_ENV': JSON.stringify(ENV)

0 commit comments

Comments
 (0)