Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const command_1 = require("../command");
  5. const error_1 = require("../error");
  6. const projects_1 = require("../management/projects");
  7. const prompt_1 = require("../prompt");
  8. const requireAuth_1 = require("../requireAuth");
  9. exports.command = new command_1.Command("projects:create [projectId]")
  10. .description("creates a new Google Cloud Platform project, then adds Firebase resources to the project")
  11. .option("-n, --display-name <displayName>", "(optional) display name for the project")
  12. .option("-o, --organization <organizationId>", "(optional) ID of the parent Google Cloud Platform organization under which to create this project")
  13. .option("-f, --folder <folderId>", "(optional) ID of the parent Google Cloud Platform folder in which to create this project")
  14. .before(requireAuth_1.requireAuth)
  15. .action(async (projectId, options) => {
  16. options.projectId = projectId;
  17. if (options.organization && options.folder) {
  18. throw new error_1.FirebaseError("Invalid argument, please provide only one type of project parent (organization or folder)");
  19. }
  20. if (!options.nonInteractive) {
  21. await (0, prompt_1.prompt)(options, projects_1.PROJECTS_CREATE_QUESTIONS);
  22. }
  23. if (!options.projectId) {
  24. throw new error_1.FirebaseError("Project ID cannot be empty");
  25. }
  26. let parentResource;
  27. if (options.organization) {
  28. parentResource = { type: projects_1.ProjectParentResourceType.ORGANIZATION, id: options.organization };
  29. }
  30. else if (options.folder) {
  31. parentResource = { type: projects_1.ProjectParentResourceType.FOLDER, id: options.folder };
  32. }
  33. return (0, projects_1.createFirebaseProjectAndLog)(options.projectId, {
  34. displayName: options.displayName,
  35. parentResource,
  36. });
  37. });