-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
40 lines (38 loc) · 1.01 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
import { defineConfig } from "rollup";
import copy from "rollup-plugin-copy";
export default defineConfig({
input: "./oscillation.js",
output: { dir: "build" },
plugins: [
copy({
targets: [
{ src: ["README.md", "LICENSE", "oscillation.d.ts"], dest: "build" },
{ src: "package.json", dest: "build", transform: generatePackageJson },
],
}),
],
});
function generatePackageJson(contents) {
let pkg = JSON.parse(contents.toString());
let newPkg = {
name: pkg.name,
version: pkg.version,
description: pkg.description,
license: pkg.license,
author: pkg.author,
homepage: pkg.homepage,
repository: pkg.repository,
type: "module",
main: "./oscillation.js",
module: "./oscillation.js",
exports: {
".": "./oscillation.js",
},
files: ["*.js", "*.d.ts"],
sideEffects: false,
keywords: pkg.keywords,
dependencies: pkg.dependencies,
peerDependencies: pkg.peerDependencies,
};
return JSON.stringify(newPkg, null, 2);
}