From 069b26a702204ec75dddfaf99bd3cdf21f4a1a75 Mon Sep 17 00:00:00 2001 From: Ffloriel Date: Sun, 19 Jan 2020 14:51:14 +0000 Subject: [PATCH 1/3] chores: update README - add versions to the README --- README.md | 26 +++++++++++++------------- packages/postcss-purgecss/README.md | 14 +++++--------- packages/postcss-purgecss/package.json | 2 +- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index cb33623c..12546369 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # PurgeCSS -![David](https://img.shields.io/david/FullHuman/purgecss?style=for-the-badge) -![David](https://img.shields.io/david/dev/FullHuman/purgecss?style=for-the-badge) +![David (path)](https://img.shields.io/david/FullHuman/purgecss?path=packages%2Fpurgecss&style=for-the-badge) +![David (path)](https://img.shields.io/david/dev/FullHuman/purgecss?path=packages%2Fpurgecss&style=for-the-badge) ![Dependabot](https://img.shields.io/badge/dependabot-enabled-%23024ea4?style=for-the-badge) ![npm](https://img.shields.io/npm/v/purgecss?style=for-the-badge) ![npm](https://img.shields.io/npm/dw/purgecss?style=for-the-badge) @@ -74,14 +74,14 @@ const purgeCSSResults = await new Purgecss().purge({ This repository is a monorepo that we manage using [Lerna](https://github.com/lerna/lerna). That means that we actually publish [several packages](/packages) to npm from the same codebase, including: -| Package | Version | Description | -| ------------------------------------------------------------ | ------- | ------------------------------------------- | -| [purgecss](/packages/purgecss) | | The core of PurgeCSS | -| [postcss-purgecss](/packages/postcss-purgecss) | | PostCSS plugin for PurgeCSS | -| [purgecss-webpack-plugin](/packages/purgecss-webpack-plugin) | | Webpack plugin for PurgeCSS | -| [gulp-purgecss](/packages/gulp-purgecss) | | Gulp plugin for PurgeCSS | -| [grunt-purgecss](/packages/grunt-purgecss) | | Grunt plugin for PurgeCSS | -| [purgecss-from-html](/packages/purgecss-from-html) | | Html extractor for PurgeCSS | -| [purgecss-from-js](/packages/purgecss-from-js) | | Js extractor for PurgeCSS | -| [purgecss-from-pug](/packages/purgecss-from-pug) | | Pug extractor for PurgeCSS | -| [purgecss-with-wordpress](/packages/purgecss-with-wordpress) | | Collection of whitelist items for WordPress | +| Package | Version | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | ------------------------------------------- | +| [purgecss](/packages/purgecss) | ![npm](https://img.shields.io/npm/v/purgecss?style=flat-square) | The core of PurgeCSS | +| [postcss-purgecss](/packages/postcss-purgecss) | ![npm (scoped)](https://img.shields.io/npm/v/@fullhuman/postcss-purgecss?style=flat-square) | PostCSS plugin for PurgeCSS | +| [purgecss-webpack-plugin](/packages/purgecss-webpack-plugin) | ![npm](https://img.shields.io/npm/v/purgecss-webpack-plugin?style=flat-square) | Webpack plugin for PurgeCSS | +| [gulp-purgecss](/packages/gulp-purgecss) | ![npm](https://img.shields.io/npm/v/gulp-purgecss?style=flat-square) | Gulp plugin for PurgeCSS | +| [grunt-purgecss](/packages/grunt-purgecss) | ![npm](https://img.shields.io/npm/v/grunt-purgecss?style=flat-square) | Grunt plugin for PurgeCSS | +| [purgecss-from-html](/packages/purgecss-from-html) | ![npm](https://img.shields.io/npm/v/purgecss-from-html?style=flat-square) | Html extractor for PurgeCSS | +| [purgecss-from-js](/packages/purgecss-from-js) | ![npm](https://img.shields.io/npm/v/purgecss-from-js?style=flat-square) | Js extractor for PurgeCSS | +| [purgecss-from-pug](/packages/purgecss-from-pug) | ![npm](https://img.shields.io/npm/v/purgecss-from-pug?style=flat-square) | Pug extractor for PurgeCSS | +| [purgecss-with-wordpress](/packages/purgecss-with-wordpress) | ![npm](https://img.shields.io/npm/v/purgecss-with-wordpress?style=flat-square) | Collection of whitelist items for WordPress | diff --git a/packages/postcss-purgecss/README.md b/packages/postcss-purgecss/README.md index df20b4c4..99c176fd 100644 --- a/packages/postcss-purgecss/README.md +++ b/packages/postcss-purgecss/README.md @@ -1,13 +1,9 @@ # PostCSS Purgecss -[![Build Status](https://travis-ci.org/FullHuman/postcss-purgecss.svg?branch=master)](https://travis-ci.org/FullHuman/postcss-purgecss) -[![CircleCi](https://circleci.com/gh/FullHuman/postcss-purgecss/tree/master.svg?style=shield)]() -[![dependencies Status](https://david-dm.org/fullhuman/postcss-purgecss/status.svg)](https://david-dm.org/fullhuman/postcss-purgecss) -[![devDependencies Status](https://david-dm.org/fullhuman/postcss-purgecss/dev-status.svg)](https://david-dm.org/fullhuman/postcss-purgecss?type=dev) -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2554f9858cb742ed93eb22f49ccec3c3)](https://www.codacy.com/app/FullHuman/postcss-purgecss?utm_source=github.com&utm_medium=referral&utm_content=FullHuman/postcss-purgecss&utm_campaign=Badge_Grade) -[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/2554f9858cb742ed93eb22f49ccec3c3)](https://www.codacy.com/app/FullHuman/postcss-purgecss?utm_source=github.com&utm_medium=referral&utm_content=FullHuman/postcss-purgecss&utm_campaign=Badge_Coverage) -[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) -[![npm](https://img.shields.io/npm/v/postcss-purgecss.svg)](https://www.npmjs.com/package/@fullhuman/postcss-purgecss) -[![license](https://img.shields.io/github/license/fullhuman/postcss-purgecss.svg)]() [![Greenkeeper badge](https://badges.greenkeeper.io/FullHuman/postcss-purgecss.svg)](https://greenkeeper.io/) +![David (path)](https://img.shields.io/david/FullHuman/purgecss?path=packages%2Fpostcss-purgecss&style=for-the-badge) +![Dependabot](https://img.shields.io/badge/dependabot-enabled-%23024ea4?style=for-the-badge) +![npm](https://img.shields.io/npm/v/@fullhuman/postcss-purgecss?style=for-the-badge) +![npm](https://img.shields.io/npm/dw/@fullhuman/postcss-purgecss?style=for-the-badge) +![GitHub](https://img.shields.io/github/license/FullHuman/purgecss?style=for-the-badge) [PostCSS] plugin for PurgeCSS. diff --git a/packages/postcss-purgecss/package.json b/packages/postcss-purgecss/package.json index c3d8935f..2b998bce 100644 --- a/packages/postcss-purgecss/package.json +++ b/packages/postcss-purgecss/package.json @@ -1,5 +1,5 @@ { - "name": "postcss-purgecss", + "name": "@fullhuman/postcss-purgecss", "version": "2.0.3", "description": "PostCSS plugin for PurgeCSS", "author": "FoundrySH ", From a1f09c9551873e828542f970022f32eb91b6da99 Mon Sep 17 00:00:00 2001 From: Ffloriel Date: Sun, 19 Jan 2020 16:43:31 +0000 Subject: [PATCH 2/3] fix: add default options to webpack plugin - add default options, fix webpack plugin has undefined extractors --- .../__tests__/parse.test.js | 72 ------------------- packages/purgecss-webpack-plugin/src/index.ts | 3 +- 2 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 packages/purgecss-webpack-plugin/__tests__/parse.test.js diff --git a/packages/purgecss-webpack-plugin/__tests__/parse.test.js b/packages/purgecss-webpack-plugin/__tests__/parse.test.js deleted file mode 100644 index fd86d467..00000000 --- a/packages/purgecss-webpack-plugin/__tests__/parse.test.js +++ /dev/null @@ -1,72 +0,0 @@ -import { entryPaths, entries, flatten } from './../src/parse' - -describe('Parse entry paths', () => { - it('returns an empty array by default', () => { - expect(entryPaths()).toEqual([]) - }) - - it('returns an object as itself', () => { - const o = { a: ['a', 'b', 'c'] } - expect(entryPaths(o)).toEqual(o) - }) - - it('puts a string inside an array', () => { - const str = 'foobar' - expect(entryPaths(str)).toEqual([str]) - }) -}) - -describe('Flatten entry paths', () => { - it('returns an array as itself', () => { - const a = ['a', 'b', 'c'] - expect(flatten(a)).toEqual(a) - }) - - it('returns an object of arrays as one flat array', () => { - const o = { a: ['a', 'b'], b: ['c', 'd'] } - expect(flatten(o)).toEqual(['a', 'b', 'c', 'd']) - }) -}) - -describe('Parse entries', () => { - it('returns paths if there is no chunk name', () => { - const paths = ['a', 'b', 'c'] - expect(entries(paths)).toEqual(paths) - }) - - it('returns paths if paths are an array already', () => { - const paths = ['a', 'b', 'c'] - expect(entries(paths, 'foobar')).toEqual(paths) - }) - - it('returns chunk paths', () => { - const entryPaths = ['a', 'b', 'c'] - const paths = { - foobar: entryPaths - } - expect(entries(paths, 'foobar')).toEqual(entryPaths) - }) - - it('returns chunk path wrapped in an array', () => { - const entryPaths = 'a' - const paths = { - foobar: entryPaths - } - expect(entries(paths, 'foobar')).toEqual([entryPaths]) - }) - - it('returns an empty array if failed to find entry', () => { - const paths = { - foobar: 'a' - } - expect(entries(paths, 'barbar')).toEqual([]) - }) - - it('returns an empty array if failed to find entry with multiple paths', () => { - const paths = { - foobar: 'a', - barbar: 'b' - } - expect(entries(paths, 'foofoo')).toEqual([]) - }) -}) diff --git a/packages/purgecss-webpack-plugin/src/index.ts b/packages/purgecss-webpack-plugin/src/index.ts index 34af8917..9f7a4fad 100644 --- a/packages/purgecss-webpack-plugin/src/index.ts +++ b/packages/purgecss-webpack-plugin/src/index.ts @@ -1,5 +1,5 @@ import * as fs from "fs"; -import { PurgeCSS } from "purgecss"; +import PurgeCSS, { defaultOptions } from "purgecss"; import { ConcatSource } from "webpack-sources"; import * as search from "./search"; import { UserDefinedOptions, PurgedStats, PurgeAsset } from "./types"; @@ -91,6 +91,7 @@ export default class PurgeCSSPlugin { // Compile through Purgecss and attach to output. // This loses sourcemaps should there be any! const options = { + ...defaultOptions, ...this.options, content: filesToSearch, css: [ From 76218039bf67c608c41fdd29653e858db9fd782d Mon Sep 17 00:00:00 2001 From: Ffloriel Date: Sun, 19 Jan 2020 16:47:23 +0000 Subject: [PATCH 3/3] build: v2.0.4 --- lerna.json | 2 +- packages/postcss-purgecss/package.json | 2 +- packages/purgecss-webpack-plugin/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lerna.json b/lerna.json index a886e6fd..0dc96a84 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "packages": [ "packages/*" ], - "version": "2.0.3" + "version": "2.0.4" } diff --git a/packages/postcss-purgecss/package.json b/packages/postcss-purgecss/package.json index 2b998bce..348f52ea 100644 --- a/packages/postcss-purgecss/package.json +++ b/packages/postcss-purgecss/package.json @@ -1,6 +1,6 @@ { "name": "@fullhuman/postcss-purgecss", - "version": "2.0.3", + "version": "2.0.4", "description": "PostCSS plugin for PurgeCSS", "author": "FoundrySH ", "homepage": "https://github.com/FullHuman/purgecss#readme", diff --git a/packages/purgecss-webpack-plugin/package.json b/packages/purgecss-webpack-plugin/package.json index 3895186e..3ea27f6e 100644 --- a/packages/purgecss-webpack-plugin/package.json +++ b/packages/purgecss-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "purgecss-webpack-plugin", - "version": "2.0.3", + "version": "2.0.4", "description": "PurgeCSS plugin for webpack - Remove unused css", "author": "Ffloriel ", "homepage": "https://purgecss.com",