From 12ed026837413bcce7b6a62a9c2f2ec6384660d7 Mon Sep 17 00:00:00 2001 From: Brent Jones Date: Tue, 14 Nov 2023 15:24:19 -0600 Subject: [PATCH 1/4] fixes smartypants bug; closes #64 --- lib/templateFilters.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/templateFilters.js b/lib/templateFilters.js index 901cafc..3478f80 100644 --- a/lib/templateFilters.js +++ b/lib/templateFilters.js @@ -104,7 +104,8 @@ var smarty = function(text) { var typos = [typogr.amp, typogr.smartypants, typogr.widont, typogr.ord]; var output = typos.reduce((v, f) => f(v), text); output = output.replace(/–/g, "—") - .replace(/([’']) ([”"])/g, "$1 $2"); + .replace(/([’']) ([”"])/g, "$1 $2") + .replace("s’$2 ","s’ "); return output; }; var { typogrify } = typogr; From 993fe44fcef7b5426690a05e20435c667f7a719a Mon Sep 17 00:00:00 2001 From: Alyson Hurt Date: Wed, 3 Apr 2024 13:29:10 -0400 Subject: [PATCH 2/4] Update readme.rst Minor clarifications --- readme.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/readme.rst b/readme.rst index 3ab07b8..fe86d53 100644 --- a/readme.rst +++ b/readme.rst @@ -54,12 +54,14 @@ Getting started in more detail Configuration for this project is split between ``config.json`` (an example of which is provided) for values that are organization-specific but not sensitive, and environment variables for values that should be confidential. +**Google API app** + We recognize that environment variables are not perfectly secure (since installed packages have access to them from the ``process`` global), but they're also impossible to check into GitHub accidentally. You should have set: * GOOGLE_OAUTH_CLIENT_ID * GOOGLE_OAUTH_CONSUMER_SECRET -The Google OAuth variables should match the client ID and secret for an API app that can access your account. `This post `_ has details on setting that up. +The Google OAuth variables should match the client ID and secret for an API app that can access your account. `This post `_ has details on setting that up. (Note: If you are an NPR News Apps user, you can skip this step. This API app already exists.) Alternatively, `service account authentication `_ is also supported. To create a service account and JSON key file, visit your project's `GCP web console `_ to get started. @@ -68,16 +70,22 @@ After creating the service account: 1. Grant write access on your Drive folder (``driveFolder`` in ``config.json``) to the service account email address. 2. Set GOOGLE_APPLICATION_CREDENTIALS to the file path of the JSON file containing your credentials. +**Amazon S3** + If you're deploying to S3, which is the default for the rig, you'll also need to set: * AWS_ACCESS_KEY_ID * AWS_SECRET_ACCESS_KEY * AWS_DEFAULT_REGION +**Additional directories** + In addition to the directory that contains this app, you'll also need two other directories. One is for the templates that are used to create each graphic (in the legacy rig, these were stored in the ``dailygraphics/graphic_templates`` folder). We provide a repo of templates used at NPR `here `_, and you should feel free to clone it. In the ``config.json file``, the "templateRoot" value should be the path to this folder. The other directory is for your graphics themselves, and it should be referenced with the "graphicsPath" key of your ``config.json`` file. This folder is also where you should install any libraries used by your graphics via NPM. For example, if you're using our templates, you'll want to run ``npm install d3-array d3-axis d3-scale d3-selection`` to get the most common D3 packages. +**Command-line arguments** + The server supports a number of command-line arguments to customize its behavior: * ``--port XXXX`` - sets the port that the server will listen on to XXXX. From 9874929b7ca5e68726128110c4f3bc668c5dc63c Mon Sep 17 00:00:00 2001 From: Hilary Fung <1105386+hilaryfung@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:17:47 -0700 Subject: [PATCH 3/4] add a note about publishing google sheets to s3 --- readme.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.rst b/readme.rst index 3ab07b8..828753c 100644 --- a/readme.rst +++ b/readme.rst @@ -149,6 +149,10 @@ By default, the rig automatically casts values from strings to native JS types ( For example, to make sure that a "rankings" column is treated as a string of comma-separated numbers and not a single numerical value, you can rename it to "rankings:text". +**Publishing Sheets to S3** + +NPR has a Google Sheets add-on that publishes sheets to S3 as JSON. This is useful if you'll be updating the data or content of a graphic — but not its code — after publication. For instructions on how to set it up, read the `Hollerith documentation `_. + Template creation ----------------- From cc324a4da744908d595e48fb457da8bcc72a8a83 Mon Sep 17 00:00:00 2001 From: Brent Jones Date: Sun, 11 Aug 2024 17:43:06 -0500 Subject: [PATCH 4/4] update example config to ga4 --- config.json.example | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config.json.example b/config.json.example index e1b9cb6..3bed8de 100644 --- a/config.json.example +++ b/config.json.example @@ -13,6 +13,7 @@ "prefix": "dailygraphics/graphics" } }, - // this is the NPR Visuals Google Analytics property. update to use your own. - "analyticsID": "UA-5828686-75" + // this is the NPR Visuals Google Analytics property. update to use your own. + "ga4ID": "G-LLLW9F9XPC", + "analyticsID": "UA-5828686-75" //legacy UA ID }