nprapps / book-concierge

A concierge for every year
https://apps.npr.org/best-books/
Other
34 stars 12 forks source link

book-concierge

This news app is built on our interactive template <https://github.com/nprapps/interactive-template>_. Check the readme for that template for more details about the structure and mechanics of the app, as well as how to start your own project.

Getting started

To run this project you will need:

With those installed, you can then set the project up using your terminal:

  1. Pull the code - git clone git@github.com:nprapps/book-concierge
  2. Enter the project folder - cd book-concierge
  3. Install dependencies from NPM - npm install
  4. Pull data and covers: grunt update
  5. Start the server - grunt

Optional flags

To start the local server and just include 2022's data, you would run grunt --year=2022

Running tasks

Like all interactive-template projects, this application uses the Grunt task runner to handle various build steps and deployment processes. To see all tasks available, run grunt --help. grunt by itself will run the "default" task, which processes data and starts the development server. However, you can also specify a list of steps as arguments to Grunt, and it will run those in sequence. For example, you can just update the JavaScript and CSS assets in the build folder by using grunt bundle less.

Common tasks that you may want to run include:

Useful NPR-specific combinations of tasks:

Book metadata

Each of these tasks outputs a CSV in the /temp/ folder in your project. Upload this file to a scratch sheet in the main project spreadsheet. Link it up to the main datasheet for this year via VLOOKUP. (Use the id column as the key to match them up.)

Neither of these tasks will return information for all of the books on the list. The Books team will need to fill in what's missing and validate what's returned.

Book covers

This task will not be useful until you've completed the Amazon scrape and pulled the resulting info into this year's data sheet.

Troubleshooting: If you sync up a cover and then it turns out to be the wrong cover, you may need to go into S3 and delete the old incorrect cover for the new one to sync up correctly. Sync sometimes doesn’t recognize it needs to push a file if a file already exists on S3 that is the same size/name.

Not a task, but related to this:

Generating a book cover tile promo image

Add ?screenshot=1 to the URL before the hash params (so, for example: https://apps.npr.org/best-books/?screenshot=1#view=covers&year=2020) to get a dense view of the photo grid. Take a screenshot using a Retina display, for maximum pixels.

You can adjust the density of the grid in seed.less.

Analytics

The concierge tracks the following events:

Schema

The application expects to have access to a Google Doc with the text for the about page, as well as a workbook containing book data. There are four named sheets that the app expects to exist, with the following columns:

Troubleshooting

Fatal error: Port 35739 is already in use by another process.

The live reload port is shared between this and other applications. If you're running another interactive-template project or Dailygraphics Next, they may collide. If that's the case, use --reload-port=XXXXX to set a different port for the live reload server. You can also specify a port for the webserver with --port=XXXX, although the app will automatically find the first available port after 8000 for you.