Skip to content

Commit

Permalink
chore: remove electron platform
Browse files Browse the repository at this point in the history
ref #3140
  • Loading branch information
imhoffd committed Jul 16, 2020
1 parent bad69bc commit 21da8cf
Show file tree
Hide file tree
Showing 36 changed files with 9 additions and 1,274 deletions.
7 changes: 1 addition & 6 deletions cli/scripts/copy-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ const ANDROID_TEMPLATE = 'android-template';
const ANDROID_TEMPLATE_SRC = path.join(MONOREPO_ROOT, ANDROID_TEMPLATE);
const ANDROID_TEMPLATE_DST = path.join(ASSETS_DIST, ANDROID_TEMPLATE);

const ELECTRON_TEMPLATE = 'electron-template';
const ELECTRON_TEMPLATE_SRC = path.join(MONOREPO_ROOT, ELECTRON_TEMPLATE);
const ELECTRON_TEMPLATE_DST = path.join(ASSETS_DIST, ELECTRON_TEMPLATE);

const IOS_TEMPLATE = 'ios-template';
const IOS_TEMPLATE_SRC = path.join(MONOREPO_ROOT, IOS_TEMPLATE);
const IOS_TEMPLATE_DST = path.join(ASSETS_DIST, IOS_TEMPLATE);
Expand All @@ -40,7 +36,6 @@ fs.copySync(APP_TEMPLATE_SRC, APP_TEMPLATE_DST);
fs.copySync(ANDROID_TEMPLATE_SRC, ANDROID_TEMPLATE_DST);
replaceAndroidModule();
fs.copySync(IOS_TEMPLATE_SRC, IOS_TEMPLATE_DST);
fs.copySync(ELECTRON_TEMPLATE_SRC, ELECTRON_TEMPLATE_DST);
fs.copySync(PLUGIN_TEMPLATE_SRC, PLUGIN_TEMPLATE_DST);
fs.copySync(ANDROID_PLUGINS_FOLDER_SRC, ANDROID_PLUGINS_FOLDER_DST);
fs.copySync(IOS_PLUGINS_FOLDER_SRC, IOS_PLUGINS_FOLDER_DST);
Expand All @@ -64,4 +59,4 @@ function replaceAndroidModule() {
workspaceXml = workspaceXml.replace(/android-template/g, 'android');
fs.writeFileSync(workspaceXmlPath, workspaceXml);
}
}
}
6 changes: 0 additions & 6 deletions cli/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ export async function printNextSteps(config: Config, appDir: string) {
log(`Add platforms using "npx cap add":\n`);
log(` npx cap add android`);
log(` npx cap add ios`);
log(` npx cap add electron`);
log('');
log(`Follow the Developer Workflow guide to get building:\n${chalk.bold(`https://capacitorjs.com/docs/basics/workflow`)}\n`);
}
Expand Down Expand Up @@ -516,8 +515,3 @@ 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`);
}
23 changes: 0 additions & 23 deletions cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ export class Config implements CliConfig {
androidStudioPath: '/usr/local/android-studio/bin/studio.sh'
};

electron = {
name: 'electron',
platformDir: '',
webDir: 'app',
webDirAbs: '',
assets: {
templateName: 'electron-template',
templateDir: ''
}
};

android = {
name: 'android',
minVersion: '21',
Expand Down Expand Up @@ -135,7 +124,6 @@ export class Config implements CliConfig {

// Post-merge
this.initAndroidConfig();
this.initElectronConfig();
this.initIosConfig();
this.initWindowsConfig();
this.initLinuxConfig();
Expand Down Expand Up @@ -164,13 +152,6 @@ export class Config implements CliConfig {
this.app.package = await readJSON(resolve(this.app.rootDir, 'package.json'));
}

private initElectronConfig() {
this.platforms.push(this.electron.name);
this.electron.platformDir = resolve(this.app.rootDir, this.electron.name);
this.electron.assets.templateDir = resolve(this.cli.assetsDir, this.electron.assets.templateName);
this.electron.webDirAbs = resolve(this.electron.platformDir, this.electron.webDir);
}

private initAndroidConfig() {
this.platforms.push(this.android.name);
this.android.platformDir = resolve(this.app.rootDir, this.android.name);
Expand Down Expand Up @@ -301,10 +282,6 @@ export class Config implements CliConfig {
platforms.push(this.ios.name);
}

if (this.platformDirExists(this.electron.name)) {
platforms.push(this.electron.name);
}

platforms.push(this.web.name);

return platforms;
Expand Down
34 changes: 0 additions & 34 deletions cli/src/electron/add.ts

This file was deleted.

15 changes: 0 additions & 15 deletions cli/src/electron/copy.ts

This file was deleted.

53 changes: 0 additions & 53 deletions cli/src/electron/doctor.ts

This file was deleted.

27 changes: 0 additions & 27 deletions cli/src/electron/open.ts

This file was deleted.

9 changes: 1 addition & 8 deletions cli/src/tasks/add.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Config } from '../config';
import { OS } from '../definitions';
import { addAndroid } from '../android/add';
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, electronWarning, hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runPlatformHook, runTask, writePrettyJSON } from '../common';
import { check, checkAppConfig, checkPackage, checkWebDir, hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runPlatformHook, runTask, writePrettyJSON } from '../common';
import { sync } from './sync';

import chalk from 'chalk';
Expand All @@ -29,8 +28,6 @@ export async function addCommand(config: Config, selectedPlatformName: string) {
if (platformName === config.web.name) {
webWarning();
return;
} else if (platformName === config.electron.name) {
electronWarning();
}

const existingPlatformDir = config.platformDirExists(platformName);
Expand Down Expand Up @@ -93,8 +90,6 @@ export function addChecks(config: Config, platformName: string) {
return [];
} else if (platformName === config.web.name) {
return [];
} else if (platformName === config.electron.name) {
return [];
} else {
throw `Platform ${platformName} is not valid.`;
}
Expand All @@ -106,8 +101,6 @@ export async function doAdd(config: Config, platformName: string) {
await addIOS(config);
} else if (platformName === config.android.name) {
await addAndroid(config);
} else if (platformName === config.electron.name) {
await addElectron(config);
}
});
}
Expand Down
7 changes: 1 addition & 6 deletions cli/src/tasks/copy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Config } from '../config';
import { checkWebDir, electronWarning, hasYarn, log, logError, logFatal, logInfo, resolveNode, resolvePlatform, runPlatformHook, runTask } from '../common';
import { checkWebDir, 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';
import { copyElectron } from '../electron/copy';
import { basename, join, relative, resolve } from 'path';
import { copy as fsCopy, remove } from 'fs-extra';
import { getCordovaPlugins, handleCordovaPluginsJS, writeCordovaAndroidManifest } from '../cordova';
Expand Down Expand Up @@ -55,10 +54,6 @@ export async function copy(config: Config, platformName: string) {
await writeCordovaAndroidManifest(cordovaPlugins, config, platformName);
} else if (platformName === config.web.name) {
await copyWeb(config);
} 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
12 changes: 1 addition & 11 deletions cli/src/tasks/doctor.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { Config } from '../config';
import { electronWarning, log, readJSON, resolveNode, resolveNodeFrom, runCommand } from '../common';
import { log, readJSON, resolveNode, runCommand } from '../common';
import { doctorAndroid } from '../android/doctor';
import { doctorElectron } from '../electron/doctor';
import { doctorIOS } from '../ios/doctor';
import { emoji as _e } from '../util/emoji';

import { join } from 'path';

import chalk from 'chalk';

export async function doctorCommand(config: Config, selectedPlatform: string): Promise<void> {
Expand All @@ -24,14 +21,12 @@ export async function doctorCore(config: Config) {
let cliVersion = await runCommand(`npm info @capacitor/cli version`);
let coreVersion = await runCommand(`npm info @capacitor/core version`);
let androidVersion = await runCommand(`npm info @capacitor/android version`);
let electronVersion = await runCommand(`npm info @capacitor/android version`);
let iosVersion = await runCommand(`npm info @capacitor/ios version`);

log(`${chalk.bold.blue('Latest Dependencies:')}\n`);
log(` ${chalk.bold('@capacitor/cli:')}`, cliVersion.trim());
log(` ${chalk.bold('@capacitor/core:')}`, coreVersion.trim());
log(` ${chalk.bold('@capacitor/android:')}`, androidVersion.trim());
log(` ${chalk.bold('@capacitor/electron:')}`, electronVersion.trim());
log(` ${chalk.bold('@capacitor/ios:')}`, iosVersion.trim());

log('');
Expand All @@ -48,8 +43,6 @@ async function printInstalledPackages(config: Config) {
const packagePath = resolveNode(config, packageName, 'package.json');
await printPackageVersion(packageName, packagePath);
}));
const packagePath = resolveNodeFrom(config.electron.platformDir, '@capacitor/electron');
await printPackageVersion('@capacitor/electron', packagePath ? join(packagePath, 'package.json') : packagePath);
}

async function printPackageVersion(packageName: string, packagePath: string | null) {
Expand All @@ -65,9 +58,6 @@ export async function doctor(config: Config, platformName: string) {
await doctorIOS(config);
} else if (platformName === config.android.name) {
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
2 changes: 1 addition & 1 deletion cli/src/tasks/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function list(config: Config, platform: string) {
plugins = getIOSPlugins(allPlugins);
} else if (platform === config.android.name) {
plugins = getAndroidPlugins(allPlugins);
} else if (platform === config.web.name || platform === config.electron.name) {
} else if (platform === config.web.name) {
logInfo(`Listing plugins for ${platform} is not possible`);
return;
} else {
Expand Down
6 changes: 1 addition & 5 deletions cli/src/tasks/open.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Config } from '../config';
import { electronWarning, hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runPlatformHook, runTask } from '../common';
import { 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';

export async function openCommand(config: Config, selectedPlatformName: string) {
Expand Down Expand Up @@ -43,9 +42,6 @@ export async function open(config: Config, platformName: string) {
return openAndroid(config);
} 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
5 changes: 1 addition & 4 deletions 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, electronWarning, hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runCommand, runPlatformHook, runTask } from '../common';
import { CheckFunction, check, checkPackage, hasYarn, log, logError, logFatal, logInfo, resolvePlatform, runCommand, runPlatformHook, runTask } from '../common';

import chalk from 'chalk';

Expand Down Expand Up @@ -47,9 +47,6 @@ export function updateChecks(config: Config, platforms: string[]): CheckFunction
return [];
} else if (platformName === config.web.name) {
return [];
} else if (platformName === config.electron.name) {
electronWarning();
return [];
} else {
throw `Platform ${platformName} is not valid.`;
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/core-plugin-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ export interface DeviceInfo {
/**
* The device platform (lowercase).
*/
platform: 'ios' | 'android' | 'electron' | 'web';
platform: 'ios' | 'android' | 'web';
/**
* The UUID of the device as available to the app. This identifier may change
* on modern mobile platforms that only allow per-app install UUIDs.
Expand Down
6 changes: 0 additions & 6 deletions electron-template/gitignore

This file was deleted.

Loading

0 comments on commit 21da8cf

Please sign in to comment.