Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: automate build with rollup #83

Merged
merged 1 commit into from
Dec 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.DS_Store
.vscode/
node_modules/
yarn.lock
yarn.lock
anikethsaha marked this conversation as resolved.
Show resolved Hide resolved
bin/
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ cache:
- ./node_modules
install:
- npm install
- npm run build
7 changes: 2 additions & 5 deletions bin/docsify → lib/cli.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/usr/bin/env node

"use strict";
const chalk = require("chalk");
const updateNotifier = require("update-notifier");

const pkg = require("../package.json");
const run = require("../lib");
const chalk = require("chalk");
const updateNotifier = require("update-notifier");

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

Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
"docsify": "bin/docsify"
},
"scripts": {
"test": "ava e2e/index.js",
"release": "standard-version"
"test": "ava e2e/index.js",
"release": "standard-version",
anikethsaha marked this conversation as resolved.
Show resolved Hide resolved
"prebuild": "rimraf bin",
"build": "rollup -c",
"prerelease": "npm run build"
},
"files": [
"bin",
Expand Down Expand Up @@ -52,6 +55,9 @@
"cors": "^2.8.1",
"eslint": "^6.5.1",
"execa": "^4.0.0",
"rimraf": "^3.0.0",
"rollup": "^1.27.13",
"rollup-plugin-executable": "^1.5.2",
"standard-version": "^7.0.1"
},
"keywords": [
Expand Down
11 changes: 11 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import executable from "rollup-plugin-executable";

module.exports = {
input: "lib/cli.js", // Entry file
plugins: [executable()],
output: {
file: "bin/docsify",
format: "cjs", // Compiles to CJS
banner: "#!/usr/bin/env node" // Adds node shebang on top of the file
}
};