From eb54e925099c65bdf0f50b56e199b9f75b32dcd0 Mon Sep 17 00:00:00 2001 From: Julia Date: Sun, 17 Feb 2019 15:40:23 -0500 Subject: [PATCH] fix: create docs/en/packages folder in copy-package-readme.js script if said folder doesn't exist --- build/documentation/copy-package-readme.js | 22 +++++++++++++++------- website/sidebars.json | 1 - 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/build/documentation/copy-package-readme.js b/build/documentation/copy-package-readme.js index 2f99e6d9fbd..3187291c84a 100644 --- a/build/documentation/copy-package-readme.js +++ b/build/documentation/copy-package-readme.js @@ -42,9 +42,11 @@ process.argv.forEach(function (val, index) { */ function copyReadmeFiles() { - if (dryRun) console.log("In docs/en/packages/, this script would..."); - const resolvedSrcReadmePaths = path.resolve(rootDir, srcReadmePaths); + + if (dryRun) console.log(`For ${destDir}, this script would...`); + + createDirectory(destDir); glob(resolvedSrcReadmePaths, {realpath:true}, function(error, srcFiles) { srcFiles.forEach((srcReadmePath) => { @@ -91,18 +93,14 @@ function createDestReadme(srcReadmePath) { `sidebar_label: ${title}\n` + `---\n\n`; - if (!fs.existsSync(destDirPath)) { - dryRun ? console.log(`...CREATE folder '${folderName}'`) : fs.mkdirSync(destDirPath); - } + createDirectory(destDirPath); if (dryRun) { - if (fs.existsSync(destReadmePath)) { console.log(`...REPLACE readme.md in the '${folderName}' folder`); } else { console.log(`...ADD readme.md into the '${folderName}' folder`); } - } else { try { fs.writeFileSync(destReadmePath, docusaurusHeader); @@ -140,6 +138,16 @@ function updateSidebar() { } +/** + * Utility function that creates new folders + * based off destination argument + */ +function createDirectory(dir) { + if (!fs.existsSync(dir)) { + dryRun ? console.log(`...CREATE the '${dir}' folder.`) : fs.mkdirSync(dir); + } +} + /** * Run script * Based off presence of --dry-run parameter diff --git a/website/sidebars.json b/website/sidebars.json index 43d5359c4d2..216f77c12ff 100644 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -35,7 +35,6 @@ "en/packages/fast-markdown-msft-react/index", "en/packages/fast-navigation-generator-react/index", "en/packages/fast-permutator/index", - "en/packages/fast-sketch-library/index", "en/packages/fast-tslint-rules/index", "en/packages/fast-viewer-react/index", "en/packages/fast-web-utilities/index"