diff --git a/packages/@ionic/cli/src/commands/deploy/build.ts b/packages/@ionic/cli/src/commands/deploy/build.ts index acd28c194a..208497b41f 100644 --- a/packages/@ionic/cli/src/commands/deploy/build.ts +++ b/packages/@ionic/cli/src/commands/deploy/build.ts @@ -13,6 +13,7 @@ import { input, strong, weak } from '../../lib/color'; import { Command } from '../../lib/command'; import { FatalException } from '../../lib/errors'; import { createRequest, download } from '../../lib/utils/http'; +import { IONIC_CLOUD_CLI_MIGRATION } from '../../lib/updates'; const debug = Debug('ionic:commands:deploy:build'); @@ -45,7 +46,7 @@ export class BuildCommand extends Command { return { name: 'build', type: 'project', - groups: [MetadataGroup.PAID], + groups: [MetadataGroup.PAID, MetadataGroup.DEPRECATED], summary: 'Create a deploy build on Appflow', description: ` This command creates a deploy build on Appflow. While the build is running, it prints the remote build log to the terminal. If the build is successful, it downloads the created web build zip file in the current directory. Downloading build artifacts can be skipped by supplying the flag ${input('skip-download')}. @@ -100,7 +101,11 @@ Customizing the build: }; } - async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise { + async preRun(inputs: CommandLineInputs, optinos: CommandLineOptions): Promise { + this.env.log.warn(IONIC_CLOUD_CLI_MIGRATION); + } + + async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise { if (!this.project) { throw new FatalException(`Cannot run ${input('ionic deploy build')} outside a project directory.`); } diff --git a/packages/@ionic/cli/src/commands/package/build.ts b/packages/@ionic/cli/src/commands/package/build.ts index 130b81b492..29a9c52202 100644 --- a/packages/@ionic/cli/src/commands/package/build.ts +++ b/packages/@ionic/cli/src/commands/package/build.ts @@ -14,6 +14,7 @@ import { Command } from '../../lib/command'; import { FatalException } from '../../lib/errors'; import { fileUtils } from '../../lib/utils/file'; import { createRequest, download } from '../../lib/utils/http'; +import { IONIC_CLOUD_CLI_MIGRATION } from '../../lib/updates'; const debug = Debug('ionic:commands:package:build'); const PLATFORMS = ['android', 'ios']; @@ -68,7 +69,7 @@ export class BuildCommand extends Command { return { name: 'build', type: 'project', - groups: [MetadataGroup.PAID], + groups: [MetadataGroup.PAID, MetadataGroup.DEPRECATED], summary: 'Create a package build on Appflow', description: ` This command creates a package build on Appflow. While the build is running, it prints the remote build log to the terminal. If the build is successful, it downloads the created app package file in the current directory. Downloading build artifacts can be skipped by supplying the flag ${input('skip-download')}. @@ -214,6 +215,8 @@ if you do not wish to download ${input('apk')}. } async preRun(inputs: CommandLineInputs, options: CommandLineOptions): Promise { + this.env.log.warn(IONIC_CLOUD_CLI_MIGRATION); + if (!inputs[0]) { const platformInput = await this.env.prompt({ type: 'list', diff --git a/packages/@ionic/cli/src/commands/package/deploy.ts b/packages/@ionic/cli/src/commands/package/deploy.ts index ae2f6ca73e..3712b0e669 100644 --- a/packages/@ionic/cli/src/commands/package/deploy.ts +++ b/packages/@ionic/cli/src/commands/package/deploy.ts @@ -15,6 +15,7 @@ import { isSuperAgentError } from '../../guards'; import { input, strong } from '../../lib/color'; import { Command } from '../../lib/command'; import { FatalException } from '../../lib/errors'; +import { IONIC_CLOUD_CLI_MIGRATION } from '../../lib/updates'; import { PackageBuild } from './build'; @@ -49,7 +50,7 @@ export class DeployCommand extends Command { return { name: 'deploy', type: 'project', - groups: [MetadataGroup.PAID], + groups: [MetadataGroup.PAID, MetadataGroup.DEPRECATED], summary: 'Deploys a binary to a destination, such as an app store using Appflow', description: ` This command deploys a binary to a destination using Appflow. While running, the remote log is printed to the terminal. @@ -84,6 +85,7 @@ Both can be retrieved from the Dashboard[^dashboard]. inputs: CommandLineInputs, options: CommandLineOptions ): Promise { + this.env.log.warn(IONIC_CLOUD_CLI_MIGRATION); if (!inputs[0]) { const buildIdInputInput = await this.env.prompt({ type: 'input', @@ -108,7 +110,7 @@ Both can be retrieved from the Dashboard[^dashboard]. async run( inputs: CommandLineInputs, options: CommandLineOptions - ): Promise { + ): Promise { if (!this.project) { throw new FatalException( `Cannot run ${input( diff --git a/packages/@ionic/cli/src/commands/package/index.ts b/packages/@ionic/cli/src/commands/package/index.ts index 9e756229d7..d86ce5b174 100644 --- a/packages/@ionic/cli/src/commands/package/index.ts +++ b/packages/@ionic/cli/src/commands/package/index.ts @@ -1,20 +1,22 @@ -import { MetadataGroup } from '@ionic/cli-framework'; +import { MetadataGroup, NamespaceMetadata } from '@ionic/cli-framework'; import { strong } from '../../lib/color'; import { CommandMap, Namespace } from '../../lib/namespace'; +import { IONIC_CLOUD_CLI_MIGRATION } from '../../lib/updates'; export class PackageNamespace extends Namespace { - async getMetadata() { + async getMetadata(): Promise { return { name: 'package', summary: 'Appflow package functionality', description: ` +${IONIC_CLOUD_CLI_MIGRATION} Interface to execute commands about package builds and deployments on Ionic Appflow. Appflow package documentation: - Overview: ${strong('https://ion.link/appflow-package-docs')} `, - groups: [MetadataGroup.PAID], + groups: [MetadataGroup.PAID, MetadataGroup.DEPRECATED], }; } diff --git a/packages/@ionic/cli/src/lib/color.ts b/packages/@ionic/cli/src/lib/color.ts index 54b379f1e1..e57bb07009 100644 --- a/packages/@ionic/cli/src/lib/color.ts +++ b/packages/@ionic/cli/src/lib/color.ts @@ -7,4 +7,4 @@ const HELP_COLORS: Partial = { export const COLORS: Colors = { ...DEFAULT_COLORS, help: { ...DEFAULT_COLORS.help, ...HELP_COLORS } }; -export const { strong, weak, input, success, failure, ancillary, help: { title } } = COLORS; +export const { strong, weak, input, success, failure, ancillary, help: { title }, log: { WARN } } = COLORS; diff --git a/packages/@ionic/cli/src/lib/updates.ts b/packages/@ionic/cli/src/lib/updates.ts index 376067c5fd..d2934f5da0 100644 --- a/packages/@ionic/cli/src/lib/updates.ts +++ b/packages/@ionic/cli/src/lib/updates.ts @@ -6,7 +6,7 @@ import * as semver from 'semver'; import { IConfig, IonicEnvironment } from '../definitions'; -import { input, success, weak } from './color'; +import { input, strong, success, weak, WARN } from './color'; import { sendMessage } from './helper'; import { pkgFromRegistry, pkgManagerArgs } from './utils/npm'; @@ -77,6 +77,13 @@ export async function runUpdateCheck({ config }: PersistPackageVersionsDeps): Pr await writeUpdateConfig(dir, newUpdateConfig); } +export const IONIC_CLOUD_CLI_MIGRATION = (() => +`${strong(WARN('Deprecated: Ionic Appflow functionality has moved to the new Ionic Cloud CLI'))}.\n`+ +`Existing functionality in the Ionic CLI is deprecated as of ${WARN('v6.18.0')}. `+ +`This functionality will be removed from the Ionic CLI in the next major version. `+ +`Please visit our simple guide to migrate to the Ionic Cloud CLI, available now.\n`+ +`${strong('https://ionic.io/docs/appflow/cli/migration/')}\n`)(); + export async function runNotify(env: IonicEnvironment, pkg: PersistedPackage, latestVersion: string): Promise { const dir = path.dirname(env.config.p); const args = await pkgManagerArgs(env.config.get('npmClient'), { command: 'install', pkg: pkg.name, global: true });