forked from biwascheme/biwascheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
67 lines (64 loc) · 1.75 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { readFileSync } from 'fs';
import prettier from "rollup-plugin-prettier";
import { terser } from "rollup-plugin-terser";
import replace from "@rollup/plugin-replace";
import child_process from "child_process";
import package_json from "./package.json"
const banner = `/*
* BiwaScheme __DEVELOPMENT__ - R6RS/R7RS Scheme in JavaScript
*
* Copyright (c) 2007-${new Date().getFullYear()} Yutaka HARA (http://www.biwascheme.org/)
* Licensed under the MIT license.
*/`;
// Use the replace plugin in each configuration to get the version and git
// commit programmatically.
let replaceVersion = () =>
replace({
__DEVELOPMENT__: package_json["version"],
__GIT_COMMIT__: child_process
.execSync("git rev-parse HEAD")
.toString()
.trim(),
});
export default [
{
plugins: [prettier({ parser: "babel" }), replaceVersion()],
input: "src/main-node.js",
output: [
{
file: "release/node_biwascheme.js",
format: "cjs",
name: "BiwaScheme",
strict: false,
},
],
},
{
input: "src/main-browser.js",
plugins: [prettier({ parser: "babel" }), replaceVersion()],
output: [
{
file: "release/biwascheme.js",
format: "iife",
name: "BiwaScheme",
strict: false,
banner: banner + readFileSync("src/deps/jquery.js"),
},
{
file: "release/biwascheme-min.js",
format: "iife",
name: "BiwaScheme",
strict: false,
banner: banner + readFileSync("src/deps/jquery.js"),
plugins: [terser({ output: { comments: /Copyright/ } })],
},
{
file: "release/biwascheme.mjs",
format: "esm",
name: "BiwaScheme",
strict: false,
banner: banner
},
],
},
];