123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- const tslib_1 = require("tslib");
- const chalk_1 = require("chalk");
- const cli_utils_1 = require("@ionic/cli-utils");
- const command_1 = require("@ionic/cli-utils/lib/command");
- const app_scripts_1 = require("@ionic/cli-utils/lib/ionic-angular/app-scripts");
- 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/')}`;
- let UploadCommand = class UploadCommand extends command_1.Command {
- resolveNote(input) {
- if (typeof input !== 'string') {
- input = undefined;
- }
- return input;
- }
- resolveMetaData(input) {
- if (typeof input !== 'string') {
- input = undefined;
- }
- return input ? JSON.parse(input) : undefined;
- }
- resolveChannelTag(input) {
- if (typeof input !== 'string') {
- input = undefined;
- }
- else if (input === '') {
- input = 'dev';
- }
- return input;
- }
- preRun(inputs, options) {
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
- if (options['nobuild']) {
- options['build'] = false;
- }
- });
- }
- run(inputs, options) {
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
- const { promptToLogin } = yield Promise.resolve().then(() => require('@ionic/cli-utils/lib/session'));
- const { upload } = yield Promise.resolve().then(() => require('@ionic/cli-utils/lib/upload'));
- this.env.log.warn(DEPRECATION_NOTICE);
- const note = this.resolveNote(options['note']);
- const channelTag = this.resolveChannelTag(options['deploy']);
- const metadata = this.resolveMetaData(options['metadata']);
- if (!(yield this.env.session.isLoggedIn())) {
- yield promptToLogin(this.env);
- }
- if (options['build']) {
- const { build } = yield Promise.resolve().then(() => require('@ionic/cli-utils/commands/build'));
- yield build(this.env, inputs, options);
- }
- yield upload(this.env, { note, channelTag, metadata });
- });
- }
- };
- UploadCommand = tslib_1.__decorate([
- command_1.CommandMetadata({
- name: 'upload',
- type: 'project',
- backends: [cli_utils_1.BACKEND_LEGACY],
- deprecated: true,
- description: 'Upload a new snapshot of your app',
- longDescription: `
- ${chalk_1.default.bold.yellow('WARNING')}: ${DEPRECATION_NOTICE}
-
- Zips up your local app files and uploads a snapshot to Ionic.
-
- 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.
- `,
- exampleCommands: [
- '',
- '--deploy=dev',
- `--deploy=production --note="add menu entry" --metadata="{\\"custom_data\\":true}"`,
- ],
- options: [
- {
- name: 'note',
- description: 'Give this snapshot a nice description',
- },
- {
- name: 'deploy',
- description: 'Deploys this snapshot to the given channel',
- },
- {
- name: 'metadata',
- description: 'Set custom metadata JSON for the deploy',
- advanced: true,
- },
- {
- name: 'build',
- description: 'Do not invoke an Ionic build',
- type: Boolean,
- default: true,
- },
- ...app_scripts_1.APP_SCRIPTS_OPTIONS,
- ],
- })
- ], UploadCommand);
- exports.UploadCommand = UploadCommand;
|