Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move webpack to a peer dependency and allow webpack 2 #46

Merged
merged 6 commits into from
Jan 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,31 @@
],
"homepage": "https://github.com/vieron/stylelint-webpack-plugin#readme",
"peerDependencies": {
"stylelint": "^7.7.0"
"stylelint": "^7.7.0",
"webpack": "^2 || ^2.2.0-rc.0 || ^2.1.0-beta.0 || ^1.13.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather just have ^2.0.0 || ^1.13.2 here... I would think it's better to just "officially" support stable versions. With npm >=3 or yarn you won't get peerDeps installed anyway so you can still choose what version you want.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no breaking changes between webpack 1 and webpack 2's API that would affect this plugin, it's very safe to support the beta versions of webpack, and gets rid of the annoying peer dependency warning on install.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, because the rc and beta versions do not fall under semver technically so they aren't resolved by ^2.0.0? Fair enough.

},
"dependencies": {
"arrify": "^1.0.1",
"chalk": "^1.1.3",
"object-assign": "^4.1.0",
"stylelint": "^7.7.0",
"webpack": "^1.13.2"
"stylelint": "^7.7.0"
},
"devDependencies": {
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"coveralls": "^2.11.14",
"memory-fs": "^0.3.0",
"mocha": "^3.1.0",
"npm-install-version": "^6.0.1",
"nyc": "^8.3.1",
"webpack": "^1.13.2",
"xo": "^0.16.0"
},
"scripts": {
"pretest": "xo",
"test": "nyc mocha",
"test:webpack1": "WEBPACK_VERSION=1 nyc mocha",
"test:webpack2": "WEBPACK_VERSION=beta nyc mocha",
"test": "npm run test:webpack1 && npm run test:webpack2",
"preversion": "npm run test",
"version": "git add -A ."
},
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/pack.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var webpack = require('webpack');
var MemoryFileSystem = require('memory-fs');
var webpack = require('./webpack');

/**
* Basic in memory compiler, promisified
Expand Down
8 changes: 8 additions & 0 deletions test/helpers/webpack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

var niv = require('npm-install-version');

var packageName = 'webpack@' + process.env.WEBPACK_VERSION;
niv.install(packageName);

module.exports = niv.require(packageName);
13 changes: 11 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
'use strict';

var assign = require('object-assign');
var webpack = require('webpack');

var StyleLintPlugin = require('../');
var pack = require('./helpers/pack');
var webpack = require('./helpers/webpack');

var configFilePath = getPath('./.stylelintrc');
var baseConfig = {
debug: false,
output: {
path: getPath('output')
},
Expand All @@ -20,6 +19,16 @@ var baseConfig = {
]
};

if (typeof webpack.LoaderOptionsPlugin === 'undefined') {
baseConfig.debug = false;
} else {
baseConfig.plugins.push(
new webpack.LoaderOptionsPlugin({
debug: false
})
);
}

describe('stylelint-webpack-plugin', function () {
it('works with a simple file', function () {
var config = {
Expand Down
Loading