Skip to content

Commit b8183cd

Browse files
authored
Merge pull request #83 from devraul/master
refactor: automate build with rollup
2 parents 463f642 + b072543 commit b8183cd

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.DS_Store
33
.vscode/
44
node_modules/
5-
yarn.lock
5+
yarn.lock
6+
bin/

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ cache:
99
- ./node_modules
1010
install:
1111
- npm install
12+
- npm run build

bin/docsify renamed to lib/cli.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
#!/usr/bin/env node
2-
3-
"use strict";
1+
const chalk = require("chalk");
2+
const updateNotifier = require("update-notifier");
43

54
const pkg = require("../package.json");
65
const run = require("../lib");
7-
const chalk = require("chalk");
8-
const updateNotifier = require("update-notifier");
96

107
updateNotifier({ pkg: pkg }).notify();
118

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
"docsify": "bin/docsify"
2323
},
2424
"scripts": {
25-
"test": "ava e2e/index.js",
26-
"release": "standard-version"
25+
"test": "ava e2e/index.js",
26+
"release": "standard-version",
27+
"prebuild": "rimraf bin",
28+
"build": "rollup -c",
29+
"prerelease": "npm run build"
2730
},
2831
"files": [
2932
"bin",
@@ -52,6 +55,9 @@
5255
"cors": "^2.8.1",
5356
"eslint": "^6.5.1",
5457
"execa": "^4.0.0",
58+
"rimraf": "^3.0.0",
59+
"rollup": "^1.27.13",
60+
"rollup-plugin-executable": "^1.5.2",
5561
"standard-version": "^7.0.1"
5662
},
5763
"keywords": [

rollup.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import executable from "rollup-plugin-executable";
2+
3+
module.exports = {
4+
input: "lib/cli.js", // Entry file
5+
plugins: [executable()],
6+
output: {
7+
file: "bin/docsify",
8+
format: "cjs", // Compiles to CJS
9+
banner: "#!/usr/bin/env node" // Adds node shebang on top of the file
10+
}
11+
};

0 commit comments

Comments
 (0)