forked from ngageoint/opensphere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vendor-min.js
executable file
·55 lines (46 loc) · 1.35 KB
/
vendor-min.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
#!/usr/bin/env node
'use strict';
const path = require('path');
const {compile} = require('opensphere-build-closure-helper');
const {resolveModulePath} = require('opensphere-build-resolver/utils');
/**
* Path to the tui-editor module.
* @type {string}
*/
const tuiPath = resolveModulePath('@toast-ui/editor', __dirname);
/**
* Resources for tuiEditor
* @type {Array<Object>}
*/
const tuiEditorResources = [
{
source: resolveModulePath('codemirror/lib', __dirname),
scripts: ['codemirror.js']
},
{
source: path.join(tuiPath, 'dist'),
scripts: [
'toastui-editor.js'
]
}
];
/**
* Minify a set of vendor scripts.
* @param {Array<Object>} resources List of scripts to minify.
* @param {string} output The output file.
* @param {string=} opt_optimizationLevel The optimization level.
*/
const vendorMinify = function(resources, output, opt_optimizationLevel = 'SIMPLE_OPTIMIZATIONS') {
// Assemble script paths to include in the compilation.
const fileList = [];
resources.forEach((lib) => {
fileList.push(...lib.scripts.map((script) => path.join(lib.source, script)));
});
compile({
'js': fileList,
'compilation_level': opt_optimizationLevel,
'hide_warnings_for': ['/node_modules/'],
'js_output_file': output
});
};
vendorMinify(tuiEditorResources, 'vendor/os-minified/os-toastui-editor.min.js');