Skip to content

Commit 691ab9a

Browse files
committed
chore: bundle package with rollup
1 parent e6ecd82 commit 691ab9a

File tree

7 files changed

+172
-17
lines changed

7 files changed

+172
-17
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@
3333
"jsdoc": {
3434
"mode": "typescript"
3535
}
36-
}
36+
},
37+
"ignorePatterns": ["dist"]
3738
}

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- run: npm ci
1616
- run: npm run lint
1717
- run: npm run test
18+
- run: npm run build
1819

1920
publish-npm:
2021
needs: build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
.vscode
55
.nyc_output
66
*.lcov
7+
dist

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
node_modules
33
.idea
44
.vscode
5+
dist

package-lock.json

Lines changed: 131 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@
2828
},
2929
"homepage": "https://github.com/DukeLuo/eslint-plugin-check-file",
3030
"type": "module",
31-
"main": "lib/index.js",
31+
"main": "dist/index.js",
32+
"module": "dist/index.es.js",
33+
"files": [
34+
"dist"
35+
],
3236
"scripts": {
3337
"prepare": "husky install",
38+
"build": "rollup -c",
3439
"lint": "eslint . --ignore-pattern node_modules/",
3540
"lint:fix": "eslint . --fix --ignore-pattern node_modules/",
3641
"test": "nyc mocha --loader=esmock tests --recursive",
@@ -44,6 +49,7 @@
4449
"devDependencies": {
4550
"@commitlint/cli": "^17.6.3",
4651
"@commitlint/config-conventional": "^17.6.3",
52+
"@rollup/plugin-terser": "^0.4.3",
4753
"eslint": "^8.40.0",
4854
"eslint-config-prettier": "8.3.0",
4955
"eslint-plugin-eslint-plugin": "^4.4.1",
@@ -54,15 +60,13 @@
5460
"husky": "^8.0.3",
5561
"mocha": "^10.2.0",
5662
"nyc": "^15.1.0",
57-
"prettier": "2.5.1"
63+
"prettier": "2.5.1",
64+
"rollup": "^3.26.3"
5865
},
5966
"engines": {
6067
"node": "14.x || >= 16"
6168
},
6269
"peerDependencies": {
6370
"eslint": ">=7.28.0"
64-
},
65-
"files": [
66-
"lib"
67-
]
71+
}
6872
}

rollup.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @file Rollup configuration.
3+
* @author Huan Luo
4+
*/
5+
6+
import terser from '@rollup/plugin-terser';
7+
8+
export default {
9+
input: 'lib/index.js',
10+
output: [
11+
{
12+
format: 'cjs',
13+
file: 'dist/index.js',
14+
banner:
15+
'/*! @author Huan Luo <dukeluo@outlook.com> (https://shaiwang.life) */',
16+
},
17+
{
18+
format: 'es',
19+
file: 'dist/index.es.js',
20+
banner:
21+
'/*! @author Huan Luo <dukeluo@outlook.com> (https://shaiwang.life) */',
22+
},
23+
],
24+
plugins: [terser()],
25+
external: ['is-glob', 'micromatch', 'path'],
26+
};

0 commit comments

Comments
 (0)