Contains the source code of the SANsheets google spreadsheet add-on.
The project is based on clasp and gas-local to enable local development and testing. Most of the Google functions has been mocked in order to work locally, check gas_mock for reference. The src directory contains the source code that will be pushed to the google apps webeditor. Changing code directly in the webeditor is not recommended apart from debugging because it will get wiped out next time someone pushes.
- node.js >= 6.3.0
- npm
- npx : if your npm installation is old and you don't have npx, install it with:
sudo npm i -g npx
Install dependencies:
$ npm installThe structure of the project consists of the following files:
They can be found in the src/api/queries folder. All the queries, sent to the API can be seen here.
Found in the src/functions folder. Here lie all of the functions, connecting the google sheet functions and the API queries.
Found in the src/ folder. There are 2 files, one under the name of sheetFunctions.js and the other one being generatedSheetFunctions.js, the former having all the functions, using APIs different from getMetric, the latter having those who do not. The second file is generated, using the getMetricGenerator.js.
All of the generators are found in the src/generators folder. By generator, we mean two things actually - one is the scripts, that generate the file contents, the other - the script generating the generatedSheetFunctions.js file, using the file content generators.
You can run the whole tests suite with:
$ npm testUnit tests only:
$ npm run test:unitIntegration tests only:
$ npm run test:integrationFor creating the test files for standart-template metrics:
$ npm run test:generateIf you want to exclude a function from being automatically generated (the template doesn't apply to that function),
then you should add it in the getMetricTestGenerator.js file, in the IGNORED_FUNCTIONS array
Also, if the metric is a daily one, it should be added to the LIST_OF_DAILY_METRICS array in the same file.
Run the test suite in a docker container. Build the image:
$ docker build -f Dockerfile-test -t google-spreadsheet-addon-tests .and then run the tests:
$ docker run -t google-spreadsheet-addon-tests$ npm run docsYou first need to log into clasp:
$ npx clasp loginPush changes:
$ npm run push