Skip to content

Commit 00fabbd

Browse files
author
evilebottnawi
committed
Chore: prepare 0.1.1 release.
1 parent 8a94922 commit 00fabbd

File tree

5 files changed

+83
-31
lines changed

5 files changed

+83
-31
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
This project adheres to [Semantic Versioning](http://semver.org/).
66

7+
# 0.1.1 - 2017-06-07
8+
9+
- Fixed: problems v4.
10+
711
# 0.1.0 - 2017-04-13
812

913
- Added: allow use plugin if `webpack-dev-middleware` or `webpack-hot-middleware` not installed.

lint-staged.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict'; // eslint-disable-line lines-around-directive, strict
2+
3+
module.exports = {
4+
'*.{js,jsx,babel}': ['eslint --fix', 'git add'],
5+
'*.{md,markdown,mdown,mkdn,mkd,mdwn,mkdown,ron}': [
6+
'remark -f -q',
7+
'git add'
8+
]
9+
};

package.json

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "browser-sync-dev-hot-webpack-plugin",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Combines BrowserSync, webpack-dev-middleware, and webpack-hot-middleware into one plugin",
55
"license": "MIT",
66
"author": "itgalaxy <[email protected]>",
@@ -38,14 +38,16 @@
3838
"devDependencies": {
3939
"ajv-cli": "^2.1.0",
4040
"browser-sync":"^2.18.8",
41-
"eslint": "^3.15.0",
42-
"eslint-plugin-ava": "^4.0.0",
41+
"eslint": "^3.17.0",
42+
"eslint-plugin-ava": "^4.2.0",
4343
"eslint-plugin-import": "^2.2.0",
44-
"eslint-plugin-itgalaxy": "^46.0.0",
44+
"eslint-plugin-itgalaxy": "^47.0.0",
4545
"eslint-plugin-jsx-a11y": "^5.0.1",
46-
"eslint-plugin-lodash": "^2.1.0",
47-
"eslint-plugin-node": "^4.0.0",
48-
"eslint-plugin-promise": "^3.3.0",
46+
"eslint-plugin-jest": "^20.0.3",
47+
"eslint-plugin-lodash": "^2.3.0",
48+
"eslint-plugin-node": "^5.0.0",
49+
"eslint-plugin-prettier": "^2.1.1",
50+
"eslint-plugin-promise": "^3.5.0",
4951
"eslint-plugin-react": "^7.0.0",
5052
"eslint-plugin-unicorn": "^2.0.0",
5153
"npmpub": "^3.1.0",
@@ -55,7 +57,10 @@
5557
"remark-preset-lint-itgalaxy": "^6.0.0",
5658
"webpack": "^1 || ^2 || ^2.0.0-beta || ^2.1.0-beta || ^2.2.0-rc.0",
5759
"webpack-dev-middleware": "^1.0.0",
58-
"webpack-hot-middleware": "^2.0.0"
60+
"webpack-hot-middleware": "^2.0.0",
61+
"husky": "~0.13.0",
62+
"lint-staged": "~3.6.0",
63+
"prettier": "^1.4.2"
5964
},
6065
"peerDependencies": {
6166
"browser-sync": "^2.0.0",
@@ -69,6 +74,9 @@
6974
"lint:remark": "remark . -i .gitignore -f -q",
7075
"lint": "npm-run-all -l --parallel lint:*",
7176

77+
"formatter:prettier": "eslint . --fix --ignore-path .gitignore",
78+
"formatter": "npm-run-all -l -p formatter:**",
79+
7280
"test": "npm run lint",
7381

7482
"release": "npmpub"
@@ -82,8 +90,12 @@
8290
},
8391
"extends": [
8492
"plugin:itgalaxy/esnext",
85-
"plugin:itgalaxy/node"
93+
"plugin:itgalaxy/node",
94+
"plugin:itgalaxy/prettier"
8695
],
8796
"root": true
97+
},
98+
"engines": {
99+
"node": ">= 4.3 < 5.0.0 || >= 5.10"
88100
}
89101
}

src/BrowserSyncDevHotWebpackPlugin.js

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
const EventEmitter = require('events');
55
const browserSync = require('browser-sync');
66
const merge = require('deepmerge');
7-
const { desire } = require('./utils');
7+
// eslint-disable-next-line prefer-destructuring
8+
const desire = require('./utils').desire;
89

910
const webpackDevMiddleware = desire('webpack-dev-middleware');
1011
const webpackHotMiddleware = desire('webpack-hot-middleware');
@@ -31,7 +32,9 @@ class BrowserSyncDevHotWebpackPlugin extends EventEmitter {
3132
}
3233

3334
registerEvents() {
34-
this.on('webpack.compilation', () => this.watcher.notify('Rebuilding...'));
35+
this.on('webpack.compilation', () =>
36+
this.watcher.notify('Rebuilding...')
37+
);
3538
this.once('webpack.done', this.start.bind(this));
3639
}
3740

@@ -43,29 +46,40 @@ class BrowserSyncDevHotWebpackPlugin extends EventEmitter {
4346
this.registerEvents();
4447
this.compiler = compiler;
4548

46-
compiler.plugin('compilation', this.emit.bind(this, 'webpack.compilation'));
49+
compiler.plugin(
50+
'compilation',
51+
this.emit.bind(this, 'webpack.compilation')
52+
);
4753
compiler.plugin('done', this.emit.bind(this, 'webpack.done'));
4854
}
4955

5056
setupWebpackDevMiddleware() {
51-
this.webpackDevMiddleware = webpackDevMiddleware(this.compiler, merge.all([
52-
{
53-
publicPath: this.options.publicPath || this.compiler.options.output.publicPath
54-
},
55-
this.compiler.options.devServer || {},
56-
this.options.devMiddleware
57-
]));
57+
this.webpackDevMiddleware = webpackDevMiddleware(
58+
this.compiler,
59+
merge.all([
60+
{
61+
publicPath:
62+
this.options.publicPath ||
63+
this.compiler.options.output.publicPath
64+
},
65+
this.compiler.options.devServer || {},
66+
this.options.devMiddleware
67+
])
68+
);
5869

5970
this.middleware.push(this.webpackDevMiddleware);
6071
}
6172

6273
setupWebpackHotMiddleware() {
63-
this.webpackHotMiddleware = webpackHotMiddleware(this.compiler, merge.all([
64-
{
65-
log: this.watcher.notify.bind(this.watcher)
66-
},
67-
this.options.hotMiddleware
68-
]));
74+
this.webpackHotMiddleware = webpackHotMiddleware(
75+
this.compiler,
76+
merge.all([
77+
{
78+
log: this.watcher.notify.bind(this.watcher)
79+
},
80+
this.options.hotMiddleware
81+
])
82+
);
6983

7084
this.middleware.push(this.webpackHotMiddleware);
7185
}
@@ -81,21 +95,33 @@ class BrowserSyncDevHotWebpackPlugin extends EventEmitter {
8195
proxy: {
8296
middleware: this.middleware,
8397
proxyReq: [
84-
(proxyReq) => {
98+
proxyReq => {
8599
if (this.browserSyncURLLocal) {
86-
proxyReq.setHeader('X-Browser-Sync-URL-Local', this.browserSyncURLLocal);
100+
proxyReq.setHeader(
101+
'X-Browser-Sync-URL-Local',
102+
this.browserSyncURLLocal
103+
);
87104
}
88105

89106
if (this.browserSyncURLExternal) {
90-
proxyReq.setHeader('X-Browser-Sync-URL-External', this.browserSyncURLExternal);
107+
proxyReq.setHeader(
108+
'X-Browser-Sync-URL-External',
109+
this.browserSyncURLExternal
110+
);
91111
}
92112

93113
if (this.browserSyncURLUI) {
94-
proxyReq.setHeader('X-Browser-Sync-URL-UI', this.browserSyncURLUI);
114+
proxyReq.setHeader(
115+
'X-Browser-Sync-URL-UI',
116+
this.browserSyncURLUI
117+
);
95118
}
96119

97120
if (this.browserSyncURLUIExternal) {
98-
proxyReq.setHeader('X-Browser-Sync-URL-UI-External', this.browserSyncURLUIExternal);
121+
proxyReq.setHeader(
122+
'X-Browser-Sync-URL-UI-External',
123+
this.browserSyncURLUIExternal
124+
);
99125
}
100126

101127
if (webpackDevMiddleware) {

src/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
module.exports.desire = (dependency, fallback) => {
44
try {
55
require.resolve(dependency);
6-
} catch (error) { // eslint-disable-line no-unused-vars
6+
// eslint-disable-next-line no-unused-vars
7+
} catch (error) {
78
return fallback;
89
}
910

0 commit comments

Comments
 (0)