Skip to content

Commit

Permalink
feat: move webpack to a peer dependency and allow webpack 2 (#46)
Browse files Browse the repository at this point in the history
* test: test against both webpack 1 and webpack 2

* chore: use npm install version

* style: whitespace
  • Loading branch information
mattlewis92 authored and JaKXz committed Jan 5, 2017
1 parent ffbab73 commit fa7ba5a
Show file tree
Hide file tree
Showing 5 changed files with 759 additions and 71 deletions.
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"
},
"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

0 comments on commit fa7ba5a

Please sign in to comment.