diff --git a/.gitignore b/.gitignore index ddeef2ef..08adc10c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ redis.pid *.log coverage/ .DS_Store +.nyc_output diff --git a/.travis.yml b/.travis.yml index 14d56ff1..72424902 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ env: services: - docker before_install: docker pull ${DOCKER_IMAGE} -script: npm run docker-test -- ${DOCKER_IMAGE} ${NODE_VERSION} +script: npm run test:docker diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 6c4e4161..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,11 +0,0 @@ -Contributing ---- - -The issue tracker is at [github.com/CartoDB/Windshaft-cartodb](https://github.com/CartoDB/Windshaft-cartodb). - -We love pull requests from everyone, see [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/#contributing). - - -## Submitting Contributions - -* You will need to sign a Contributor License Agreement (CLA) before making a submission. [Learn more here](https://carto.com/contributions). diff --git a/HOWTO_RELEASE b/HOWTO_RELEASE deleted file mode 100644 index 0a398d01..00000000 --- a/HOWTO_RELEASE +++ /dev/null @@ -1,18 +0,0 @@ -1. Test (make clean all check), fix if broken before proceeding -2. Ensure proper version in package.json and package-lock.json -3. Ensure NEWS section exists for the new version, review it, add release date -4. If there are modified dependencies in package.json, update them with `npm upgrade {{package_name}}@{{version}}` -5. Commit package.json, package-lock.json, NEWS -6. git tag -a Major.Minor.Patch # use NEWS section as content -7. Stub NEWS/package for next version - -Versions: - -Bugfix releases increment Patch component of version. -Feature releases increment Minor and set Patch to zero. -If backward compatibility is broken, increment Major and -set to zero Minor and Patch. - -Branches named 'b.' are kept for any critical -fix that might need to be shipped before next feature release -is ready. diff --git a/HOW_TO_RELEASE.md b/HOW_TO_RELEASE.md new file mode 100644 index 00000000..df017f17 --- /dev/null +++ b/HOW_TO_RELEASE.md @@ -0,0 +1,16 @@ +How to release: + +1. Test (npm test), fix if broken before proceeding. +2. Ensure proper version in `package.json` and `package-lock.json`. +3. Ensure NEWS section exists for the new version, review it, add release date. +4. If there are modified dependencies in `package.json`, update them with `npm upgrade {{package_name}}@{{version}}`. +5. Commit `package.json`, `package-lock.json`, NEWS. +6. Run `git tag -a Major.Minor.Patch`. Use NEWS section as content. +7. Stub NEWS/package for next version. + +Versions: + +* Bugfix releases increment Patch component of version. +* Feature releases increment Minor and set Patch to zero. +* If backward compatibility is broken, increment Major and set to zero Minor and Patch. +* Branches named 'b.' are kept for any critical fix that might need to be shipped before next feature release is ready. diff --git a/INSTALL.md b/INSTALL.md deleted file mode 100644 index f5102f3b..00000000 --- a/INSTALL.md +++ /dev/null @@ -1,41 +0,0 @@ -# Installing Windshaft-CartoDB - -## Requirements - -Make sure that you have the requirements needed. These are: - -- Node 10.x -- npm 6.x -- PostgreSQL >= 10.0 -- PostGIS >= 2.4 -- CARTO Postgres Extension >= 0.24.1 -- Redis >= 4 -- libcairo2-dev, libpango1.0-dev, libjpeg8-dev and libgif-dev for server side canvas support -- C++11 (to build internal dependencies if needed) - -### Optional - -- Varnish (http://www.varnish-cache.org) - -## PostGIS setup - -A `template_postgis` database is expected. One can be set up with - -```shell -createdb --owner postgres --template template0 template_postgis -psql -d template_postgis -c 'CREATE EXTENSION postgis;' -``` - -## Build/install - -To fetch and build all node-based dependencies, run: - -```shell -npm install -``` - -Note that the ```npm``` step will populate the node_modules/ -directory with modules, some of which being compiled on demand. If you -happen to have startup errors you may need to force rebuilding those -modules. At any time just wipe out the node_modules/ directory and run -```npm``` again. diff --git a/Makefile b/Makefile deleted file mode 100644 index 23554888..00000000 --- a/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -SHELL=/bin/bash - -pre-install: - @$(SHELL) ./scripts/check-node-canvas.sh - -all: - @$(SHELL) ./scripts/install.sh - -clean: - rm -rf node_modules/ - -distclean: clean - rm config.status* - -config.status--test: - ./configure --environment=test - -config/environments/test.js: config.status--test - ./config.status--test - -TEST_SUITE := $(shell find test/{acceptance,integration,unit} -name "*.js") -TEST_SUITE_UNIT := $(shell find test/unit -name "*.js") -TEST_SUITE_INTEGRATION := $(shell find test/integration -name "*.js") -TEST_SUITE_ACCEPTANCE := $(shell find test/acceptance -name "*.js") - -test: config/environments/test.js - @echo "***tests***" - @$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE) - -test-unit: config/environments/test.js - @echo "***tests***" - @$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE_UNIT) - -test-integration: config/environments/test.js - @echo "***tests***" - @$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE_INTEGRATION) - -test-acceptance: config/environments/test.js - @echo "***tests***" - @$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE_ACCEPTANCE) - -lint: - @echo "***eslint***" - @./node_modules/.bin/eslint app.js "lib/**/*.js" "test/**/*.js" - -test-all: test lint - -coverage: - @RUNTESTFLAGS=--with-coverage make test - -check: test - -.PHONY: pre-install test lint coverage diff --git a/NEWS.md b/NEWS.md index 138a4c66..fb37082e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,11 +1,22 @@ # Changelog -## 8.0.1 +## 8.1.0 Released 2019-mm-dd Announcements: - Removed `jshint` as linter in favour of `eslint` to check syntax, find problems, and enforce code style. - Upgrade `camshaft` to [`0.65.0`](https://github.com/CartoDB/camshaft/blob/9e8e5cd09dbfc6886c40f3f4a356fb7f235e82be/CHANGELOG.md#0650): Use quoted identifiers for column names. +- Stop using two different tools for package management, testing, and any other developer workflow. + - Removes Makefile and related bash scripts + - Use npm scripts as the only tool for testing, CI and linting. + - Simplified CI configuration. +- Improved documentation: + - Centralized several documents into README.md + - Remove outdated sections + - Update old sections + - Added missing sections. +- Remove deprecated coverage tool istanbul, using nyc instead. +- Removed unused dockerfiles ## 8.0.0 Released 2019-11-13 diff --git a/README.md b/README.md index f6f0bdde..a0cd75cd 100644 --- a/README.md +++ b/README.md @@ -1,80 +1,126 @@ -Windshaft-CartoDB -================== +# Windshaft-CartoDB [![Build Status](https://travis-ci.org/CartoDB/Windshaft-cartodb.svg?branch=master)](https://travis-ci.org/CartoDB/Windshaft-cartodb) -[![Build Status](https://travis-ci.org/CartoDB/Windshaft-cartodb.svg?branch=master)](https://travis-ci.org/CartoDB/Windshaft-cartodb) +The [`CARTO Maps API`](http://docs.cartodb.com/cartodb-platform/maps-api.html) tiler. It extends [`Windshaft`](https://github.com/CartoDB/Windshaft) and exposes a web service with extra functionality: -This is the [CartoDB Maps API](http://docs.cartodb.com/cartodb-platform/maps-api.html) tiler. It extends -[Windshaft](https://github.com/CartoDB/Windshaft) with some extra functionality and custom filters for authentication. +* Instantiate [`Anonymous Maps`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/03-anonymous-maps.md) through CARTO's map configuration ([`MapConfig`](https://github.com/CartoDB/Windshaft/blob/master/doc/MapConfig-specification.md)). +* Create [`Named Maps`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/04-named-maps.md) based on customizable templates. +* Get map previews through [`Static Maps`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/05-static-maps-API.md) API. +* Render maps with a large amount of data faster using [`Tile Aggregation`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/06-tile-aggregation.md). +* Build advanced maps with enriched data through [`Analyses Extension`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/09-MapConfig-analyses-extension.md). +* Fetch tabular data from analysis nodes with [`Dataviews`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/10-MapConfig-dataviews-extension.md) -* reads dbname from subdomain and cartodb redis for pretty tile urls -* configures windshaft to publish `cartodb_id` as the interactivity layer -* gets the default geometry type from the cartodb redis store -* allows tiles to be styled individually -* provides a link to varnish high speed cache -* provides a [template maps API](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/Template-maps.md) +## Build -Install -------- -See [INSTALL.md](INSTALL.md) for detailed installation instructions. +Requirements: -Configure ---------- +* [`Node 10.x (npm 6.x)`](https://nodejs.org/dist/latest-v10.x/) +* [`PostgreSQL >= 10.0`](https://www.postgresql.org/download/) +* [`PostGIS >= 2.4`](https://postgis.net/install/) +* [`CARTO Postgres Extension >= 0.24.1`](https://github.com/CartoDB/cartodb-postgresql) +* [`Redis >= 4`](https://redis.io/download) +* `libcairo2-dev`, `libpango1.0-dev`, `libjpeg8-dev` and `libgif-dev` for server side canvas support +* `C++11` to build internal dependencies. When there's no pre-built binaries for your OS/architecture distribution. -Create the config/environments/.js files (there are .example files -to start from). You can optionally use the ./configure script for this, -see ```./configure --help``` to see available options. +Optional: -Look at lib/cartodb/server-options.js for more on config +* [`Varnish`](http://www.varnish-cache.org) +* [`Statsd`](https://github.com/statsd/statsd) -Upgrading ---------- +### PostGIS setup -Checkout your commit/branch. If you need to reinstall dependencies (you can check [NEWS](NEWS.md)) do the following: +A `template_postgis` database is expected. One can be set up with -```sh -$ rm -rf node_modules +```shell +$ createdb --owner postgres --template template0 template_postgis +$ psql -d template_postgis -c 'CREATE EXTENSION postgis;' +``` + +### Install + +To fetch and build all node-based dependencies, run: + +```shell $ npm install ``` -``` -node app.js -``` +### Run -Where is the name of a configuration file under config/environments/. - -Note that caches are kept in redis. If you're not seeing what you expect -there may be out-of-sync records in there. -Take a look: http://redis.io/commands - - -Documentation -------------- - -The [docs directory](https://github.com/CartoDB/Windshaft-cartodb/tree/master/docs) contains different documentation -resources, from higher level to more detailed ones: -The [Maps API](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/Map-API.md) defined the endpoints and their -expected parameters and outputs. - - -Examples --------- - -[CartoDB's Map Gallery](http://cartodb.com/gallery/) showcases several examples of visualisations built on top of this. - -Contributing ---- - -See [CONTRIBUTING.md](CONTRIBUTING.md). - -### Developing with a custom windshaft version - -If you plan or want to use a custom / not released yet version of windshaft (or any other dependency) the best option is -to use `npm link`. You can read more about it at [npm-link: Symlink a package folder](https://docs.npmjs.com/cli/link.html). - -**Quick start**: +Create the `./config/environments/.js` file (there are `.example` files to start from). Look at `./lib/cartodb/server-options.js` for more on config. ```shell -~/windshaft-directory $ npm install -~/windshaft-directory $ npm link -~/windshaft-cartodb-directory $ npm link windshaft +$ node app.js ``` + +Where `` is the name of a configuration file under `./config/environments/`. + +### Test + +```shell +$ npm test +``` + +### Coverage + +```shell +$ npm run cover +``` + +Open `./coverage/lcov-report/index.html`. + +### Docker support + +We provide docker images just for testing and continuous integration purposes: + +* [`nodejs-xenial-pg1121`](https://hub.docker.com/r/carto/nodejs-xenial-pg1121/tags) +* [`nodejs-xenial-pg101`](https://hub.docker.com/r/carto/nodejs-xenial-pg101/tags) + +You can find instructions to install Docker, download, and update images [here](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docker/reference.md). + +### Useful `npm` scripts + +Run test in a docker image with a specific Node.js version: + +```shell +$ DOCKER_IMAGE= NODE_VERSION= npm run test:docker +``` + +Where: + +* ``: the tag of required docker image, e.g. `carto/nodejs-xenial-pg1121:latest` +* ``: the Node.js version, e.g. `10.15.1` + +In case you need to debug: + +```shell +$ DOCKER_IMAGE= npm run docker:bash +``` + +## Documentation + +You can find an overview, guides, full reference, and support in [`CARTO's developer center`](https://carto.com/developers/maps-api/). The [docs directory](https://github.com/CartoDB/Windshaft-cartodb/tree/master/docs) contains different documentation resources, from a higher level to more detailed ones. + +## Contributing + +* The issue tracker: [`Github`](https://github.com/CartoDB/Windshaft-cartodb/issues). +* We love Pull Requests from everyone, see [contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/#contributing). +* You'll need to sign a Contributor License Agreement (CLA) before submitting a Pull Request. [Learn more here](https://carto.com/contributions). + +## Developing with a custom `Windshaft` version + +If you plan or want to use a custom / not released yet version of windshaft (or any other dependency), the best option is to use `npm link`. You can read more about it at `npm-link`: [symlink a package folder](https://docs.npmjs.com/cli/link.html). + +```shell +$ cd /path/to/Windshaft +$ npm install +$ npm link +$ cd /path/to/Windshaft-cartodb +$ npm link windshaft +``` + +## Versioning + +We follow [`SemVer`](http://semver.org/) for versioning. For available versions, see the [tags on this repository](https://github.com/Windshaft-cartodb/cartonik/tags). + +## License + +This project is licensed under the BSD 3-clause "New" or "Revised" License. See the [LICENSE](LICENSE) file for details. diff --git a/configure b/configure deleted file mode 100755 index c234f6f4..00000000 --- a/configure +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -# -# This script creates config/environments/*.js files using -# config/environments/*.js.example files as input and performing -# settings substitutions. -# -# It relies on a known format of the .js.example files which haven't -# been made easier to parse to still let humans copy them manually and -# do further editing or leave them as such to get the same setup as before -# the introduction of this script. -# -# The script is a work in progress. Available switches are printed -# by invoking with the --help switch. More switches will be added -# as the need/request for them arises. -# -# --strk(2012-07-23) -# - -ENVDIR=config/environments - -PGPORT= -MAPNIK_VERSION= -ENVIRONMENT=development - -STATUS="$0 $*" - -usage() { - echo "Usage: $0 [OPTION]" - echo - echo "Configuration:" - echo " --help display this help and exit" - echo " --with-pgport=NUM access PostgreSQL server on TCP port NUM [$PGPORT]" - echo " --with-mapnik-version=STRING set mapnik version string [$MAPNIK_VERSION]" - echo " --environment=STRING set output environment name [$ENVIRONMENT]" -} - -while test -n "$1"; do - case "$1" in - --help|-h) - usage - exit 0 - ;; - --with-pgport=*) - PGPORT=`echo "$1" | cut -d= -f2` - ;; - --with-mapnik-version=*) - MAPNIK_VERSION=`echo "$1" | cut -d= -f2` - ;; - --environment=*) - ENVIRONMENT=`echo "$1" | cut -d= -f2` - ;; - *) - echo "Unused option '$1'" >&2 - ;; - esac - shift -done - -ENVEX=./${ENVDIR}/${ENVIRONMENT}.js.example - -if [ -z "$PGPORT" ]; then - PGPORT=`node -e "console.log(require('${ENVEX}').postgres.port)"` -fi - -echo "PGPORT: $PGPORT" -echo "MAPNIK_VERSION: $MAPNIK_VERSION" -echo "ENVIRONMENT: $ENVIRONMENT" - -o=`dirname "${ENVEX}"`/`basename "${ENVEX}" .example` -echo "Writing $o" - -# See http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/ -sed -n "1h;1!H;\${;g;s/\(,postgres: {[^}]*port: *'\?\)[^',]*\('\?,\)/\1$PGPORT\2/;p;}" < "${ENVEX}" \ - | sed "s/mapnik_version:.*/mapnik_version: '$MAPNIK_VERSION'/" \ - > "$o" - -STATUSFILE=config.status--${ENVIRONMENT} -echo "Writing ${STATUSFILE}" -echo ${STATUS} > ${STATUSFILE} && chmod +x ${STATUSFILE} - diff --git a/docker-bash.sh b/docker-bash.sh deleted file mode 100755 index 5666ea1d..00000000 --- a/docker-bash.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -echo "*********************" -echo "To install Node.js, run:" -echo "/src/nodejs-install.sh" -echo "Use NODEJS_VERSION env var to select the Node.js version" -echo " " -echo "To start postgres, run:" -echo "/etc/init.d/postgresql start" -echo "*********************" -echo " " - -docker run -it -v `pwd`:/srv carto/nodejs-xenial-pg101:latest bash diff --git a/docker-test.sh b/docker-test.sh deleted file mode 100755 index bca2c5db..00000000 --- a/docker-test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -docker run -e "NODEJS_VERSION=${2}" -v `pwd`:/srv ${1} bash run_tests_docker.sh && \ - docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v diff --git a/docker/Dockerfile-nodejs10-xenial-pg101:postgis-2.4.4.5 b/docker/Dockerfile-nodejs10-xenial-pg101:postgis-2.4.4.5 deleted file mode 100644 index f0c3f738..00000000 --- a/docker/Dockerfile-nodejs10-xenial-pg101:postgis-2.4.4.5 +++ /dev/null @@ -1,88 +0,0 @@ -FROM ubuntu:xenial - -# Use UTF8 to avoid encoding problems with pgsql -ENV LANG C.UTF-8 -ENV NPROCS 1 -ENV JOBS 1 -ENV CXX g++-4.9 -ENV PGUSER postgres - -# Add external repos -RUN set -ex \ - && apt-get update \ - && apt-get install -y \ - curl \ - software-properties-common \ - locales \ - && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ - && add-apt-repository -y ppa:cartodb/postgresql-10 \ - && add-apt-repository -y ppa:cartodb/gis \ - && curl -sL https://deb.nodesource.com/setup_10.x | bash \ - && locale-gen en_US.UTF-8 \ - && update-locale LANG=en_US.UTF-8 - -RUN set -ex \ - && apt-get update \ - && apt-get install -y \ - g++-4.9 \ - gcc-4.9 \ - git \ - libcairo2-dev \ - libgdal-dev \ - libgdal1i \ - libgdal20 \ - libgeos-dev \ - libgif-dev \ - libjpeg8-dev \ - libjson-c-dev \ - libpango1.0-dev \ - libpixman-1-dev \ - libproj-dev \ - libprotobuf-c-dev \ - libxml2-dev \ - gdal-bin \ - make \ - nodejs \ - protobuf-c-compiler \ - pkg-config \ - wget \ - zip \ - postgresql-10 \ - postgresql-10-plproxy \ - postgis=2.4.4.5+carto-1 \ - postgresql-10-postgis-2.4=2.4.4.5+carto-1 \ - postgresql-10-postgis-2.4-scripts=2.4.4.5+carto-1 \ - postgresql-10-postgis-scripts=2.4.4.5+carto-1 \ - postgresql-client-10 \ - postgresql-client-common \ - postgresql-common \ - postgresql-contrib \ - postgresql-plpython-10 \ - postgresql-server-dev-10 \ - && wget http://download.redis.io/releases/redis-4.0.8.tar.gz \ - && tar xvzf redis-4.0.8.tar.gz \ - && cd redis-4.0.8 \ - && make \ - && make install \ - && cd .. \ - && rm redis-4.0.8.tar.gz \ - && rm -R redis-4.0.8 \ - && apt-get purge -y wget protobuf-c-compiler \ - && apt-get autoremove -y - -# Configure PostgreSQL -RUN set -ex \ - && echo "listen_addresses='*'" >> /etc/postgresql/10/main/postgresql.conf \ - && echo "local all all trust" > /etc/postgresql/10/main/pg_hba.conf \ - && echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/10/main/pg_hba.conf \ - && echo "host all all ::1/128 trust" >> /etc/postgresql/10/main/pg_hba.conf \ - && /etc/init.d/postgresql start \ - && createdb template_postgis \ - && createuser publicuser \ - && psql -c "CREATE EXTENSION postgis" template_postgis \ - && /etc/init.d/postgresql stop - -WORKDIR /srv -EXPOSE 5858 - -CMD /etc/init.d/postgresql start diff --git a/docker/Dockerfile-nodejs6-xenial-pg101:latest b/docker/Dockerfile-nodejs6-xenial-pg101:latest deleted file mode 100644 index d1d70589..00000000 --- a/docker/Dockerfile-nodejs6-xenial-pg101:latest +++ /dev/null @@ -1,89 +0,0 @@ -FROM ubuntu:xenial - -# Use UTF8 to avoid encoding problems with pgsql -ENV LANG C.UTF-8 -ENV NPROCS 1 -ENV JOBS 1 -ENV CXX g++-4.9 -ENV PGUSER postgres - -# Add external repos -RUN set -ex \ - && apt-get update \ - && apt-get install -y \ - curl \ - software-properties-common \ - locales \ - && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ - && add-apt-repository -y ppa:cartodb/postgresql-10 \ - && add-apt-repository -y ppa:cartodb/gis \ - && curl -sL https://deb.nodesource.com/setup_6.x | bash \ - && locale-gen en_US.UTF-8 \ - && update-locale LANG=en_US.UTF-8 - -# Install dependencies and PostGIS 2.4 from sources -RUN set -ex \ - && apt-get update \ - && apt-get install -y \ - g++-4.9 \ - gcc-4.9 \ - git \ - libcairo2-dev \ - libgdal-dev \ - libgdal1i \ - libgdal20 \ - libgeos-dev \ - libgif-dev \ - libjpeg8-dev \ - libjson-c-dev \ - libpango1.0-dev \ - libpixman-1-dev \ - libproj-dev \ - libprotobuf-c-dev \ - libxml2-dev \ - gdal-bin \ - make \ - nodejs \ - protobuf-c-compiler \ - pkg-config \ - wget \ - zip \ - postgresql-10 \ - postgresql-10-plproxy \ - postgresql-10-postgis-2.4 \ - postgresql-10-postgis-2.4-scripts \ - postgresql-10-postgis-scripts \ - postgresql-client-10 \ - postgresql-client-common \ - postgresql-common \ - postgresql-contrib \ - postgresql-plpython-10 \ - postgresql-server-dev-10 \ - postgis \ - && wget http://download.redis.io/releases/redis-4.0.8.tar.gz \ - && tar xvzf redis-4.0.8.tar.gz \ - && cd redis-4.0.8 \ - && make \ - && make install \ - && cd .. \ - && rm redis-4.0.8.tar.gz \ - && rm -R redis-4.0.8 \ - && apt-get purge -y wget protobuf-c-compiler \ - && apt-get autoremove -y - -# Configure PostgreSQL -RUN set -ex \ - && echo "listen_addresses='*'" >> /etc/postgresql/10/main/postgresql.conf \ - && echo "local all all trust" > /etc/postgresql/10/main/pg_hba.conf \ - && echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/10/main/pg_hba.conf \ - && echo "host all all ::1/128 trust" >> /etc/postgresql/10/main/pg_hba.conf \ - && /etc/init.d/postgresql start \ - && createdb template_postgis \ - && createuser publicuser \ - && psql -c "CREATE EXTENSION postgis" template_postgis \ - && /etc/init.d/postgresql stop - -WORKDIR /srv -EXPOSE 5858 - -CMD /etc/init.d/postgresql start diff --git a/docker/Dockerfile-nodejs6-xenial-pg101:postgis-2.4 b/docker/Dockerfile-nodejs6-xenial-pg101:postgis-2.4 deleted file mode 100644 index d1d70589..00000000 --- a/docker/Dockerfile-nodejs6-xenial-pg101:postgis-2.4 +++ /dev/null @@ -1,89 +0,0 @@ -FROM ubuntu:xenial - -# Use UTF8 to avoid encoding problems with pgsql -ENV LANG C.UTF-8 -ENV NPROCS 1 -ENV JOBS 1 -ENV CXX g++-4.9 -ENV PGUSER postgres - -# Add external repos -RUN set -ex \ - && apt-get update \ - && apt-get install -y \ - curl \ - software-properties-common \ - locales \ - && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ - && add-apt-repository -y ppa:cartodb/postgresql-10 \ - && add-apt-repository -y ppa:cartodb/gis \ - && curl -sL https://deb.nodesource.com/setup_6.x | bash \ - && locale-gen en_US.UTF-8 \ - && update-locale LANG=en_US.UTF-8 - -# Install dependencies and PostGIS 2.4 from sources -RUN set -ex \ - && apt-get update \ - && apt-get install -y \ - g++-4.9 \ - gcc-4.9 \ - git \ - libcairo2-dev \ - libgdal-dev \ - libgdal1i \ - libgdal20 \ - libgeos-dev \ - libgif-dev \ - libjpeg8-dev \ - libjson-c-dev \ - libpango1.0-dev \ - libpixman-1-dev \ - libproj-dev \ - libprotobuf-c-dev \ - libxml2-dev \ - gdal-bin \ - make \ - nodejs \ - protobuf-c-compiler \ - pkg-config \ - wget \ - zip \ - postgresql-10 \ - postgresql-10-plproxy \ - postgresql-10-postgis-2.4 \ - postgresql-10-postgis-2.4-scripts \ - postgresql-10-postgis-scripts \ - postgresql-client-10 \ - postgresql-client-common \ - postgresql-common \ - postgresql-contrib \ - postgresql-plpython-10 \ - postgresql-server-dev-10 \ - postgis \ - && wget http://download.redis.io/releases/redis-4.0.8.tar.gz \ - && tar xvzf redis-4.0.8.tar.gz \ - && cd redis-4.0.8 \ - && make \ - && make install \ - && cd .. \ - && rm redis-4.0.8.tar.gz \ - && rm -R redis-4.0.8 \ - && apt-get purge -y wget protobuf-c-compiler \ - && apt-get autoremove -y - -# Configure PostgreSQL -RUN set -ex \ - && echo "listen_addresses='*'" >> /etc/postgresql/10/main/postgresql.conf \ - && echo "local all all trust" > /etc/postgresql/10/main/pg_hba.conf \ - && echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/10/main/pg_hba.conf \ - && echo "host all all ::1/128 trust" >> /etc/postgresql/10/main/pg_hba.conf \ - && /etc/init.d/postgresql start \ - && createdb template_postgis \ - && createuser publicuser \ - && psql -c "CREATE EXTENSION postgis" template_postgis \ - && /etc/init.d/postgresql stop - -WORKDIR /srv -EXPOSE 5858 - -CMD /etc/init.d/postgresql start diff --git a/docker/Dockerfile-nodejs6-xenial-pg101:postgis-2.4.4.5 b/docker/Dockerfile-nodejs6-xenial-pg101:postgis-2.4.4.5 deleted file mode 100644 index c4d7b091..00000000 --- a/docker/Dockerfile-nodejs6-xenial-pg101:postgis-2.4.4.5 +++ /dev/null @@ -1,88 +0,0 @@ -FROM ubuntu:xenial - -# Use UTF8 to avoid encoding problems with pgsql -ENV LANG C.UTF-8 -ENV NPROCS 1 -ENV JOBS 1 -ENV CXX g++-4.9 -ENV PGUSER postgres - -# Add external repos -RUN set -ex \ - && apt-get update \ - && apt-get install -y \ - curl \ - software-properties-common \ - locales \ - && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ - && add-apt-repository -y ppa:cartodb/postgresql-10 \ - && add-apt-repository -y ppa:cartodb/gis \ - && curl -sL https://deb.nodesource.com/setup_6.x | bash \ - && locale-gen en_US.UTF-8 \ - && update-locale LANG=en_US.UTF-8 - -RUN set -ex \ - && apt-get update \ - && apt-get install -y \ - g++-4.9 \ - gcc-4.9 \ - git \ - libcairo2-dev \ - libgdal-dev \ - libgdal1i \ - libgdal20 \ - libgeos-dev \ - libgif-dev \ - libjpeg8-dev \ - libjson-c-dev \ - libpango1.0-dev \ - libpixman-1-dev \ - libproj-dev \ - libprotobuf-c-dev \ - libxml2-dev \ - gdal-bin \ - make \ - nodejs \ - protobuf-c-compiler \ - pkg-config \ - wget \ - zip \ - postgresql-10 \ - postgresql-10-plproxy \ - postgis=2.4.4.5+carto-1 \ - postgresql-10-postgis-2.4=2.4.4.5+carto-1 \ - postgresql-10-postgis-2.4-scripts=2.4.4.5+carto-1 \ - postgresql-10-postgis-scripts=2.4.4.5+carto-1 \ - postgresql-client-10 \ - postgresql-client-common \ - postgresql-common \ - postgresql-contrib \ - postgresql-plpython-10 \ - postgresql-server-dev-10 \ - && wget http://download.redis.io/releases/redis-4.0.8.tar.gz \ - && tar xvzf redis-4.0.8.tar.gz \ - && cd redis-4.0.8 \ - && make \ - && make install \ - && cd .. \ - && rm redis-4.0.8.tar.gz \ - && rm -R redis-4.0.8 \ - && apt-get purge -y wget protobuf-c-compiler \ - && apt-get autoremove -y - -# Configure PostgreSQL -RUN set -ex \ - && echo "listen_addresses='*'" >> /etc/postgresql/10/main/postgresql.conf \ - && echo "local all all trust" > /etc/postgresql/10/main/pg_hba.conf \ - && echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/10/main/pg_hba.conf \ - && echo "host all all ::1/128 trust" >> /etc/postgresql/10/main/pg_hba.conf \ - && /etc/init.d/postgresql start \ - && createdb template_postgis \ - && createuser publicuser \ - && psql -c "CREATE EXTENSION postgis" template_postgis \ - && /etc/init.d/postgresql stop - -WORKDIR /srv -EXPOSE 5858 - -CMD /etc/init.d/postgresql start diff --git a/docker/reference.md b/docker/reference.md index 31dd26cb..ff8435bc 100644 --- a/docker/reference.md +++ b/docker/reference.md @@ -1,23 +1,33 @@ -After running the tests with docker, you will need Docker installed and the docker image downloaded. +# Testing with Docker + +Before running the tests with docker, you'll need Docker installed and the docker image downloaded. ## Install docker -`sudo apt install docker.io && sudo usermod -aG docker $(whoami)` + +```shell +$ sudo apt install docker.io && sudo usermod -aG docker $(whoami) +``` ## Download image -`docker pull carto/IMAGE` + +```shell +docker pull carto/IMAGE +``` ## Carto account -https://hub.docker.com/r/carto/ + +* `https://hub.docker.com/r/carto/` ## Update image -- Edit the docker image file with your desired changes -- Build image: - - `docker build -t carto/IMAGE -f docker/DOCKER_FILE docker/` -- Upload to docker hub: - - Login into docker hub: - - `docker login` - - Create tag: - - `docker tag carto/IMAGE carto/IMAGE` - - Upload: - - `docker push carto/IMAGE` +* Edit the docker image file +* Build image: + * `docker build -t carto/IMAGE -f docker/DOCKER_FILE docker/` + +* Upload to docker hub: + * Login into docker hub: + * `docker login` + * Create tag: + * `docker tag carto/IMAGE carto/IMAGE` + * Upload: + * `docker push carto/IMAGE` diff --git a/run_tests_docker.sh b/docker/scripts/test-setup.sh similarity index 70% rename from run_tests_docker.sh rename to docker/scripts/test-setup.sh index f30a39d3..9d735d9a 100644 --- a/run_tests_docker.sh +++ b/docker/scripts/test-setup.sh @@ -8,15 +8,7 @@ source /src/nodejs-install.sh git clone https://github.com/CartoDB/cartodb-postgresql.git cd cartodb-postgresql && make && make install && cd .. -echo "Node.js version: " -node -v +cp config/environments/test.js.example config/environments/test.js -echo "npm version: " -npm -v - -echo "Clean install: " npm ci -npm ls - -# run tests npm test diff --git a/package-lock.json b/package-lock.json index cfc86e1c..d351c84d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "windshaft-cartodb", - "version": "8.0.1", + "version": "8.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -13,6 +13,47 @@ "@babel/highlight": "^7.0.0" } }, + "@babel/generator": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.4.tgz", + "integrity": "sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz", + "integrity": "sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz", + "integrity": "sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz", + "integrity": "sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==", + "dev": true, + "requires": { + "@babel/types": "^7.7.4" + } + }, "@babel/highlight": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", @@ -61,6 +102,68 @@ } } }, + "@babel/parser": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.4.tgz", + "integrity": "sha512-jIwvLO0zCL+O/LmEJQjWA75MQTWwx3c3u2JOTDK5D3/9egrWRRA0/0hk9XXywYnXZVVpzrBYeIQTmhwUaePI9g==", + "dev": true + }, + "@babel/template": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.4.tgz", + "integrity": "sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4" + } + }, + "@babel/traverse": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.4.tgz", + "integrity": "sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.7.4", + "@babel/helper-function-name": "^7.7.4", + "@babel/helper-split-export-declaration": "^7.7.4", + "@babel/parser": "^7.7.4", + "@babel/types": "^7.7.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.4.tgz", + "integrity": "sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, "@carto/cartonik": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/@carto/cartonik/-/cartonik-0.7.0.tgz", @@ -141,13 +244,6 @@ "json-schema-traverse": "^0.3.0" } }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true, - "optional": true - }, "ansi-escapes": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", @@ -164,11 +260,26 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" }, + "append-transform": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-1.0.0.tgz", + "integrity": "sha512-P009oYkeHyU742iSZJzZZywj4QRJdnTWffaKuJQLablCZ1uz6/cW4yaRgcDaoQ+uwOxxnt0gRUcwfsNP2ri0gw==", + "dev": true, + "requires": { + "default-require-extensions": "^2.0.0" + } + }, "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, "are-we-there-yet": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", @@ -367,6 +478,18 @@ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" }, + "caching-transform": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-3.0.2.tgz", + "integrity": "sha512-Mtgcv3lh3U0zRii/6qVgQODdPA4G3zhG+jtbCWj39RXuUFTMzH0vcdMtaJS1jPowd+It2Pqr6y3NJMQqOqCE2w==", + "dev": true, + "requires": { + "hasha": "^3.0.0", + "make-dir": "^2.0.0", + "package-hash": "^3.0.0", + "write-file-atomic": "^2.4.2" + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -635,12 +758,18 @@ } }, "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true, "optional": true }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -667,6 +796,15 @@ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, "cookie": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", @@ -682,6 +820,27 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "cp-file": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-6.2.0.tgz", + "integrity": "sha512-fmvV4caBnofhPe8kOcitBwSn2f39QLjnAnGq3gO9dfd75mUytzKNZB1hde6QHunW2Rt+OwuBOMc3i1tNElbszA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "make-dir": "^2.0.0", + "nested-error-stacks": "^2.0.0", + "pify": "^4.0.1", + "safe-buffer": "^5.0.1" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + } + } + }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -757,6 +916,23 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "default-require-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-2.0.0.tgz", + "integrity": "sha1-9fj7sYp9bVCyH2QfZJ67Uiz+JPc=", + "dev": true, + "requires": { + "strip-bom": "^3.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -887,6 +1063,12 @@ "is-symbol": "^1.0.2" } }, + "es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true + }, "es6-promise": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.1.2.tgz", @@ -902,37 +1084,6 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, - "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", - "dev": true, - "requires": { - "esprima": "^2.7.1", - "estraverse": "^1.9.1", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true, - "requires": { - "amdefine": ">=0.0.4" - } - } - } - }, "eslint": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.5.1.tgz", @@ -1394,12 +1545,6 @@ } } }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", @@ -1646,6 +1791,77 @@ } } }, + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + } + } + }, "find-up": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", @@ -1697,6 +1913,28 @@ "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "dev": true }, + "foreground-child": { + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", + "integrity": "sha1-T9ca0t/elnibmApcCilZN8svXOk=", + "dev": true, + "requires": { + "cross-spawn": "^4", + "signal-exit": "^3.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", + "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + } + } + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -2762,9 +3000,9 @@ "dev": true }, "handlebars": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", - "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz", + "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==", "dev": true, "requires": { "neo-async": "^2.6.0", @@ -2828,6 +3066,26 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, + "hasha": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-3.0.0.tgz", + "integrity": "sha1-UqMvq4Vp1BymmmH/GiFPjrfIvTk=", + "dev": true, + "requires": { + "is-stream": "^1.0.1" + } + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "requires": { + "boom": "4.x.x", + "cryptiles": "3.x.x", + "hoek": "4.x.x", + "sntp": "2.x.x" + } + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -3143,76 +3401,140 @@ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, - "istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", + "istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-2.0.7.tgz", + "integrity": "sha512-vrRztU9VRRFDyC+aklfLoeXyNdTfga2EI3udDGn4cZ6fpSXpHLV9X6CHvfoMCPtggg8zvDDmC4b9xfu0z6/llA==", "dev": true, "requires": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" + "append-transform": "^1.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", + "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", + "dev": true, + "requires": { + "@babel/generator": "^7.4.0", + "@babel/parser": "^7.4.3", + "@babel/template": "^7.4.0", + "@babel/traverse": "^7.4.3", + "@babel/types": "^7.4.0", + "istanbul-lib-coverage": "^2.0.5", + "semver": "^6.0.0" }, "dependencies": { - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "istanbul-lib-report": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", + "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", "dev": true, "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", + "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "rimraf": "^2.6.3", + "source-map": "^0.6.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "2 || 3", + "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "dev": true, "requires": { - "abbrev": "1" + "glob": "^7.1.3" } }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true } } }, + "istanbul-reports": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.6.tgz", + "integrity": "sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA==", + "dev": true, + "requires": { + "handlebars": "^4.1.2" + } + }, "js-base64": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz", @@ -3243,6 +3565,18 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -3331,6 +3665,12 @@ "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=" }, + "lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "dev": true + }, "log4js": { "version": "github:cartodb/log4js-node#145d5f91e35e7fb14a6278cbf7a711ced6603727", "from": "github:cartodb/log4js-node#cdb", @@ -3372,6 +3712,30 @@ "resolved": "https://registry.npmjs.org/lzma/-/lzma-2.3.2.tgz", "integrity": "sha1-N4OySFi5wOdHoN88vx+1/KqSxEE=" }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "mapnik-reference": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/mapnik-reference/-/mapnik-reference-6.0.5.tgz", @@ -3399,6 +3763,23 @@ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" }, + "merge-source-map": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz", + "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", + "dev": true, + "requires": { + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -3631,6 +4012,12 @@ "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", "dev": true }, + "nested-error-stacks": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz", + "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==", + "dev": true + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -3757,6 +4144,234 @@ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, + "nyc": { + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-14.1.1.tgz", + "integrity": "sha512-OI0vm6ZGUnoGZv/tLdZ2esSVzDwUC88SNs+6JoSOMVxA+gKMB8Tk7jBwgemLx4O40lhhvZCVw1C+OYLOBOPXWw==", + "dev": true, + "requires": { + "archy": "^1.0.0", + "caching-transform": "^3.0.2", + "convert-source-map": "^1.6.0", + "cp-file": "^6.2.0", + "find-cache-dir": "^2.1.0", + "find-up": "^3.0.0", + "foreground-child": "^1.5.6", + "glob": "^7.1.3", + "istanbul-lib-coverage": "^2.0.5", + "istanbul-lib-hook": "^2.0.7", + "istanbul-lib-instrument": "^3.3.0", + "istanbul-lib-report": "^2.0.8", + "istanbul-lib-source-maps": "^3.0.6", + "istanbul-reports": "^2.2.4", + "js-yaml": "^3.13.1", + "make-dir": "^2.1.0", + "merge-source-map": "^1.1.0", + "resolve-from": "^4.0.0", + "rimraf": "^2.6.3", + "signal-exit": "^3.0.2", + "spawn-wrap": "^1.4.2", + "test-exclude": "^5.2.3", + "uuid": "^3.3.2", + "yargs": "^13.2.2", + "yargs-parser": "^13.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yargs": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.1" + } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "oauth-sign": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", @@ -3905,6 +4520,18 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" }, + "package-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-3.0.0.tgz", + "integrity": "sha512-lOtmukMDVvtkL84rJHI7dpTYq+0rli8N2wlnqUcBuDWCfVhRUfOmnR9SsoHFMLpACvEV60dX7rd0rFaYDZI+FA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.15", + "hasha": "^3.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" + } + }, "packet-reader": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-0.3.1.tgz", @@ -4306,6 +4933,15 @@ "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, + "release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", + "dev": true, + "requires": { + "es6-error": "^4.0.1" + } + }, "request": { "version": "2.87.0", "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", @@ -4562,6 +5198,45 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" }, + "spawn-wrap": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.4.3.tgz", + "integrity": "sha512-IgB8md0QW/+tWqcavuFgKYR/qIRvJkRLPJDFaoXtLLUaVcCDK0+HeFTkmQHj3eprcYhc+gOl0aEA1w7qZlYezw==", + "dev": true, + "requires": { + "foreground-child": "^1.5.6", + "mkdirp": "^0.5.0", + "os-homedir": "^1.0.1", + "rimraf": "^2.6.2", + "signal-exit": "^3.0.2", + "which": "^1.3.0" + }, + "dependencies": { + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, "spdx-correct": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", @@ -4826,6 +5501,153 @@ } } }, + "test-exclude": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", + "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "dev": true, + "requires": { + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "read-pkg-up": "^4.0.0", + "require-main-filename": "^2.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "dev": true, + "requires": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + } + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -4846,6 +5668,12 @@ "os-tmpdir": "~1.0.2" } }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, "torque.js": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/torque.js/-/torque.js-3.1.1.tgz", @@ -4930,13 +5758,13 @@ } }, "uglify-js": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz", - "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.0.tgz", + "integrity": "sha512-PC/ee458NEMITe1OufAjal65i6lB58R1HWMRcxwvdz1UopW0DYqlRL3xdu3IcTvTXsB02CRHykidkTRL+A3hQA==", "dev": true, "optional": true, "requires": { - "commander": "~2.20.0", + "commander": "~2.20.3", "source-map": "~0.6.1" }, "dependencies": { @@ -5118,6 +5946,17 @@ "mkdirp": "^0.5.1" } }, + "write-file-atomic": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index 044760f0..56ae78d1 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,18 @@ { "private": true, "name": "windshaft-cartodb", - "version": "8.0.1", - "description": "A map tile server for CartoDB", + "version": "8.1.0", + "description": "CARTO Maps API tiler", "keywords": [ - "cartodb" + "carto", + "tiler", + "maps", + "anonymous maps", + "named maps", + "static maps", + "smart aggregations", + "analysis", + "dataviews" ], "url": "https://github.com/CartoDB/Windshaft-cartodb", "license": "BSD-3-Clause", @@ -59,10 +67,10 @@ "eslint-plugin-node": "^10.0.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.1", - "istanbul": "0.4.5", "mocha": "5.2.0", "moment": "2.22.1", "nock": "9.2.6", + "nyc": "^14.1.1", "redis": "2.8.0", "step": "1.0.0", "strftime": "0.10.0" @@ -70,11 +78,22 @@ "scripts": { "lint:fix": "eslint --fix app.js \"lib/**/*.js\" \"test/**/*.js\"", "lint": "eslint app.js \"lib/**/*.js\" \"test/**/*.js\"", - "preinstall": "make pre-install", - "test": "make test-all", - "update-internal-deps": "rm -rf node_modules && npm install", - "docker-test": "./docker-test.sh", - "docker-bash": "./docker-bash.sh" + "preinstall": "scripts/darwin-pre-install.sh", + "pretest:setup": "npm run lint", + "test:setup": "NODE_ENV=test node test setup", + "pretest": "npm run test:setup", + "test": "npm run test:all", + "test:all": "npm run test:unit && npm run test:integration && npm run test:acceptance", + "test:acceptance": "NODE_ENV=test mocha -t 5000 --exit --recursive test/acceptance", + "test:integration": "NODE_ENV=test mocha --exit --recursive test/integration", + "test:unit": "NODE_ENV=test mocha --exit --recursive test/unit", + "posttest": "npm run test:teardown", + "test:teardown": "NODE_ENV=test node test teardown", + "precover": "npm run test:setup", + "cover": "NODE_ENV=test nyc --reporter=lcov npm run test:all", + "postcover": "npm run test:teardown", + "test:docker": "docker run -e \"NODEJS_VERSION=$NODE_VERSION\" -v `pwd`:/srv $DOCKER_IMAGE bash docker/scripts/test-setup.sh && docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v", + "docker:bash": "docker run -it -v `pwd`:/srv $DOCKER_IMAGE bash" }, "engines": { "node": "^10.15.1", diff --git a/run_tests.sh b/run_tests.sh deleted file mode 100755 index 9686687f..00000000 --- a/run_tests.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/bash - -OPT_CREATE_REDIS=yes # create the redis test environment -OPT_CREATE_PGSQL=yes # create the PostgreSQL test environment -OPT_DROP_REDIS=yes # drop the redis test environment -OPT_DROP_PGSQL=yes # drop the PostgreSQL test environment -OPT_COVERAGE=no # run tests with coverage -OPT_REDIS_CELL=yes # download redis cell - -export PGAPPNAME=cartodb_tiler_tester - -cd $(dirname $0) -BASEDIR=$(pwd) -cd - - -REDIS_PORT=`node -e "console.log(require('${BASEDIR}/config/environments/test.js').redis.port)"` -export REDIS_PORT - -cleanup() { - if test x"$OPT_DROP_REDIS" = xyes; then - if test x"$PID_REDIS" = x; then - PID_REDIS=$(cat ${BASEDIR}/redis.pid) - if test x"$PID_REDIS" = x; then - echo "Could not find a test redis pid to kill it" - return; - fi - fi - redis-cli -p ${REDIS_PORT} info stats - redis-cli -p ${REDIS_PORT} info keyspace - echo "Killing test redis pid ${PID_REDIS}" - #kill ${PID_REDIS_MONITOR} - kill ${PID_REDIS} - fi - if test x"$OPT_DROP_PGSQL" = xyes; then - # TODO: drop postgresql ? - echo "Dropping PostgreSQL test database isn't implemented yet" - fi -} - -cleanup_and_exit() { - cleanup - exit -} - -die() { - msg=$1 - echo "${msg}" >&2 - cleanup - exit 1 -} - -trap 'cleanup_and_exit' 1 2 3 5 9 13 - -while [ -n "$1" ]; do - # This is kept for backward compatibility - if test "$1" = "--nodrop"; then - OPT_DROP_REDIS=no - OPT_DROP_PGSQL=no - shift - continue - elif test "$1" = "--nodrop-pg"; then - OPT_DROP_PGSQL=no - shift - continue - elif test "$1" = "--nodrop-redis"; then - OPT_DROP_REDIS=no - shift - continue - elif test "$1" = "--nocreate-pg"; then - OPT_CREATE_PGSQL=no - shift - continue - elif test "$1" = "--nocreate-redis"; then - OPT_CREATE_REDIS=no - shift - continue - elif test "$1" = "--with-coverage"; then - OPT_COVERAGE=yes - shift - continue - # This is kept for backward compatibility - elif test "$1" = "--nocreate"; then - OPT_CREATE_REDIS=no - OPT_CREATE_PGSQL=no - shift - continue - elif test "$1" = "--norediscell"; then - OPT_REDIS_CELL=no - shift - continue - else - break - fi -done - -if [ -z "$1" ]; then - echo "Usage: $0 [] []" >&2 - echo "Options:" >&2 - echo " --nocreate do not create the test environment on start" >&2 - echo " --nodrop do not drop the test environment on exit" >&2 - echo " --with-coverage use istanbul to determine code coverage" >&2 - echo " --norediscell do not download redis-cell" >&2 - exit 1 -fi - -TESTS=$@ - -if test x"$OPT_CREATE_REDIS" = xyes; then - echo "Starting redis on port ${REDIS_PORT}" - REDIS_CELL_PATH="${BASEDIR}/test/support/libredis_cell.so" - if [[ "$OSTYPE" == "darwin"* ]]; then - REDIS_CELL_PATH="${BASEDIR}/test/support/libredis_cell.dylib" - fi - - echo "port ${REDIS_PORT}" | redis-server - --loadmodule ${REDIS_CELL_PATH} > ${BASEDIR}/test.log & - PID_REDIS=$! - echo ${PID_REDIS} > ${BASEDIR}/redis.pid -fi - -PREPARE_DB_OPTS= -if test x"$OPT_CREATE_PGSQL" != xyes; then - PREPARE_DB_OPTS="$PREPARE_DB_OPTS --skip-pg" -fi -if test x"$OPT_CREATE_REDIS" != xyes; then - PREPARE_DB_OPTS="$PREPARE_DB_OPTS --skip-redis" -fi - -echo "Preparing the environment" -cd ${BASEDIR}/test/support -source prepare_db.sh "${PREPARE_DB_OPTS}" || die "database preparation failure" -cd - - -PATH=node_modules/.bin/:$PATH - -#redis-cli -p ${REDIS_PORT} monitor > /tmp/windshaft-cartodb.redis.log & -#PID_REDIS_MONITOR=$! - -if test x"$OPT_COVERAGE" = xyes; then - echo "Running tests with coverage" - ./node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -u tdd -t 5000 --exit ${TESTS} -else - echo "Running tests" - ./node_modules/.bin/_mocha -c -u tdd -t 5000 --exit ${TESTS} -fi -ret=$? - -cleanup - -exit $ret diff --git a/scripts/check-node-canvas.sh b/scripts/darwin-pre-install.sh old mode 100644 new mode 100755 similarity index 95% rename from scripts/check-node-canvas.sh rename to scripts/darwin-pre-install.sh index a698e412..5cecb996 --- a/scripts/check-node-canvas.sh +++ b/scripts/darwin-pre-install.sh @@ -1,6 +1,7 @@ #!/bin/bash if [[ "$OSTYPE" == "darwin"* ]]; then + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig CAIRO_PKG_CONFIG=`pkg-config cairo --cflags-only-I 2> /dev/null` RESULT=$? diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100644 index f596aa12..00000000 --- a/scripts/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -if [[ "$OSTYPE" == "darwin"* ]]; then - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig -fi - -npm install diff --git a/test/index.js b/test/index.js new file mode 100644 index 00000000..f0e8c2c8 --- /dev/null +++ b/test/index.js @@ -0,0 +1,180 @@ +'use strict'; + +const util = require('util'); +const path = require('path'); +const exec = util.promisify(require('child_process').exec); + +if (!process.env.NODE_ENV) { + console.error('Please set "NODE_ENV" variable, e.g.: "NODE_ENV=test"'); + process.exit(1); +} + +const environment = require(`../config/environments/${process.env.NODE_ENV}.js`); +const REDIS_PORT = environment.redis.port; +const REDIS_CELL_PATH = path.resolve( + process.platform === 'darwin' + ? './test/support/libredis_cell.dylib' + : './test/support/libredis_cell.so' +); + +const TEST_USER_ID = 1; +const TEST_USER = environment.postgres_auth_user.replace('<%= user_id %>', TEST_USER_ID); +const TEST_PASSWORD = environment.postgres_auth_pass.replace('<%= user_id %>', TEST_USER_ID); +const PUBLIC_USER = environment.postgres.user; +const PUBLIC_USER_PASSWORD = environment.postgres.password; +const TEST_DB = `${TEST_USER}_db`; + +async function startRedis () { + await exec(`redis-server --port ${REDIS_PORT} --loadmodule ${REDIS_CELL_PATH} --logfile ${__dirname}/redis-server.log --daemonize yes`); +} + +async function stopRedis () { + await exec(`redis-cli -p ${REDIS_PORT} shutdown`); +} + +async function dropDatabase () { + await exec(`dropdb --if-exists ${TEST_DB}`, { + env: { + PGUSER: 'postgres' + } + }); +} + +async function createDatabase () { + await exec(`createdb -T template_postgis -EUTF8 "${TEST_DB}"`, { + env: { + PGUSER: 'postgres' + } + }); +} + +async function createDatabaseExtension () { + await exec(`psql -c "CREATE EXTENSION IF NOT EXISTS cartodb CASCADE;" ${TEST_DB}`, { + env: { + PGUSER: 'postgres' + } + }); +} + +async function populateDatabase () { + const filenames = [ + 'analysis_catalog', + 'windshaft.test', + 'gadm4', + 'countries_null_values', + 'ported/populated_places_simple_reduced', + 'cdb_analysis_check', + 'cdb_invalidate_varnish' + ].map(filename => `${__dirname}/support/sql/${filename}.sql`); + + const populateDatabaseCmd = ` + cat ${filenames.join(' ')} | + sed -e "s/:PUBLICUSER/${PUBLIC_USER}/g" | + sed -e "s/:PUBLICPASS/${PUBLIC_USER_PASSWORD}/g" | + sed -e "s/:TESTUSER/${TEST_USER}/g" | + sed -e "s/:TESTPASS/${TEST_PASSWORD}/g" | + PGOPTIONS='--client-min-messages=WARNING' psql -q -v ON_ERROR_STOP=1 ${TEST_DB} + `; + + await exec(populateDatabaseCmd, { + env: { + PGUSER: 'postgres' + } + }); +} + +async function populateRedis () { + const commands = ` + HMSET rails:users:localhost \ + id ${TEST_USER_ID} \ + database_name "${TEST_DB}" \ + database_host localhost \ + map_key 1234 + + HMSET rails:users:cartodb250user \ + id ${TEST_USER_ID} \ + database_name "${TEST_DB}" \ + database_host "localhost" \ + database_password "${TEST_PASSWORD}" \ + map_key 4321 + + HMSET api_keys:localhost:1234 \ + user "localhost" \ + type "master" \ + grants_sql "true" \ + grants_maps "true" \ + database_role "${TEST_USER}" \ + database_password "${TEST_PASSWORD}" + + HMSET api_keys:localhost:default_public \ + user "localhost" \ + type "default" \ + grants_sql "true" \ + grants_maps "true" \ + database_role "test_windshaft_publicuser" \ + database_password "public" + + HMSET api_keys:localhost:regular1 \ + user "localhost" \ + type "regular" \ + grants_sql "true" \ + grants_maps "true" \ + database_role "test_windshaft_regular1" \ + database_password "regular1" + + HMSET api_keys:localhost:regular2 \ + user "localhost" \ + type "regular" \ + grants_sql "true" \ + grants_maps "false" \ + database_role "test_windshaft_publicuser" \ + database_password "public" + + HMSET api_keys:cartodb250user:4321 \ + user "localhost" \ + type "master" \ + grants_sql "true" \ + grants_maps "true" \ + database_role "${TEST_USER}" \ + database_password "${TEST_PASSWORD}" + + HMSET api_keys:cartodb250user:default_public \ + user "localhost" \ + type "default" \ + grants_sql "true" \ + grants_maps "true" \ + database_role "test_windshaft_publicuser" \ + database_password "public" + `; + + await exec(`echo "${commands}" | redis-cli -p ${REDIS_PORT} -n 5`); +} + +async function main (args) { + let code = 0; + + try { + switch (args[0]) { + case 'setup': + await startRedis(); + await populateRedis(); + await dropDatabase(); + await createDatabase(); + await createDatabaseExtension(); + await populateDatabase(); + break; + case 'teardown': + await stopRedis(); + break; + default: + throw new Error('Missing "mode" argument. Valid ones: "setup" or "teardown"'); + } + } catch (err) { + console.error(err); + code = 1; + } finally { + process.exit(code); + } +} + +main(process.argv.slice(2));