Skip to content

Commit 677e7ec

Browse files
committed
create make-schema script
1 parent df2670d commit 677e7ec

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
"custom-bundle": "node tasks/custom_bundle.js",
2525
"bundle": "node tasks/bundle.js",
2626
"extra-bundles": "node tasks/extra_bundles.js",
27+
"make-schema": "node tasks/make_schema.js",
2728
"stats": "node tasks/stats.js",
2829
"find-strings": "node tasks/find_locale_strings.js",
2930
"preprocess": "node tasks/preprocess.js",
30-
"build": "node tasks/empty_dist.js && npm run preprocess && npm run find-strings && npm run bundle && npm run extra-bundles && npm run stats",
31+
"build": "node tasks/empty_dist.js && npm run preprocess && npm run find-strings && npm run bundle && npm run extra-bundles && npm run make-schema && npm run stats",
3132
"cibuild": "node tasks/empty_dist.js && npm run preprocess && node tasks/cibundle.js",
3233
"watch": "node tasks/watch.js",
3334
"lint": "eslint --version && eslint .",

tasks/bundle.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ var prependFile = require('prepend-file');
66
var constants = require('./util/constants');
77
var common = require('./util/common');
88
var _bundle = require('./util/browserify_wrapper');
9-
var makeSchema = require('./make_schema');
109
var wrapLocale = require('./util/wrap_locale');
1110

1211
var header = constants.licenseDist + '\n';
1312
var pathToLib = constants.pathToLib;
1413
var pathToDist = constants.pathToDist;
15-
var pathToSchema = constants.pathToSchema;
1614
var pathToPlotlyDist = constants.pathToPlotlyDist;
1715
var pathToPlotlyIndex = constants.pathToPlotlyIndex;
1816
var pathToPlotlyDistMin = constants.pathToPlotlyDistMin;
@@ -67,15 +65,14 @@ tasks.push(function(done) {
6765
});
6866
});
6967

70-
// Browserify plotly.js with meta and output plot-schema JSON
68+
// Browserify plotly.js with meta
7169
tasks.push(function(done) {
7270
_bundle(pathToPlotlyIndex, pathToPlotlyDistWithMeta, {
7371
standalone: 'Plotly',
7472
noCompress: true
7573
}, function() {
7674
prependFile(pathToPlotlyDistWithMeta, header, common.throwOnError);
7775

78-
makeSchema(pathToPlotlyDistWithMeta, pathToSchema);
7976
done();
8077
});
8178
});

tasks/make_schema.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
var fs = require('fs');
22
var path = require('path');
3+
4+
var constants = require('./util/constants');
35
var plotlyNode = require('./util/plotly_node');
46

5-
module.exports = function makeSchema(plotlyPath, schemaPath) {
7+
function makeSchema(plotlyPath, schemaPath) {
68
var Plotly = plotlyNode(plotlyPath);
79

810
var plotSchema = Plotly.PlotSchema.get();
911
var plotSchemaStr = JSON.stringify(plotSchema, null, 1);
1012
fs.writeFileSync(schemaPath, plotSchemaStr);
1113

1214
console.log('ok ' + path.basename(schemaPath));
13-
};
15+
}
16+
17+
var pathToSchema = constants.pathToSchema;
18+
var pathToPlotlyDistWithMeta = constants.pathToPlotlyDistWithMeta;
19+
20+
// output plot-schema JSON
21+
makeSchema(pathToPlotlyDistWithMeta, pathToSchema);

0 commit comments

Comments
 (0)