GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
2.5 KiB

2 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const clc = require("colorette");
  5. const { marked } = require("marked");
  6. const TerminalRenderer = require("marked-terminal");
  7. const command_1 = require("../command");
  8. const extensionsHelper_1 = require("../extensions/extensionsHelper");
  9. const refs = require("../extensions/refs");
  10. const localHelper_1 = require("../extensions/localHelper");
  11. const publishHelpers_1 = require("../extensions/publishHelpers");
  12. const requireAuth_1 = require("../requireAuth");
  13. const error_1 = require("../error");
  14. const utils = require("../utils");
  15. marked.setOptions({
  16. renderer: new TerminalRenderer(),
  17. });
  18. exports.command = new command_1.Command("ext:dev:publish <extensionRef>")
  19. .description(`publish a new version of an extension`)
  20. .option(`-s, --stage <stage>`, `release stage (supports "rc", "alpha", "beta", and "stable")`)
  21. .withForce()
  22. .help("if you have not previously published a version of this extension, this will " +
  23. "create the extension. If you have previously published a version of this extension, this version must " +
  24. "be greater than previous versions.")
  25. .before(requireAuth_1.requireAuth)
  26. .action(async (extensionRef, options) => {
  27. var _a;
  28. const { publisherId, extensionId, version } = refs.parse(extensionRef);
  29. if (version) {
  30. throw new error_1.FirebaseError(`The input extension reference must be of the format ${clc.bold("<publisherId>/<extensionId>")}. Version should not be supplied and will be inferred directly from extension.yaml. Please increment the version in extension.yaml if you would like to bump/specify a version.`);
  31. }
  32. if (!publisherId || !extensionId) {
  33. throw new error_1.FirebaseError(`Error parsing publisher ID and extension ID from extension reference '${clc.bold(extensionRef)}'. Please use the format '${clc.bold("<publisherId>/<extensionId>")}'.`);
  34. }
  35. const extensionYamlDirectory = (0, localHelper_1.findExtensionYaml)(process.cwd());
  36. const res = await (0, extensionsHelper_1.publishExtensionVersionFromLocalSource)({
  37. publisherId,
  38. extensionId,
  39. rootDirectory: extensionYamlDirectory,
  40. nonInteractive: options.nonInteractive,
  41. force: options.force,
  42. stage: (_a = options.stage) !== null && _a !== void 0 ? _a : "stable",
  43. });
  44. if (res) {
  45. utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(`[Install Link](${(0, publishHelpers_1.consoleInstallLink)(res.ref)})`));
  46. }
  47. return res;
  48. });