From 40f6a0ba1f212adcd6d11dde6f1f919a82cd4395 Mon Sep 17 00:00:00 2001 From: jalal246 Date: Mon, 3 Feb 2020 17:27:40 +0200 Subject: [PATCH] Update getPackagesPath to check into src if packges not found. --- src/utils/utils.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index 38a6a3c..ff08049 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -20,13 +20,20 @@ function getPackagesPath({ path = "./packages/*" } = {}) { folders = glob.sync(path); + /** + * If length is zero, not monorepo. + */ if (folders.length === 0) { - msg(`nothing found in given path: ${path}`); + try { + fs.accessSync("./src", fs.constants.R_OK); + } catch (e) { + error(e); + } - return []; + folders.push("."); } - success(`> found ${folders.length} packages`); + success(`> Found ${folders.length} packages`); return folders; } @@ -56,18 +63,6 @@ function extractPackagesInfo({ } = {}) { msg("Reading package.json and setting packages paths"); - if (packages.length === 0) { - warning("packages array is empty try looking into src"); - - try { - fs.accessSync("./src", fs.constants.R_OK); - } catch (e) { - error(e); - } - - packages.push("."); - } - const packagesInfo = packages.map(pkg => { const path = resolve(pkg, "package.json"); @@ -99,7 +94,11 @@ function extractPackagesInfo({ } }); - return packagesInfo.filter(Boolean); + const filtered = packagesInfo.filter(Boolean); + + success(`> Done extracting ${filtered.length} packages`); + + return filtered; } /** @@ -115,6 +114,7 @@ function cleanBuildDir({ } = {}) { msg("Clearing if there is any..."); + console.log(packages); if (packages.length === 0) { warning("packages array is empty try looking into src");