UI for Zipcoin Blue

upload.js 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const tslib_1 = require("tslib");
  4. const chalk_1 = require("chalk");
  5. const cli_utils_1 = require("@ionic/cli-utils");
  6. const command_1 = require("@ionic/cli-utils/lib/command");
  7. const app_scripts_1 = require("@ionic/cli-utils/lib/ionic-angular/app-scripts");
  8. const DEPRECATION_NOTICE = `Ionic Cloud is deprecated and will reach end-of-life on January 31st, 2018. This command will not be supported afterwards. Ionic Pro takes a different approach to uploading. See the Getting Started documentation for details: ${chalk_1.default.bold('https://ionicframework.com/docs/pro/basics/getting-started/')}`;
  9. let UploadCommand = class UploadCommand extends command_1.Command {
  10. resolveNote(input) {
  11. if (typeof input !== 'string') {
  12. input = undefined;
  13. }
  14. return input;
  15. }
  16. resolveMetaData(input) {
  17. if (typeof input !== 'string') {
  18. input = undefined;
  19. }
  20. return input ? JSON.parse(input) : undefined;
  21. }
  22. resolveChannelTag(input) {
  23. if (typeof input !== 'string') {
  24. input = undefined;
  25. }
  26. else if (input === '') {
  27. input = 'dev';
  28. }
  29. return input;
  30. }
  31. preRun(inputs, options) {
  32. return tslib_1.__awaiter(this, void 0, void 0, function* () {
  33. if (options['nobuild']) {
  34. options['build'] = false;
  35. }
  36. });
  37. }
  38. run(inputs, options) {
  39. return tslib_1.__awaiter(this, void 0, void 0, function* () {
  40. const { promptToLogin } = yield Promise.resolve().then(() => require('@ionic/cli-utils/lib/session'));
  41. const { upload } = yield Promise.resolve().then(() => require('@ionic/cli-utils/lib/upload'));
  42. this.env.log.warn(DEPRECATION_NOTICE);
  43. const note = this.resolveNote(options['note']);
  44. const channelTag = this.resolveChannelTag(options['deploy']);
  45. const metadata = this.resolveMetaData(options['metadata']);
  46. if (!(yield this.env.session.isLoggedIn())) {
  47. yield promptToLogin(this.env);
  48. }
  49. if (options['build']) {
  50. const { build } = yield Promise.resolve().then(() => require('@ionic/cli-utils/commands/build'));
  51. yield build(this.env, inputs, options);
  52. }
  53. yield upload(this.env, { note, channelTag, metadata });
  54. });
  55. }
  56. };
  57. UploadCommand = tslib_1.__decorate([
  58. command_1.CommandMetadata({
  59. name: 'upload',
  60. type: 'project',
  61. backends: [cli_utils_1.BACKEND_LEGACY],
  62. deprecated: true,
  63. description: 'Upload a new snapshot of your app',
  64. longDescription: `
  65. ${chalk_1.default.bold.yellow('WARNING')}: ${DEPRECATION_NOTICE}
  66. Zips up your local app files and uploads a snapshot to Ionic.
  67. From there, you can use Ionic View (${chalk_1.default.bold('https://ionicframework.com/products/view')}) to easily share your app with your organization and testers around the world.
  68. `,
  69. exampleCommands: [
  70. '',
  71. '--deploy=dev',
  72. `--deploy=production --note="add menu entry" --metadata="{\\"custom_data\\":true}"`,
  73. ],
  74. options: [
  75. {
  76. name: 'note',
  77. description: 'Give this snapshot a nice description',
  78. },
  79. {
  80. name: 'deploy',
  81. description: 'Deploys this snapshot to the given channel',
  82. },
  83. {
  84. name: 'metadata',
  85. description: 'Set custom metadata JSON for the deploy',
  86. advanced: true,
  87. },
  88. {
  89. name: 'build',
  90. description: 'Do not invoke an Ionic build',
  91. type: Boolean,
  92. default: true,
  93. },
  94. ...app_scripts_1.APP_SCRIPTS_OPTIONS,
  95. ],
  96. })
  97. ], UploadCommand);
  98. exports.UploadCommand = UploadCommand;