Skip to content

Commit

Permalink
docs(rules-build): collapsed all /docs/rules/rulename.md into tarball…
Browse files Browse the repository at this point in the history
… to be included with dist

added new webpack plugin to pack all rules markdown files into a compressed tarball instead of
including full size files.

BREAKING CHANGE: Docs are no longer directly provided as files upon install, rather packed into a
docs.tar.gz archive. In order to save space and download time, we expect most users to use the
online documentation for descriptions of rules so they are compressed rather than readily available
for those whom rather access docs offline.
  • Loading branch information
codejedi365 committed Nov 6, 2021
1 parent 212f3bf commit 0ba2835
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "ESLint rules & globals for TestCafe, from the TestCafe community",
"main": "dist/plugin.min.cjs",
"files": [
"dist/**",
"docs/**"
"dist/**"
],
"repository": {
"type": "git",
Expand Down Expand Up @@ -67,6 +66,7 @@
"eslint-plugin-jest": "^24.5.0",
"eslint-plugin-mdx": "^1.15.1",
"eslint-plugin-prettier": "^4.0.0",
"filemanager-webpack-plugin": "^6.1.7",
"fs-extra": "^10.0.0",
"husky": "^7.0.2",
"is-ci": "^3.0.0",
Expand Down
28 changes: 27 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
*/
// IMPORTS
const { resolve, dirname, basename } = require("path");
const { Z_DEFAULT_COMPRESSION, Z_BEST_SPEED } = require("constants");
const nodeExternals = require("webpack-node-externals");
const FileManagerPlugin = require("filemanager-webpack-plugin");
const thisModule = require("./package.json");

// CONSTANTS
Expand Down Expand Up @@ -41,7 +43,31 @@ function buildConfig() {
type: "commonjs"
}
},
plugins: [],
plugins: [
new FileManagerPlugin({
runOnceInWatchMode: true,
events: {
onEnd: {
archive: [
{
// Bundle all Docs into a compressed tarball to be included in dist/
source: resolve(pkgDir, "docs"),
destination: resolve(outDir, "docs.tar.gz"),
format: "tar",
options: {
gzip: true,
gzipOptions: {
level: isProduction
? Z_DEFAULT_COMPRESSION
: Z_BEST_SPEED
}
}
}
]
}
}
})
],
module: {
rules: [
{
Expand Down

0 comments on commit 0ba2835

Please sign in to comment.