Skip to content

Commit

Permalink
chore(cli): add deprecation notice for all electron commands (#3268)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jul 15, 2020
1 parent bfd9884 commit 5e84ce9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
5 changes: 5 additions & 0 deletions cli/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,3 +516,8 @@ export async function checkNPMVersion() {
}
return null;
}

export function electronWarning() {
logWarn(`The electron platform is deprecated!`);
log(`\nPlease use the Capacitor Community Electron Platform: https://github.com/capacitor-community/electron\n`);
}
7 changes: 1 addition & 6 deletions cli/src/tasks/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { addElectron } from '../electron/add';
import { addIOS, addIOSChecks } from '../ios/add';
import { editProjectSettingsAndroid } from '../android/common';
import { editProjectSettingsIOS } from '../ios/common';
import { check, checkAppConfig, checkPackage, checkWebDir, hasYarn, log, logError, logFatal, logInfo, logWarn, resolvePlatform, runCommand, runPlatformHook, runTask, writePrettyJSON } from '../common';
import { check, checkAppConfig, checkPackage, checkWebDir, electronWarning, hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runPlatformHook, runTask, writePrettyJSON } from '../common';
import { sync } from './sync';

import chalk from 'chalk';
Expand Down Expand Up @@ -134,8 +134,3 @@ function webWarning() {
log(`For example, if you have a React or Angular project, the 'web' platform is that project.`);
log(`To add Capacitor functionality to your web app, follow the Web Getting Started Guide: https://capacitorjs.com/docs/web`);
}

function electronWarning() {
logWarn(`The electron platform is deprecated!`);
log(`\nPlease use the Capacitor Community Electron Platform: https://github.com/capacitor-community/electron\n`);
}
3 changes: 2 additions & 1 deletion cli/src/tasks/copy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Config } from '../config';
import { checkWebDir, hasYarn, log, logError, logFatal, logInfo, resolveNode, resolvePlatform, runCommand, runPlatformHook, runTask } from '../common';
import { checkWebDir, electronWarning, hasYarn, log, logError, logFatal, logInfo, resolveNode, resolvePlatform, runPlatformHook, runTask } from '../common';
import { existsAsync } from '../util/fs';
import { allSerial } from '../util/promise';
import { copyWeb } from '../web/copy';
Expand Down Expand Up @@ -58,6 +58,7 @@ export async function copy(config: Config, platformName: string) {
} else if (platformName === config.electron.name) {
await copyElectron(config);
await copyCapacitorConfig(config, config.electron.platformDir);
electronWarning();
} else {
throw `Platform ${platformName} is not valid.`;
}
Expand Down
3 changes: 2 additions & 1 deletion cli/src/tasks/doctor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Config } from '../config';
import { log, readJSON, resolveNode, resolveNodeFrom, runCommand } from '../common';
import { electronWarning, log, readJSON, resolveNode, resolveNodeFrom, runCommand } from '../common';
import { doctorAndroid } from '../android/doctor';
import { doctorElectron } from '../electron/doctor';
import { doctorIOS } from '../ios/doctor';
Expand Down Expand Up @@ -67,6 +67,7 @@ export async function doctor(config: Config, platformName: string) {
await doctorAndroid(config);
} else if (platformName === config.electron.name) {
await doctorElectron(config);
electronWarning();
} else if (platformName === config.web.name) {
return Promise.resolve();
} else {
Expand Down
3 changes: 2 additions & 1 deletion cli/src/tasks/open.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Config } from '../config';
import { hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runPlatformHook, runTask } from '../common';
import { electronWarning, hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runPlatformHook, runTask } from '../common';
import { openAndroid } from '../android/open';
import { openElectron } from '../electron/open';
import { openIOS } from '../ios/open';
Expand Down Expand Up @@ -44,6 +44,7 @@ export async function open(config: Config, platformName: string) {
} else if (platformName === config.web.name) {
return Promise.resolve();
} else if (platformName === config.electron.name) {
electronWarning();
return openElectron(config);
} else {
throw `Platform ${platformName} is not valid.`;
Expand Down
3 changes: 2 additions & 1 deletion cli/src/tasks/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Config } from '../config';
import { updateAndroid } from '../android/update';
import { updateIOS, updateIOSChecks } from '../ios/update';
import { allSerial } from '../util/promise';
import { CheckFunction, check, checkPackage, hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runCommand, runPlatformHook, runTask } from '../common';
import { CheckFunction, check, checkPackage, electronWarning, hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runCommand, runPlatformHook, runTask } from '../common';

import chalk from 'chalk';

Expand Down Expand Up @@ -48,6 +48,7 @@ export function updateChecks(config: Config, platforms: string[]): CheckFunction
} else if (platformName === config.web.name) {
return [];
} else if (platformName === config.electron.name) {
electronWarning();
return [];
} else {
throw `Platform ${platformName} is not valid.`;
Expand Down

0 comments on commit 5e84ce9

Please sign in to comment.