-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
62 lines (54 loc) · 1.61 KB
/
index.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
/* eslint-env es6 */
'use strict';
const fs = require('fs');
const path = require('path');
const resolver = require('opensphere-build-resolver/utils');
/**
* Directory containing build artifacts generated by `opensphere-build-resolver`.
* @type {string}
*/
const buildDir = '.build';
/**
* Path to the build directory.
* @type {string}
*/
const buildPath = path.join(process.cwd(), buildDir);
/**
* Path to the version file.
* @type {string}
*/
const versionFile = path.join(buildPath, 'version');
/**
* Relative path of the version directory.
* @type {string}
*/
const version = fs.readFileSync(versionFile, 'utf8').trim().replace(/.*\//, '');
// if opensphere isn't linked in node_modules, assume it's a sibling directory
const appPath = resolver.resolveModulePath('opensphere') || path.join(__dirname, '..', 'opensphere');
module.exports = {
appVersion: version,
basePath: __dirname,
appPath: appPath,
distPath: path.join(appPath, 'dist', 'opensphere'),
templates: [{
// add geopackage to main index page
id: 'index',
skip: true,
resources: [{
source: path.join(__dirname, 'src', 'worker'),
target: 'src/worker',
files: ['gpkg.worker.js']
}, {
source: resolver.resolveModulePath('@ngageoint/geopackage/dist'),
target: 'vendor/geopackage',
files: [
'geopackage.min.js',
'sql-wasm.wasm',
'canvaskit/canvaskit.wasm'
]
}]
}],
debugCss: path.relative(__dirname, path.join(buildPath, 'combined.css')),
compiledCss: path.join(version, 'styles', 'opensphere.min.css'),
compiledJs: path.join(version, 'opensphere.min.js')
};