UNPKG

1.45 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6exports.default = getProjectNamesMissingWarning;
7function _chalk() {
8 const data = _interopRequireDefault(require('chalk'));
9 _chalk = function () {
10 return data;
11 };
12 return data;
13}
14var _getProjectDisplayName = _interopRequireDefault(
15 require('./getProjectDisplayName')
16);
17function _interopRequireDefault(obj) {
18 return obj && obj.__esModule ? obj : {default: obj};
19}
20/**
21 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */
26
27function getProjectNamesMissingWarning(projectConfigs, opts) {
28 const numberOfProjectsWithoutAName = projectConfigs.filter(
29 config => !(0, _getProjectDisplayName.default)(config)
30 ).length;
31 if (numberOfProjectsWithoutAName === 0) {
32 return undefined;
33 }
34 const args = [];
35 if (opts.selectProjects) {
36 args.push('--selectProjects');
37 }
38 if (opts.ignoreProjects) {
39 args.push('--ignoreProjects');
40 }
41 return _chalk().default.yellow(
42 `You provided values for ${args.join(' and ')} but ${
43 numberOfProjectsWithoutAName === 1
44 ? 'a project does not have a name'
45 : `${numberOfProjectsWithoutAName} projects do not have a name`
46 }.\n` +
47 'Set displayName in the config of all projects in order to disable this warning.\n'
48 );
49}