Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Commit

Permalink
Merge a18e7b4 into e9691fa
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Gawlowski committed Oct 16, 2018
2 parents e9691fa + a18e7b4 commit 601dfd0
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 55 deletions.
32 changes: 16 additions & 16 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "webpacker",
"version": "3.2.0",
"version": "3.3.0",
"description": "Webpack configuration manager",
"main": "webpacker.js",
"bin": {
Expand Down Expand Up @@ -37,41 +37,41 @@
"chokidar": "^2.0.4",
"compression-webpack-plugin": "^1.1.11",
"connect-history-api-fallback": "^1.5.0",
"copy-webpack-plugin": "^4.5.2",
"copy-webpack-plugin": "^4.5.3",
"css-loader": "^1.0.0",
"eslint-plugin-react": "^7.10.0",
"favicons-webpack-plugin": "0.0.9",
"file-loader": "^1.1.11",
"graphql": "^0.13.2",
"graphql-tag": "^2.9.2",
"graphql-tag": "^2.10.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"http-proxy-middleware": "^0.18.0",
"json-stringify-safe": "^5.0.1",
"koa-connect": "^2.0.1",
"lodash": "^4.17.10",
"lodash": "^4.17.11",
"lodash-webpack-plugin": "^0.11.5",
"mini-css-extract-plugin": "^0.4.1",
"node-sass": "^4.9.2",
"optimize-css-assets-webpack-plugin": "^5.0.0",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "^4.9.4",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"postcss-loader": "^2.1.6",
"postcss-will-change-transition": "^1.2.0",
"sass-loader": "^7.0.3",
"sass-loader": "^7.1.0",
"style-loader": "^0.21.0",
"uglifyjs-webpack-plugin": "^1.2.7",
"url-loader": "^1.0.1",
"webpack": "^4.16.2",
"uglifyjs-webpack-plugin": "^1.3.0",
"url-loader": "^1.1.2",
"webapp-webpack-plugin": "^2.3.1",
"webpack": "^4.20.2",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-serve": "^2.0.2",
"ws": "^6.0.0",
"yargs": "^12.0.1"
"ws": "^6.1.0",
"yargs": "^12.0.2"
},
"devDependencies": {
"@webpack-contrib/schema-utils": "^1.0.0-beta.0",
"coveralls": "^3.0.2",
"eslint": "^5.2.0",
"eslint": "^5.7.0",
"eslint-config-warp": "^3.0.0",
"eslint-plugin-jest": "^21.18.0",
"eslint-plugin-jest": "^21.25.1",
"git-cz": "^1.7.1",
"jest-cli": "^23.4.2",
"jest-config": "^23.4.2",
Expand Down
54 changes: 35 additions & 19 deletions plugins/favicon.js
@@ -1,21 +1,37 @@
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const WebappWebpackPlugin = require('webapp-webpack-plugin');
const path = require('path');

module.exports = ({cwd, logo}) => logo ? new FaviconsWebpackPlugin({
logo: path.isAbsolute(logo) ? logo : path.join(cwd, logo),
persistentCache: true,
inject: true,
background: '#fff',
icons: {
android: false,
appleIcon: false,
appleStartup: false,
coast: false,
favicons: true,
firefox: false,
opengraph: false,
twitter: false,
yandex: false,
windows: false
}
}) : null;
const defaultIcons = {
android: false,
appleIcon: false,
appleStartup: false,
coast: false,
favicons: true,
firefox: false,
windows: false,
yandex: false
};

module.exports = ({
cwd,
logo,
background = '#fff',
theme_color = '#fff',
prefix = 'meta/',
icons = {}
}) => logo
? new WebappWebpackPlugin({
logo: path.isAbsolute(logo) ? logo : path.join(cwd, logo),
cache: true,
inject: true,
prefix,
favicons: {
background,
theme_color,
scope: '/',
icons: {
...defaultIcons,
...icons
},
}
}) : null;
41 changes: 21 additions & 20 deletions tests/plugins/favicon.test.js
@@ -1,5 +1,5 @@
const path = require('path');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const WebappWebpackPlugin = require('webapp-webpack-plugin');
const {favicon} = require('../../plugins');

describe('FAVICON plugin', () => {
Expand All @@ -19,30 +19,31 @@ describe('FAVICON plugin', () => {

const expected = {
options: {
background: '#fff',
emitStats: false,
icons: {
android: false,
appleIcon: false,
appleStartup: false,
coast: false,
favicons: true,
firefox: false,
opengraph: false,
twitter: false,
windows: false,
yandex: false
},
inject: true,
logo: path.join(__dirname, 'fakeFolder'),
persistentCache: true,
prefix: 'icons-[hash]/',
statsFilename: 'iconstats-[hash].json'
cache: true,
inject: true,
prefix: 'meta/',
favicons: {
scope: '/',
background: '#fff',
//eslint-disable-next-line camelcase
theme_color: '#fff',
icons: {
android: false,
appleIcon: false,
appleStartup: false,
coast: false,
favicons: true,
firefox: false,
windows: false,
yandex: false
}
}
}
};

expect(faviconPlugin).toEqual(expected);
expect(faviconPlugin).toBeInstanceOf(FaviconsWebpackPlugin);
expect(faviconPlugin).toBeInstanceOf(WebappWebpackPlugin);
});
});
});

0 comments on commit 601dfd0

Please sign in to comment.