Skip to content

Commit 2abd68f

Browse files
committed
package: add rollup
restructure project
1 parent d1e45cb commit 2abd68f

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
2+
package-lock.json
23

3-
package-lock.json
4+
dist

package.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
"name": "write-npmstat",
33
"version": "0.1.0",
44
"description": "write-npmstat makes it easy to collect, filter and save npm statistics to csv files.",
5-
"main": "writenpmstat.js",
5+
"main": "dist/index.min.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"check-prettier": "prettier -c ./*js",
9-
"prettier": "prettier -w ./*js",
10-
"check-eslint": "eslint ./*js",
11-
"eslint": "eslint --fix ./*js",
8+
"prettier": "prettier -w ./*js ./src/*js",
9+
"eslint": "eslint --fix ./*js ./src/*js",
1210
"format": "npm-run-all prettier eslint",
11+
"rollup": "rollup -c",
12+
"check-prettier": "prettier -c ./*js ./src/*js",
13+
"check-eslint": "eslint ./*js ./src/*js",
1314
"check": "npm-run-all check-prettier check-eslint"
1415
},
1516
"repository": {
@@ -32,13 +33,17 @@
3233
"enum": "^3.0.0"
3334
},
3435
"devDependencies": {
35-
"npm-run-all": "^4.1.0",
36-
"prettier": "^2.6.0",
36+
"npm-run-all": "^4.1.5",
37+
"prettier": "^2.6.2",
3738
"eslint": "^8.14.0",
3839
"eslint-config-standard": "^17.0.0",
3940
"eslint-config-prettier": "^8.5.0",
4041
"eslint-plugin-import": "^2.26.0",
4142
"eslint-plugin-n": "^15.2.0",
42-
"eslint-plugin-promise": "^6.0.0"
43+
"eslint-plugin-promise": "^6.0.0",
44+
"rollup": "^2.70.2",
45+
"@rollup/plugin-commonjs": "^22.0.0",
46+
"rollup-plugin-auto-external": "^2.0.0",
47+
"rollup-plugin-terser": "^7.0.2"
4348
}
4449
}

rollup.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import commonjs from "@rollup/plugin-commonjs";
2+
import autoExternal from "rollup-plugin-auto-external";
3+
import { terser } from "rollup-plugin-terser";
4+
5+
const path = require("path");
6+
7+
export default [
8+
{
9+
input: path.resolve(__dirname, "./src/writenpmstat.js"),
10+
output: {
11+
file: path.resolve(__dirname, "./dist/index.min.js"),
12+
format: "cjs",
13+
exports: "named",
14+
},
15+
plugins: [commonjs(), autoExternal(), terser()],
16+
},
17+
];
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)