diff --git a/aio/content/marketing/README.md b/aio/content/marketing/README.md index 67b249e55c..6733da3b84 100644 --- a/aio/content/marketing/README.md +++ b/aio/content/marketing/README.md @@ -1,26 +1,28 @@ # Contributors page -We have an official accounting of who is on the Angular Team, who are "trusted collaborators" (see team.angular.io/collaborators), and so on. +We have an official accounting of who is on the Angular Team, who are "trusted collaborators" (see https://team.angular.io/collaborators), and so on. -The contributors.json should be maintained to keep our "org chart" in a single consistent place. +The `contributors.json` should be maintained to keep our "org chart" in a single consistent place. ## GDE listings There are two pages: -https://developers.google.com/experts/all/technology/angular +- https://developers.google.com/experts/all/technology/angular (Googlers: source at http://google3/googledata/devsite/content/en/experts/all/technology/angular.html) which is maintained by Dawid Ostrowski based on a spreadsheet -https://docs.google.com/spreadsheets/d/1_Ls2Kle7NxPBIG8f3OEVZ4gJZ8OCTtBxGYwMPb1TUVE/edit#gid=0 +https://docs.google.com/spreadsheets/d/1_Ls2Kle7NxPBIG8f3OEVZ4gJZ8OCTtBxGYwMPb1TUVE/edit#gid=0. + -and ours: https://angular.io/about?group=GDE which is derived from contributors.json. +- Ours: https://angular.io/about?group=GDE which is derived from `contributors.json`. Alex Eagle is investigating how to reconcile these two lists. -## Checking the keys +## About the data -Keys in contributors.json should be GitHub handles. (Most currently are, but not all) -This will allow us to use GitHub as the default source for things like Name, Avatar, etc. +- Keys in `contributors.json` should be GitHub handles. (Most currently are, but not all.) + This will allow us to use GitHub as the default source for things like name, avatar, etc. +- Pictures are stored in `aio/content/images/bios/`. ## Processing the data @@ -32,3 +34,5 @@ do echo -e "\n$handle\n---------\n"; curl --silent -H "Authorization: token ${TO | jq ".message,.name,.company,.blog,.bio" --raw-output done ``` + +Relevant scripts are stored in `aio/scripts/contributors/`. diff --git a/aio/package.json b/aio/package.json index 10dc48c9ca..fa496762d6 100644 --- a/aio/package.json +++ b/aio/package.json @@ -44,7 +44,7 @@ "check-env": "yarn ~~check-env", "postcheck-env": "yarn aio-check-local", "payload-size": "scripts/payload.sh", - "predocs": "yarn generate-stackblitz && yarn generate-zips", + "predocs": "node scripts/contributors/check-pictures && yarn generate-stackblitz && yarn generate-zips", "docs": "yarn docs-only", "docs-only": "dgeni ./tools/transforms/angular.io-package", "docs-watch": "node tools/transforms/authors-package/watchr.js", diff --git a/aio/scripts/contributors/check-pictures.js b/aio/scripts/contributors/check-pictures.js new file mode 100644 index 0000000000..a3a656c469 --- /dev/null +++ b/aio/scripts/contributors/check-pictures.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node + +// Imports +const {existsSync, readFileSync} = require('fs'); +const {join, resolve} = require('path'); + +// Constants +const CONTENT_DIR = resolve(__dirname, '../../content'); +const IMAGES_DIR = join(CONTENT_DIR, 'images/bios'); +const CONTRIBUTORS_PATH = join(CONTENT_DIR, 'marketing/contributors.json'); + +// Run +_main(); + +// Functions - Definitions +function _main() { + const contributors = JSON.parse(readFileSync(CONTRIBUTORS_PATH, 'utf8')); + const expectedImages = Object.keys(contributors) + .filter(key => !!contributors[key].picture) + .map(key => join(IMAGES_DIR, contributors[key].picture)); + const missingImages = expectedImages.filter(path => !existsSync(path)); + + if (missingImages.length > 0) { + throw new Error( + 'The following pictures are referenced in \'contributors.json\' but do not exist:' + + missingImages.map(path => `\n - ${path}`).join('')); + } +}