-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathconstants.js
118 lines (98 loc) · 4.46 KB
/
constants.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
var path = require('path');
var pkg = require('../../package.json');
var pathToRoot = path.join(__dirname, '../../');
var pathToSrc = path.join(pathToRoot, 'src/');
var pathToLib = path.join(pathToRoot, 'lib/');
var pathToImageTest = path.join(pathToRoot, 'test/image');
var pathToStrictD3Module = path.join(pathToRoot, 'test/strict-d3.js');
var pathToDist = path.join(pathToRoot, 'dist/');
var pathToBuild = path.join(pathToRoot, 'build/');
var pathToTopojsonSrc;
try {
pathToTopojsonSrc = path.join(path.dirname(require.resolve('sane-topojson')), 'dist/');
} catch(e) {
console.log([
'',
'WARN: Cannot resolve path to *sane-topojson* package.',
' This can happen when one `npm link sane-topojson`',
' and runs a command in a Docker container.',
' There is nothing to worry, if you see this warning while running',
' `npm run test-image`, `npm run test-export` or `npm run baseline` ;)',
''
].join('\n'));
}
var partialBundleNames = [
'basic', 'cartesian', 'geo', 'gl3d', 'gl2d', 'mapbox', 'finance', 'strict'
];
var partialBundlePaths = partialBundleNames.map(function(name) {
return {
name: name,
index: path.join(pathToLib, 'index-' + name + '.js'),
dist: path.join(pathToDist, 'plotly-' + name + '.js'),
distMin: path.join(pathToDist, 'plotly-' + name + '.min.js')
};
});
var year = (new Date()).getFullYear();
module.exports = {
pathToRoot: pathToRoot,
pathToSrc: pathToSrc,
pathToLib: pathToLib,
pathToBuild: pathToBuild,
pathToDist: pathToDist,
pathToPlotlyIndex: path.join(pathToLib, 'index.js'),
pathToPlotlyCore: path.join(pathToSrc, 'core.js'),
pathToPlotlyVersion: path.join(pathToSrc, 'version.js'),
pathToPlotlyBuild: path.join(pathToBuild, 'plotly.js'),
pathToPlotlyDist: path.join(pathToDist, 'plotly.js'),
pathToPlotlyDistMin: path.join(pathToDist, 'plotly.min.js'),
pathToPlotlyDistWithMeta: path.join(pathToDist, 'plotly-with-meta.js'),
pathToSchema: path.join(pathToDist, 'plot-schema.json'),
pathToTranslationKeys: path.join(pathToDist, 'translation-keys.txt'),
partialBundleNames: partialBundleNames,
partialBundlePaths: partialBundlePaths,
pathToTopojsonSrc: pathToTopojsonSrc,
pathToTopojsonDist: path.join(pathToDist, 'topojson/'),
pathToPlotlyGeoAssetsSrc: path.join(pathToSrc, 'assets/geo_assets.js'),
pathToPlotlyGeoAssetsDist: path.join(pathToDist, 'plotly-geo-assets.js'),
pathToSCSS: path.join(pathToSrc, 'css/style.scss'),
pathToCSSBuild: path.join(pathToBuild, 'plotcss.js'),
pathToTestDashboardBundle: path.join(pathToBuild, 'test_dashboard-bundle.js'),
pathToImageViewerBundle: path.join(pathToBuild, 'image_viewer-bundle.js'),
pathToImageTest: pathToImageTest,
pathToTestImageMocks: path.join(pathToImageTest, 'mocks/'),
pathToTestImageBaselines: path.join(pathToImageTest, 'baselines/'),
pathToTestImages: path.join(pathToBuild, 'test_images/'),
pathToTestImagesDiff: path.join(pathToBuild, 'test_images_diff/'),
pathToTestImagesDiffList: path.join(pathToBuild, 'list_of_incorrect_images.txt'),
pathToStrictD3Module: pathToStrictD3Module,
pathToJasmineTests: path.join(pathToRoot, 'test/jasmine/tests'),
pathToJasmineBundleTests: path.join(pathToRoot, 'test/jasmine/bundle_tests'),
pathToRequireJS: path.join(pathToRoot, 'node_modules', 'requirejs', 'require.js'),
pathToRequireJSFixture: path.join(pathToBuild, 'requirejs_fixture.js'),
// this mapbox access token is 'public', no need to hide it
// more info: https://www.mapbox.com/help/define-access-token/
mapboxAccessToken: 'pk.eyJ1IjoicGxvdGx5LWpzLXRlc3RzIiwiYSI6ImNrNG9meTJmOTAxa3UzZm10dWdteDQ2eWMifQ.2REjOFyIrleMqwS8H8y1-A',
pathToCredentials: path.join(pathToBuild, 'credentials.json'),
testContainerImage: 'plotly/testbed:latest',
testContainerName: process.env.PLOTLYJS_TEST_CONTAINER_NAME || 'imagetest',
testContainerPort: '9010',
testContainerUrl: 'http://localhost:9010/',
testContainerHome: '/var/www/streambed/image_server/plotly.js',
uglifyOptions: {
ecma: 5,
mangle: true,
output: {
beautify: false,
ascii_only: true
},
sourceMap: false
},
licenseDist: [
'/**',
'* plotly.js v' + pkg.version,
'* Copyright 2012-' + year + ', Plotly, Inc.',
'* All rights reserved.',
'* Licensed under the MIT license',
'*/'
].join('\n'),
};