UNPKG

1.29 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6exports.default = getProjectNamesMissingWarning;
7
8function _chalk() {
9 const data = _interopRequireDefault(require('chalk'));
10
11 _chalk = function () {
12 return data;
13 };
14
15 return data;
16}
17
18var _getProjectDisplayName = _interopRequireDefault(
19 require('./getProjectDisplayName')
20);
21
22function _interopRequireDefault(obj) {
23 return obj && obj.__esModule ? obj : {default: obj};
24}
25
26/**
27 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
28 *
29 * This source code is licensed under the MIT license found in the
30 * LICENSE file in the root directory of this source tree.
31 */
32function getProjectNamesMissingWarning(projectConfigs) {
33 const numberOfProjectsWithoutAName = projectConfigs.filter(
34 config => !(0, _getProjectDisplayName.default)(config)
35 ).length;
36
37 if (numberOfProjectsWithoutAName === 0) {
38 return undefined;
39 }
40
41 return _chalk().default.yellow(
42 `You provided values for --selectProjects 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}