forked from SaxoBank/openapi-clientlib-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup-conf.js
More file actions
61 lines (59 loc) · 1.56 KB
/
rollup-conf.js
File metadata and controls
61 lines (59 loc) · 1.56 KB
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
/*
This task "rolls up" files that have imported each other into a single bundle.
The 'dist' subtask takes the multiple transpiled source files and creates the bundle.
The 'test' subtask merges together spec files with any dependencies so that the tests
do not need requirejs to run.
*/
var packageConfig = require("../package.json");
var sharedConfig = require("./_shared-config");
var fs = require("fs");
var babel = require("rollup-plugin-babel");
// prepare the template. This will provide the banner and footer allowing us greater control
// we could use the format: "umd" but we wouldn't be able to merge the namespaces when used
// without amd
var exportName = sharedConfig.rootNamespace;
var outputParts = fs.readFileSync("grunt/output-template.js", { encoding: 'utf8' })
.replace(/'EXPORT_PLACEHOLDER'/g, exportName)
.replace(/'NS_PLACEHOLDER'/g, sharedConfig.rootNamespace)
.replace("'OUTPUT_NAME'", packageConfig.name)
.replace("'OUTPUT_VERSION'", packageConfig.version)
.split("/*SPLIT PLACEHOLDER FOR ROLLUP*/");
module.exports = {
options: {
sourceMap: true,
sourceMapRelativePaths: true
},
dist: {
options: {
format: "iife",
moduleName: exportName,
banner: outputParts[0],
footer: outputParts[1],
plugins: [
babel()
]
},
files: [
{
src: "src/openapi-package.js",
dest: sharedConfig.releaseFile
}
]
},
test: {
options: {
format: "iife",
plugins: [
babel()
]
},
files: [
{
expand: true,
cwd: 'test',
src: ['**/*-spec.js'],
dest: '.grunt/rolledup-tests'
}
]
}
};