Parse examples and build external modules on install
This commit is contained in:
1
build.py
1
build.py
@@ -270,6 +270,7 @@ def examples_star_json(name, match):
|
|||||||
"exports": [],
|
"exports": [],
|
||||||
"src": [
|
"src": [
|
||||||
"src/**/*.js",
|
"src/**/*.js",
|
||||||
|
"build/ol.ext/*.js",
|
||||||
"examples/%(id)s.js" % match.groupdict()],
|
"examples/%(id)s.js" % match.groupdict()],
|
||||||
"compile": {
|
"compile": {
|
||||||
"js": [
|
"js": [
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"exports": [],
|
"exports": [],
|
||||||
"src": [
|
"src": [
|
||||||
"src/**/*.js",
|
"src/**/*.js",
|
||||||
|
"build/ol.ext/*.js",
|
||||||
"build/examples/all.js"
|
"build/examples/all.js"
|
||||||
],
|
],
|
||||||
"compile": {
|
"compile": {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
],
|
],
|
||||||
"homepage": "http://openlayers.org/",
|
"homepage": "http://openlayers.org/",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"install": "node tasks/parse-examples.js",
|
"install": "node tasks/install.js",
|
||||||
"postinstall": "closure-util update",
|
"postinstall": "closure-util update",
|
||||||
"start": "node tasks/serve.js",
|
"start": "node tasks/serve.js",
|
||||||
"test": "node tasks/test.js"
|
"test": "node tasks/test.js"
|
||||||
|
|||||||
@@ -71,9 +71,17 @@ function buildModules(modules, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (require.main === module) {
|
/**
|
||||||
|
* Build all external modules.
|
||||||
|
* @param {function(Error)} callback Called with any error.
|
||||||
|
*/
|
||||||
|
function main(callback) {
|
||||||
var modules = getExternalModules();
|
var modules = getExternalModules();
|
||||||
buildModules(modules, function(err) {
|
buildModules(modules, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
main(function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
process.stderr.write(err.message + '\n');
|
process.stderr.write(err.message + '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@@ -82,3 +90,5 @@ if (require.main === module) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = main;
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ function getDependencies(config, exports, callback) {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
options = {
|
options = {
|
||||||
lib: ['src/**/*.js'],
|
lib: ['src/**/*.js', 'build/ol.ext/*.js'],
|
||||||
cwd: root
|
cwd: root
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
17
tasks/install.js
Normal file
17
tasks/install.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
var async = require('async');
|
||||||
|
|
||||||
|
var buildExt = require('./build-ext');
|
||||||
|
var parseExamples = require('./parse-examples');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse examples and build external modules.
|
||||||
|
*/
|
||||||
|
async.waterfall([
|
||||||
|
parseExamples,
|
||||||
|
buildExt
|
||||||
|
], function(err) {
|
||||||
|
if (err) {
|
||||||
|
process.stderr.write(err + '\n');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -137,14 +137,25 @@ function writeExampleList(exampleInfos, callback) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List examples, parse them, and write example list.
|
* List examples, parse them, and write example list.
|
||||||
|
* @param {function(Error)} callback Called with any error.
|
||||||
*/
|
*/
|
||||||
|
function main(callback) {
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
listExamples,
|
listExamples,
|
||||||
parseExamples,
|
parseExamples,
|
||||||
writeExampleList
|
writeExampleList
|
||||||
], function(err) {
|
], callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
main(function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
process.stderr.write(err + '\n');
|
process.stderr.write(err.message + '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
} else {
|
||||||
|
process.exit(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = main;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ var createServer = exports.createServer = function(callback) {
|
|||||||
var manager = new closure.Manager({
|
var manager = new closure.Manager({
|
||||||
lib: [
|
lib: [
|
||||||
'src/**/*.js',
|
'src/**/*.js',
|
||||||
|
'build/ol.ext/*.js',
|
||||||
'test/spec/**/*.test.js'
|
'test/spec/**/*.test.js'
|
||||||
],
|
],
|
||||||
main: 'examples/*.js'
|
main: 'examples/*.js'
|
||||||
|
|||||||
Reference in New Issue
Block a user