Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

CI: remove Node 6 and add Node 12 and 14 #509

Merged
merged 6 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ language: node_js
sudo: false

node_js:
- "14"
- "13"
- "12"
- "11"
- "10"
- "8"
- "6"

script:
- npm test
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Test against this versions of Node.js
environment:
matrix:
- nodejs_version: 14
- nodejs_version: 12
- nodejs_version: 10
- nodejs_version: 8
- nodejs_version: 6

# Install scripts. (runs after repo cloning)
install:
Expand Down
21 changes: 20 additions & 1 deletion lib/carto/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ carto.Parser = function Parser(env) {

// Sort rules by specificity: this function expects selectors to be
// split already.
// If the specifity is equal, the definition is compared by the elements
// array. Definitions with more elements are 'larger', and definitions
// with the same number of elements are sorted alphabetically.
// If the elements are also equal, the zoom level of the definition is compared
//
// Written to be used as a .sort(Function);
// argument.
Expand All @@ -256,7 +260,22 @@ carto.Parser = function Parser(env) {
if (as[0] != bs[0]) return bs[0] - as[0];
if (as[1] != bs[1]) return bs[1] - as[1];
if (as[2] != bs[2]) return bs[2] - as[2];
return bs[3] - as[3];
if (bs[3] != as[3]) return bs[3] - as[3];

// The definition with the most elements is 'larger'
if (a.elements.length != b.elements.length) return b.elements.length - a.elements.length;

// Sort based on the alphabetic order of each element
for (var i = 0; i < a.elements.length; i++) {
if (a.elements[i] != b.elements[i]) {
return a.elements[i].value.localeCompare(b.elements[i].value);
}
}

if (a.zoom != b.zoom) return b.zoom - a.zoom;

// Order is not defined
return 0;
};

return root;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"man": "./man/carto.1",
"main": "./lib/carto/index",
"engines": {
"node": ">=0.5.x"
"node": ">=8.0.0"
},
"dependencies": {
"chroma-js": "~1.3.5",
Expand Down
Loading