-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.js
61 lines (49 loc) · 1.53 KB
/
build.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
const path = require('path');
const { fs, zip } = require('node-build-tools');
const BUILD_DIR = path.join(__dirname, 'build');
const MSTR_WEB_GENERAL_PLUGIN = path.join(
__dirname,
'dist',
'MSTRWeb-plugin.zip'
);
const MSTR_WEB_SEAMLESS_LOGIN_PLUGIN = path.join(
__dirname,
'dist',
'MSTRWeb-plugin-seamless-login.zip'
);
const MSTR_LIBRARY_WEB_ENABLE_ON_SPECIFIC_DOSSIERS = path.join(
__dirname,
'dist',
'MSTR-Library-Web-plugin-enable-on-specific-dossiers.zip'
);
const buildMSTRWebPluginZip = (outputZipFile, sourceJavaScriptFile) => {
console.group('Building MSTRWeb plugin...');
fs.removeSync(outputZipFile);
const wd = path.join(BUILD_DIR, `MSTRWeb-Plugin-${Date.now()}`);
const jsDir = path.join(wd, 'Hyper-SDK', 'javascript');
fs.ensureDirSync(jsDir);
fs.copySync(sourceJavaScriptFile, path.join(jsDir, 'global.js'));
zip(wd, outputZipFile);
console.log(outputZipFile);
console.groupEnd();
};
const build = () => {
console.group('Building MSTRWeb Plugins...');
fs.removeSync(BUILD_DIR);
buildMSTRWebPluginZip(
MSTR_WEB_GENERAL_PLUGIN,
path.join(__dirname, 'src', 'MSTRWeb', 'general', 'global.js')
);
buildMSTRWebPluginZip(
MSTR_WEB_SEAMLESS_LOGIN_PLUGIN,
path.join(__dirname, 'src', 'MSTRWeb', 'seamless-login', 'global.js')
);
buildMSTRWebPluginZip(
MSTR_LIBRARY_WEB_ENABLE_ON_SPECIFIC_DOSSIERS,
path.join(__dirname, 'src', 'MSTRWeb', 'enable-on-specific-dossiers', 'global.js')
);
fs.removeSync(BUILD_DIR);
console.groupEnd();
console.log('Done.');
};
build();