Skip to content

Commit

Permalink
Update getPackagesPath to check into src if packges not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
jalal246 committed Feb 3, 2020
1 parent 4ce4d28 commit 40f6a0b
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -99,7 +94,11 @@ function extractPackagesInfo({
}
});

return packagesInfo.filter(Boolean);
const filtered = packagesInfo.filter(Boolean);

success(`> Done extracting ${filtered.length} packages`);

return filtered;
}

/**
Expand All @@ -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");

Expand Down

0 comments on commit 40f6a0b

Please sign in to comment.