Use locally installed node-pre-gyp if there's no global one. This is necessary to be able to run make outside of npm. Make example executable. Change path to the request include file. Bump mbgl to master.
30 lines
761 B
JavaScript
Executable File
30 lines
761 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
/* jshint node: true, unused: false */
|
|
'use strict';
|
|
|
|
var mbgl = require('..');
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
|
|
var base = path.join(path.dirname(process.mainModule.filename), '../test');
|
|
|
|
var fileSource = new mbgl.FileSource();
|
|
fileSource.request = function(req) {
|
|
fs.readFile(path.join(base, req.url), function(err, data) {
|
|
req.respond(err, { data: data });
|
|
});
|
|
};
|
|
|
|
fileSource.cancel = function(req) {
|
|
};
|
|
|
|
var map = new mbgl.Map(fileSource);
|
|
map.load(require('../test/fixtures/style.json'));
|
|
map.render({}, function(err, image) {
|
|
if (err) throw err;
|
|
mbgl.compressPNG(image, function(err, png) {
|
|
fs.writeFileSync('image.png', png);
|
|
console.warn('Written image.png');
|
|
});
|
|
});
|