update.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.UpdateCommand = void 0;
  4. const color_1 = require("../../lib/color");
  5. const base_1 = require("./base");
  6. class UpdateCommand extends base_1.CapacitorCommand {
  7. async getMetadata() {
  8. return {
  9. name: 'update',
  10. type: 'project',
  11. summary: 'Update Capacitor native platforms, install Capacitor/Cordova plugins',
  12. description: `
  13. ${(0, color_1.input)('ionic capacitor update')} will do the following:
  14. - Update Capacitor native platform(s) and dependencies
  15. - Install any discovered Capacitor or Cordova plugins
  16. `,
  17. inputs: [
  18. {
  19. name: 'platform',
  20. summary: `The platform to update (e.g. ${['android', 'ios'].map(v => (0, color_1.input)(v)).join(', ')})`,
  21. },
  22. ],
  23. };
  24. }
  25. async preRun(inputs, options, runinfo) {
  26. await this.preRunChecks(runinfo);
  27. if (inputs[0]) {
  28. await this.checkForPlatformInstallation(inputs[0]);
  29. }
  30. }
  31. async run(inputs, options) {
  32. const [platform] = inputs;
  33. const args = ['update'];
  34. if (platform) {
  35. args.push(platform);
  36. }
  37. await this.runCapacitor(args);
  38. }
  39. }
  40. exports.UpdateCommand = UpdateCommand;