From f262868588f649f638ec8ffb048dd9051e31b7a6 Mon Sep 17 00:00:00 2001 From: Rifa Achrinza <25147899+achrinza@users.noreply.github.com> Date: Sat, 22 Aug 2020 20:14:31 +0800 Subject: [PATCH] fix: monorepo, package metadata scripts' filepath on Windows Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com> --- bin/check-package-metadata.js | 4 ++-- bin/update-monorepo-file.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/check-package-metadata.js b/bin/check-package-metadata.js index da4260559946..41235096fa15 100644 --- a/bin/check-package-metadata.js +++ b/bin/check-package-metadata.js @@ -44,7 +44,7 @@ async function checkMonorepoFile(packages, rootPath) { const monorepoFile = await fs.readFile('docs/site/MONOREPO.md', 'utf8'); for (const p of packages) { - const packagePath = path.relative(rootPath, p.location); + const packagePath = path.relative(rootPath, p.location).replace(/\\/g, '/'); const packageExists = monorepoFile.includes(p.name) || monorepoFile.includes(packagePath); @@ -73,7 +73,7 @@ async function checkCodeOwnersFile(packages, rootPath) { continue; } - const packagePath = path.relative(rootPath, p.location); + const packagePath = path.relative(rootPath, p.location).replace(/\\/g, '/'); if (!codeOwnersFile.includes(packagePath)) { errors.push(`${p.name} is not added in the CODEOWNERS.md file`); diff --git a/bin/update-monorepo-file.js b/bin/update-monorepo-file.js index 4c45018adcdf..ad76cbe61b53 100644 --- a/bin/update-monorepo-file.js +++ b/bin/update-monorepo-file.js @@ -19,7 +19,7 @@ const MONOREPO_FILE_DIST = 'docs/site'; const MONOREPO_FILE_NAME = 'MONOREPO.md'; function getPackageRelativeUri(pkg) { - return path.relative(pkg.rootPath, pkg.location); + return path.relative(pkg.rootPath, pkg.location).replace(/\\/g, '/'); } async function getSortedPackages() {