getProjectNamesMissingWarning.js 1.3 KB

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