This repository has been archived by the owner on Oct 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9755f4
commit 617fceb
Showing
5 changed files
with
82 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import "./src/index"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import fs from "fs"; | ||
import babel from "rollup-plugin-babel"; | ||
import eslint from "rollup-plugin-eslint"; | ||
import resolve from "rollup-plugin-node-resolve"; | ||
import commonjs from "rollup-plugin-commonjs"; | ||
|
||
export const pkg = JSON.parse(fs.readFileSync("./package.json")); | ||
const external = Object.keys(pkg.dependencies || {}); | ||
|
||
const globals = {}; | ||
external.forEach(ext => { | ||
switch (ext) { | ||
case "mithril": | ||
globals["mithril"] = "m"; | ||
break; | ||
default: | ||
globals[ext] = ext; | ||
} | ||
}); | ||
|
||
export const createConfig = ({ includeDepencies }) => ({ | ||
entry: "index.js", | ||
external: includeDepencies ? null : external, | ||
globals, | ||
plugins: [ | ||
|
||
// Resolve libs in node_modules | ||
resolve({ | ||
jsnext: true, | ||
main: true, | ||
skip: includeDepencies ? [] : external | ||
}), | ||
|
||
// Convert CommonJS modules to ES6, so they can be included in a Rollup bundle | ||
commonjs({ | ||
include: "node_modules/**" | ||
}), | ||
|
||
eslint({ | ||
cache: true | ||
}), | ||
|
||
babel() | ||
] | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
Build to a module that has ES2015 module syntax but otherwise only syntax features that node supports | ||
https://github.com/rollup/rollup/wiki/jsnext:main | ||
*/ | ||
import { pkg, createConfig } from "./rollup.base.js"; | ||
|
||
const includeDepencies = true; // Use `false` if you are creating a library | ||
|
||
const baseConfig = createConfig({ includeDepencies }); | ||
const targetConfig = Object.assign({}, baseConfig, { | ||
dest: pkg["jsnext:main"], | ||
format: "es" | ||
}); | ||
|
||
export default targetConfig; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
Build to an Universal Module Definition | ||
*/ | ||
import { pkg, createConfig } from "./rollup.base.js"; | ||
import uglify from "rollup-plugin-uglify"; | ||
|
||
const includeDepencies = true; // Use `false` if you are creating a library, or if you are including external script in html | ||
|
||
const baseConfig = createConfig({ includeDepencies }); | ||
const targetConfig = Object.assign({}, baseConfig, { | ||
dest: pkg.main, | ||
format: "umd", | ||
sourceMap: true | ||
}); | ||
|
||
targetConfig.plugins.push(uglify()); | ||
|
||
export default targetConfig; | ||
|