-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathrollup.config.js
63 lines (60 loc) · 1.84 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
const typescript = require("@rollup/plugin-typescript");
const nodeResolve = require("@rollup/plugin-node-resolve");
const commonjs = require("@rollup/plugin-commonjs");
const replace = require("@rollup/plugin-replace");
const bannerPlugin = require("rollup-plugin-license");
const path = require("path");
const VERSION = require("./package.json").version;
const banner = [
"surveyjs - SurveyJS PDF library v" + VERSION,
"Copyright (c) 2015-" + new Date().getFullYear() + " Devsoft Baltic OÜ - http://surveyjs.io/",
"License: MIT (http://www.opensource.org/licenses/mit-license.php)"
].join("\n");
const input = { "survey.pdf": path.resolve(__dirname, "./src/entries/pdf.ts") };
module.exports = (options) => {
options = options ?? {};
if(!options.tsconfig) {
options.tsconfig = path.resolve(__dirname, "./tsconfig.fesm.json");
}
if(!options.dir) {
options.dir = path.resolve(__dirname, "./build/fesm");
}
return {
input,
context: "this",
plugins: [
nodeResolve(),
commonjs(),
typescript({ inlineSources: true, sourceMap: true, tsconfig: options.tsconfig, compilerOptions: {
declaration: false,
declarationDir: null
} }),
replace({
preventAssignment: false,
values: {
"process.env.RELEASE_DATE": JSON.stringify(new Date().toISOString().slice(0, 10)),
"process.env.VERSION": JSON.stringify(VERSION),
}
}),
bannerPlugin({
banner: {
content: banner,
commentStyle: "ignored",
}
})
],
external: [
"jspdf",
"survey-core",
],
output: [
{
dir: options.dir,
entryFileNames: "[name].mjs",
format: "esm",
exports: "named",
sourcemap: true,
},
],
};
};