Repository to store the work done by Google Fellows during 2019
- This project uses yarn for dependency management.
Install and run
yarn install
to install all dependencies. If you ever see an issue with missing dependencies, try running this command again.
-
Go to the Firestore database while logged in as
gd-earthengine-user@givedirectly.org
and add your Google account's email address to the list of users. This will give you access to user-drawn features on the disaster map. -
Download this git repository. You will probably have to add ssh keys to your account so that you can access this repository. Googling "github add ssh keys" is good enough. Current instructions available. However, if you work for Google and get a failed command when you run
ssh-add
, try specifying/usr/bin/ssh-add
, since there is a Google-specificssh-add
binary that otherwise gets invoked. -
Start the local web server by running
yarn run ws --directory docs --port 8080
. and visit the page atlocalhost:8080
(we recommend in Chrome). -
In order to view all features without incurring server traffic expenses, sign up to whitelist yourself with earth engine (usually takes ~1-2 business days to get approved).
-
Install
clang-format
, probably usingbrew install clang-format
. -
Set up auto-lint:
echo ./pre-push-hook.sh > .git/hooks/pre-push && chmod +x ./git/hooks/pre-push
-
[Optional] Run
./lint.sh --fix
to run clang-format and eslint on all relevant files and (with--fix
) format in place. Clang-format checking and eslint will run automatically ongit push
(without--fix
) so this just saves you the extra commits.
-
Node 20 is required to run tests. You can install it on Macs in various ways. The nvm manager is recommended.
-
A service account secret .json file is used to credential the test runner. Get the file either from a collaborator or by logging into the Service Accounts page as
gd-earthengine-test-user@givedirectly.org
and generating a new key forfirebase-adminsdk-j6emn@mapping-test-data.iam.gserviceaccount.com
. -
Save the file locally somewhere outside of your local download of this repository.
-
Set
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/secret.json
in your shell (most likely in your~/.bashrc
on linux,~/.bash_profile
on mac). Remember to startup a new terminal window for changes to take effect. -
Start the local web server as described above.
-
Test changes locally. (
ELECTRON_ENABLE_LOGGING=1
prints the Javascript console log to your terminal when running the Electron browser.)ELECTRON_ENABLE_LOGGING=1 yarn run cypress run # --browser chrome ## (only needed on Linux)
-
[Optional] Ask a collaborator to add you to the existing Cypress dashboard for this project. The dashboard provides easy access to output files, footage of the test being run, etc.
-
[Optional] If you are running on Linux and seeing issues with Chrome, or working on a Google internal machine, install and use Chromium for tests. Install via the usual
apt-get
-style channels. This should be relatively straightforward on most systems, but is difficult/impossible on Google-internal machines. If you have difficulty, you can download a latest version and unzip it. Then create a link, viasudo ln -s /path/to/file/in/extracted/zip/named/chrome-wrapper /usr/bin/chromium
so that Cypress knows how to find it easily. -
For more details on our testing setup, see the README.
-
[Optional] Install
ogr2ogr
command line tool (part of the gdal library) if you ever need to convert between geo-data types. This will most often be used to convert geo data to earth engine-friendly formats.brew install gdal ogr2ogr -f "ESRI Shapefile" destination_data.shp "source-data.json"
This project is licensed under the terms of the MIT license.