Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Commit

Permalink
Add rollup to build correctly the bin part
Browse files Browse the repository at this point in the history
  • Loading branch information
fabien0102 committed Nov 23, 2018
1 parent d8c51e2 commit 3dd597a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"start": "operational-scripts start",
"example": "parcel example/index.html",
"test": "operational-scripts test",
"build": "operational-scripts build --for npm",
"build": "operational-scripts build --for npm && rollup -c rollup.config.js",
"preversion": "npm run build",
"version": "auto-changelog -p && git add CHANGELOG.md",
"lint": "tslint src/**/*{ts,tsx} --project .",
Expand Down Expand Up @@ -72,7 +72,7 @@
"prettier": "^1.13.5",
"react-dom": "^16.4.2",
"react-testing-library": "^5.0.0",
"rollup": "^0.63.5",
"rollup": "^0.67.3",
"rollup-plugin-typescript2": "^0.16.1",
"ts-jest": "^23.1.4",
"tslint": "^5.10.0",
Expand Down
15 changes: 15 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { readdirSync } = require("fs");

/**
* Rollup configuration to build correctly our scripts (nodejs scripts need to be cjs)
*/
module.exports = readdirSync("lib/bin")
.filter(file => file.endsWith(".js"))
.map(file => ({
input: `lib/bin/${file}`,
output: {
file: `lib/bin/${file}`,
format: "cjs",
banner: "#!/usr/bin/env node",
},
}));
2 changes: 0 additions & 2 deletions src/bin/restful-react.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node

import program from "commander";
import { readFileSync } from "fs";
import { join } from "path";
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7937,9 +7937,9 @@ rollup-pluginutils@2.3.0:
estree-walker "^0.5.2"
micromatch "^2.3.11"

rollup@^0.63.5:
version "0.63.5"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.63.5.tgz#5543eecac9a1b83b7e1be598b5be84c9c0a089db"
rollup@^0.67.3:
version "0.67.3"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.67.3.tgz#55475b1b62c43220c3b4bd7edc5846233932f50b"
dependencies:
"@types/estree" "0.0.39"
"@types/node" "*"
Expand Down

0 comments on commit 3dd597a

Please sign in to comment.