Skip to content

Commit

Permalink
add a working build-all script and nec. config in each package
Browse files Browse the repository at this point in the history
  • Loading branch information
hpfast committed Jun 19, 2017
1 parent 011ebfe commit 397479d
Show file tree
Hide file tree
Showing 28 changed files with 10,800 additions and 1,915 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Automatically configure BRT Achtergrond map layers in Leaflet, Google Maps and O
* [API Documentation](#api-documentation)
* [Advanced Usage](#advanced-usage)
* [Raw Tile URLS](#raw-tile-urls)
* [Developing](#developing)

## What it's for

Expand Down Expand Up @@ -177,3 +178,11 @@ For BRT-Achtergrondkaart series:
For aerial imagery:

https://geodata.nationaalgeoregister.nl/luchtfoto/rgb/wmts/1.0.0/2016_ortho25/EPSG:3857/{z}/{x}/{y}.png

## Developing
Lerna is used for automating version bumping and stuff. But because of some seeming subtleties of Rollup's interaction with Lerna or NPM, there is a different build script. Use the following procedure to publish the packages:

node build-all.js #can't use npm run or lerna run because rollup can't handle non-externalized dependencies when lerna is symlinking them.
lerna exec npm -- install #I think, to install updated package versions if other packages have changed?
lerna publish #choose version numbers for each changed package
git push
16 changes: 16 additions & 0 deletions build-all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { exec } = require('child_process');

//sanity check for process.argv[2]?
let pkgs = ['nlmaps-leaflet', 'nlmaps-openlayers', 'nlmaps-googlemaps', 'nlmaps'];
for (let i = 0; i < pkgs.length; i++) {
let pkg = pkgs[i];
let bundleName = `${pkg}.iife.js`;
exec(`rollup -c config/rollup.cjs.js && rollup -c config/rollup.es.js && rollup -c config/rollup.iife.js && cp build/${bundleName} ../../dist/`, {cwd: `./packages/${pkg}`}, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
});
}
255 changes: 37 additions & 218 deletions dist/nlmaps-googlemaps.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,60 @@ var bgLayer = (function () {
* copyright (c) 2012, Stamen Design
* under BSD 3-Clause license: https://github.com/stamen/maps.stamen.com/blob/master/LICENSE
*/
const baseurl = 'https://geodata.nationaalgeoregister.nl/tiles/service/wmts/brtachtergrondkaart';
//https://geodata.nationaalgeoregister.nl/tiles/service/wmts/
//https://geodata.nationaalgeoregister.nl/luchtfoto/rgb/wmts/

const lufostring = 'luchtfoto/rgb';
const brtstring = 'tiles/service';
const servicecrs = '/EPSG:3857';
const attr = 'Kaartgegevens &copy; <a href="kadaster.nl">Kadaster</a>';
const SUBDOMAINS = "a. b. c. d.".split(" ");
let makeProvider = function (name, format, minZoom, maxZoom) {
const urlname = mapLayerName(name);
return {
"bare_url": [baseurl, urlname, servicecrs].join(""),
"url": [baseurl, urlname, servicecrs, "/{z}/{x}/{y}.", format].join(""),
"format": format,
"subdomains": SUBDOMAINS.slice(),
"minZoom": minZoom,
"maxZoom": maxZoom,
"attribution": attr,
"name": `BRT Achtergrondkaart ${name}`
};
};
let PROVIDERS = {
"standaard": makeProvider("standaard", "png", 6, 20),
"pastel": makeProvider("pastel", "png", 6, 20),
"grijs": makeProvider("grijs", "png", 6, 20)
};

function baseUrl(name) {
return `https://geodata.nationaalgeoregister.nl/${name === 'luchtfoto' ? lufostring : brtstring}/wmts/`;
}

function mapLayerName(layername) {
let name;
switch (layername) {
case 'standaard':
name = '';
name = 'brtachtergrondkaart';
break;
case 'grijs':
name = 'grijs';
name = 'brtachtergrondkaartgrijs';
break;
case 'pastel':
name = 'pastel';
name = 'brtachtergrondkaartpastel';
break;
case 'luchtfoto':
name = '2016_ortho25';
break;
default:
name = '';
name = 'brtachtergrondkaart';
}
return name;
}

function makeProvider(name, format, minZoom, maxZoom) {
const baseurl = baseUrl(name);
const urlname = mapLayerName(name);
return {
"bare_url": [baseurl, urlname, servicecrs].join(""),
"url": [baseurl, urlname, servicecrs, "/{z}/{x}/{y}.", format].join(""),
"format": format,
"minZoom": minZoom,
"maxZoom": maxZoom,
"attribution": attr,
"name": `${name === 'luchtfoto' ? '' : 'NLMaps '} ${name}`
};
}

const PROVIDERS = {
"standaard": makeProvider("standaard", "png", 6, 20),
"pastel": makeProvider("pastel", "png", 6, 20),
"grijs": makeProvider("grijs", "png", 6, 20),
"luchtfoto": makeProvider("luchtfoto", "png", 6, 20)
};

/*
* * Get the named provider, or throw an exception if it doesn't exist.
* */
Expand All @@ -69,200 +82,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};





var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}

function AsyncGenerator(gen) {
var front, back;

function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};

if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}

function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;

if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
}
} catch (err) {
settle("throw", err);
}
}

function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;

case "throw":
front.reject(value);
break;

default:
front.resolve({
value: value,
done: false
});
break;
}

front = front.next;

if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}

this._invoke = send;

if (typeof gen.return !== "function") {
this.return = undefined;
}
}

if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}

AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};

AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};

AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};

return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
}
};
}();















var get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);

if (desc === undefined) {
var parent = Object.getPrototypeOf(object);

if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;

if (getter === undefined) {
return undefined;
}

return getter.call(receiver);
}
};

















var set = function set(object, property, value, receiver) {
var desc = Object.getOwnPropertyDescriptor(object, property);

if (desc === undefined) {
var parent = Object.getPrototypeOf(object);

if (parent !== null) {
set(parent, property, value, receiver);
}
} else if ("value" in desc && desc.writable) {
desc.value = value;
} else {
var setter = desc.set;

if (setter !== undefined) {
setter.call(receiver, value);
}
}

return value;
};

function bgLayer$1() {
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'standaard';

Expand Down
Loading

0 comments on commit 397479d

Please sign in to comment.