|
1 | 1 | var path = require('path');
|
2 | 2 | var fs = require('fs');
|
3 |
| - |
4 |
| -var prependFile = require('prepend-file'); |
5 | 3 | var falafel = require('falafel');
|
6 | 4 | var glob = require('glob');
|
7 | 5 |
|
8 | 6 | var constants = require('./util/constants');
|
9 | 7 | var common = require('./util/common');
|
10 | 8 |
|
11 |
| -// main |
12 |
| -addHeadersInDistFiles(); |
13 |
| -updateHeadersInSrcFiles(); |
14 |
| - |
15 |
| -// add headers to dist files |
16 |
| -function addHeadersInDistFiles() { |
17 |
| - function _prepend(path, header) { |
18 |
| - prependFile(path, header + '\n', common.throwOnError); |
19 |
| - } |
20 |
| - |
21 |
| - // add header to main dist bundles |
22 |
| - var pathsDist = [ |
23 |
| - constants.pathToPlotlyDistMin, |
24 |
| - constants.pathToPlotlyDist, |
25 |
| - constants.pathToPlotlyDistWithMeta, |
26 |
| - constants.pathToPlotlyGeoAssetsDist |
27 |
| - ]; |
28 |
| - pathsDist.forEach(function(path) { |
29 |
| - _prepend(path, constants.licenseDist); |
30 |
| - }); |
31 |
| - |
32 |
| - // add header and bundle name to partial bundle |
33 |
| - constants.partialBundlePaths.forEach(function(pathObj) { |
34 |
| - var headerDist = constants.licenseDist |
35 |
| - .replace('plotly.js', 'plotly.js (' + pathObj.name + ')'); |
36 |
| - _prepend(pathObj.dist, headerDist); |
37 |
| - |
38 |
| - var headerDistMin = constants.licenseDist |
39 |
| - .replace('plotly.js', 'plotly.js (' + pathObj.name + ' - minified)'); |
40 |
| - _prepend(pathObj.distMin, headerDistMin); |
41 |
| - }); |
42 |
| -} |
43 |
| - |
44 |
| -// add or update header to src/ lib/ files |
45 |
| -function updateHeadersInSrcFiles() { |
| 9 | +function updateHeadersInSrcAndLibFiles() { |
46 | 10 | var srcGlob = path.join(constants.pathToSrc, '**/*.js');
|
47 | 11 | var libGlob = path.join(constants.pathToLib, '**/*.js');
|
48 | 12 |
|
@@ -97,3 +61,5 @@ function updateHeadersInSrcFiles() {
|
97 | 61 | return (header.value.replace(regex, '') === licenseStr.replace(regex, ''));
|
98 | 62 | }
|
99 | 63 | }
|
| 64 | + |
| 65 | +updateHeadersInSrcAndLibFiles(); |
0 commit comments