diff --git a/.gitignore b/.gitignore index ae817c2..d13b613 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ npm-debug.log node_modules .idea dependents/ +cli-dist.js diff --git a/package.json b/package.json index 8f4b279..ea23907 100644 --- a/package.json +++ b/package.json @@ -4,16 +4,17 @@ "description": "Markdown Style Guide, with linter and automatic fixer", "author": "Vincent Weevers", "license": "GPL-3.0", - "bin": "cli.js", + "bin": "cli-dist.js", "type": "module", "exports": "./index.js", "scripts": { "test": "standard && depcheck --ignores subarg && node cli.js && tape test/*.js", - "hallmark": "node cli.js fix" + "hallmark": "node cli.js fix", + "pack": "rollup -c" }, "files": [ "CHANGELOG.md", - "cli.js", + "cli-dist.js", "index.js", "lint.js", "USAGE" @@ -62,8 +63,13 @@ "vfile-reporter-shiny": "^1.0.1" }, "devDependencies": { + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-terser": "^0.4.4", "depcheck": "^1.4.2", "git-pull-or-clone": "^2.0.2", + "rollup": "^4.14.0", "standard": "^17.0.0", "tape": "^5.5.3", "tempy": "^3.0.0" diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..9a59a8d --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,27 @@ +import { nodeResolve } from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' +import json from '@rollup/plugin-json' +import terser from '@rollup/plugin-terser' + +export default { + input: 'cli.js', + output: { + file: 'cli-dist.js', + format: 'es' + }, + plugins: [ + commonjs(), + nodeResolve({ + browser: false, + preferBuiltins: true, + exportConditions: ['node'] + }), + json(), + terser({ + module: true, + format: { + comments: false + } + }) + ] +}