mirror of
https://github.com/strapi/strapi.git
synced 2025-08-09 01:07:27 +00:00

git-subtree-dir: packages/strapi-plugin-settings-manager git-subtree-mainline: 80aa83d8460c95366547e143c74bf79ea6ae69f8 git-subtree-split: cd241c14c6a6239bca279e7accd709ba58e87cc8
17 lines
432 B
JavaScript
17 lines
432 B
JavaScript
/**
|
|
* componentExists
|
|
*
|
|
* Check whether the given component exist in either the components or containers directory
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const pageComponents = fs.readdirSync('app/components');
|
|
const pageContainers = fs.readdirSync('app/containers');
|
|
const components = pageComponents.concat(pageContainers);
|
|
|
|
function componentExists(comp) {
|
|
return components.indexOf(comp) >= 0;
|
|
}
|
|
|
|
module.exports = componentExists;
|