From ed9c5efe4ad43c36004426a4f01475d46cc794e6 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Thu, 3 Sep 2020 10:53:14 -0700 Subject: [PATCH] fix(docs): make sure image files are copied with README.md Signed-off-by: Raymond Feng --- docs/bin/copy-readmes.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/bin/copy-readmes.js b/docs/bin/copy-readmes.js index 1794f32d47ea..461296555684 100644 --- a/docs/bin/copy-readmes.js +++ b/docs/bin/copy-readmes.js @@ -37,9 +37,20 @@ async function copyReadmes() { })); for (const {location} of packages) { - const src = path.join(REPO_ROOT, location, 'README.md'); - const dest = path.join(DEST_ROOT, location, 'README.md'); - await fs.copy(src, dest, {overwrite: true}); + let files = await fs.readdir(path.join(REPO_ROOT, location)); + files = files.filter( + // Copy README.md and image files + f => + f === 'README.md' || + ['.png', '.jpg', 'jpeg'].includes(path.extname(f).toLowerCase()), + ); + for (const f of files) { + await fs.copy( + path.join(REPO_ROOT, location, f), + path.join(DEST_ROOT, location, f), + {overwrite: true}, + ); + } } }