Skip to content

Commit 6a39641

Browse files
authored
feat(appflow): deprecate appflow functionality in @ionic/cli (#4776)
1 parent 56dd8a7 commit 6a39641

File tree

6 files changed

+29
-10
lines changed

6 files changed

+29
-10
lines changed

packages/@ionic/cli/src/commands/deploy/build.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { input, strong, weak } from '../../lib/color';
1313
import { Command } from '../../lib/command';
1414
import { FatalException } from '../../lib/errors';
1515
import { createRequest, download } from '../../lib/utils/http';
16+
import { IONIC_CLOUD_CLI_MIGRATION } from '../../lib/updates';
1617

1718
const debug = Debug('ionic:commands:deploy:build');
1819

@@ -45,7 +46,7 @@ export class BuildCommand extends Command {
4546
return {
4647
name: 'build',
4748
type: 'project',
48-
groups: [MetadataGroup.PAID],
49+
groups: [MetadataGroup.PAID, MetadataGroup.DEPRECATED],
4950
summary: 'Create a deploy build on Appflow',
5051
description: `
5152
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:
100101
};
101102
}
102103

103-
async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
104+
async preRun(inputs: CommandLineInputs, optinos: CommandLineOptions): Promise<void> {
105+
this.env.log.warn(IONIC_CLOUD_CLI_MIGRATION);
106+
}
107+
108+
async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
104109
if (!this.project) {
105110
throw new FatalException(`Cannot run ${input('ionic deploy build')} outside a project directory.`);
106111
}

packages/@ionic/cli/src/commands/package/build.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Command } from '../../lib/command';
1414
import { FatalException } from '../../lib/errors';
1515
import { fileUtils } from '../../lib/utils/file';
1616
import { createRequest, download } from '../../lib/utils/http';
17+
import { IONIC_CLOUD_CLI_MIGRATION } from '../../lib/updates';
1718

1819
const debug = Debug('ionic:commands:package:build');
1920
const PLATFORMS = ['android', 'ios'];
@@ -68,7 +69,7 @@ export class BuildCommand extends Command {
6869
return {
6970
name: 'build',
7071
type: 'project',
71-
groups: [MetadataGroup.PAID],
72+
groups: [MetadataGroup.PAID, MetadataGroup.DEPRECATED],
7273
summary: 'Create a package build on Appflow',
7374
description: `
7475
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')}.
214215
}
215216

216217
async preRun(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
218+
this.env.log.warn(IONIC_CLOUD_CLI_MIGRATION);
219+
217220
if (!inputs[0]) {
218221
const platformInput = await this.env.prompt({
219222
type: 'list',

packages/@ionic/cli/src/commands/package/deploy.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { isSuperAgentError } from '../../guards';
1515
import { input, strong } from '../../lib/color';
1616
import { Command } from '../../lib/command';
1717
import { FatalException } from '../../lib/errors';
18+
import { IONIC_CLOUD_CLI_MIGRATION } from '../../lib/updates';
1819

1920
import { PackageBuild } from './build';
2021

@@ -49,7 +50,7 @@ export class DeployCommand extends Command {
4950
return {
5051
name: 'deploy',
5152
type: 'project',
52-
groups: [MetadataGroup.PAID],
53+
groups: [MetadataGroup.PAID, MetadataGroup.DEPRECATED],
5354
summary: 'Deploys a binary to a destination, such as an app store using Appflow',
5455
description: `
5556
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].
8485
inputs: CommandLineInputs,
8586
options: CommandLineOptions
8687
): Promise<void> {
88+
this.env.log.warn(IONIC_CLOUD_CLI_MIGRATION);
8789
if (!inputs[0]) {
8890
const buildIdInputInput = await this.env.prompt({
8991
type: 'input',
@@ -108,7 +110,7 @@ Both can be retrieved from the Dashboard[^dashboard].
108110
async run(
109111
inputs: CommandLineInputs,
110112
options: CommandLineOptions
111-
): Promise<void> {
113+
): Promise<void> {
112114
if (!this.project) {
113115
throw new FatalException(
114116
`Cannot run ${input(

packages/@ionic/cli/src/commands/package/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
import { MetadataGroup } from '@ionic/cli-framework';
1+
import { MetadataGroup, NamespaceMetadata } from '@ionic/cli-framework';
22

33
import { strong } from '../../lib/color';
44
import { CommandMap, Namespace } from '../../lib/namespace';
5+
import { IONIC_CLOUD_CLI_MIGRATION } from '../../lib/updates';
56

67
export class PackageNamespace extends Namespace {
7-
async getMetadata() {
8+
async getMetadata(): Promise<NamespaceMetadata> {
89
return {
910
name: 'package',
1011
summary: 'Appflow package functionality',
1112
description: `
13+
${IONIC_CLOUD_CLI_MIGRATION}
1214
Interface to execute commands about package builds and deployments on Ionic Appflow.
1315
1416
Appflow package documentation:
1517
- Overview: ${strong('https://ion.link/appflow-package-docs')}
1618
`,
17-
groups: [MetadataGroup.PAID],
19+
groups: [MetadataGroup.PAID, MetadataGroup.DEPRECATED],
1820
};
1921
}
2022

packages/@ionic/cli/src/lib/color.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ const HELP_COLORS: Partial<HelpColors> = {
77

88
export const COLORS: Colors = { ...DEFAULT_COLORS, help: { ...DEFAULT_COLORS.help, ...HELP_COLORS } };
99

10-
export const { strong, weak, input, success, failure, ancillary, help: { title } } = COLORS;
10+
export const { strong, weak, input, success, failure, ancillary, help: { title }, log: { WARN } } = COLORS;

packages/@ionic/cli/src/lib/updates.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as semver from 'semver';
66

77
import { IConfig, IonicEnvironment } from '../definitions';
88

9-
import { input, success, weak } from './color';
9+
import { input, strong, success, weak, WARN } from './color';
1010
import { sendMessage } from './helper';
1111
import { pkgFromRegistry, pkgManagerArgs } from './utils/npm';
1212

@@ -77,6 +77,13 @@ export async function runUpdateCheck({ config }: PersistPackageVersionsDeps): Pr
7777
await writeUpdateConfig(dir, newUpdateConfig);
7878
}
7979

80+
export const IONIC_CLOUD_CLI_MIGRATION = (() =>
81+
`${strong(WARN('Deprecated: Ionic Appflow functionality has moved to the new Ionic Cloud CLI'))}.\n`+
82+
`Existing functionality in the Ionic CLI is deprecated as of ${WARN('v6.18.0')}. `+
83+
`This functionality will be removed from the Ionic CLI in the next major version. `+
84+
`Please visit our simple guide to migrate to the Ionic Cloud CLI, available now.\n`+
85+
`${strong('https://ionic.io/docs/appflow/cli/migration/')}\n`)();
86+
8087
export async function runNotify(env: IonicEnvironment, pkg: PersistedPackage, latestVersion: string): Promise<void> {
8188
const dir = path.dirname(env.config.p);
8289
const args = await pkgManagerArgs(env.config.get('npmClient'), { command: 'install', pkg: pkg.name, global: true });

0 commit comments

Comments
 (0)