Skip to content

Commit

Permalink
Bundle CLI into single file for faster startup
Browse files Browse the repository at this point in the history
Category: fix
  • Loading branch information
vweevers committed Apr 6, 2024
1 parent 5bac5dc commit ed68927
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ npm-debug.log
node_modules
.idea
dependents/
cli-dist.js
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
27 changes: 27 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -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
}
})
]
}

0 comments on commit ed68927

Please sign in to comment.