1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true
|
5 | });
|
6 | exports.default = getConfigsOfProjectsToRun;
|
7 | var _getProjectDisplayName = _interopRequireDefault(
|
8 | require('./getProjectDisplayName')
|
9 | );
|
10 | function _interopRequireDefault(obj) {
|
11 | return obj && obj.__esModule ? obj : {default: obj};
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | function getConfigsOfProjectsToRun(projectConfigs, opts) {
|
21 | const projectFilter = createProjectFilter(opts);
|
22 | return projectConfigs.filter(config => {
|
23 | const name = (0, _getProjectDisplayName.default)(config);
|
24 | return projectFilter(name);
|
25 | });
|
26 | }
|
27 | function createProjectFilter(opts) {
|
28 | const {selectProjects, ignoreProjects} = opts;
|
29 | const always = () => true;
|
30 | const selected = selectProjects
|
31 | ? name => name && selectProjects.includes(name)
|
32 | : always;
|
33 | const notIgnore = ignoreProjects
|
34 | ? name => !(name && ignoreProjects.includes(name))
|
35 | : always;
|
36 | function test(name) {
|
37 | return selected(name) && notIgnore(name);
|
38 | }
|
39 | return test;
|
40 | }
|