summaryrefslogtreecommitdiffstats
path: root/front/odiparpack/internals/generators/utils/componentExists.js
blob: 8cd13d95dd2f087e27f3c28c961836cea7aa232a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * componentExists
 *
 * Check whether the given component exist in either the components or containers directory
 */

const fs = require('fs');
const path = require('path');
const pageComponents = fs.readdirSync(
  path.join(__dirname, '../../../app/components'),
);
const pageContainers = fs.readdirSync(
  path.join(__dirname, '../../../app/containers'),
);
const components = pageComponents.concat(pageContainers);

function componentExists(comp) {
  return components.indexOf(comp) >= 0;
}

module.exports = componentExists;