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 7, 2020
1 parent c82442d commit dd14826
Show file tree
Hide file tree
Showing 37 changed files with 5 additions and 1,325 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);
}
}
}
1 change: 0 additions & 1 deletion 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
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.

5 changes: 0 additions & 5 deletions cli/src/tasks/add.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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';
Expand Down Expand Up @@ -91,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 @@ -104,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
4 changes: 0 additions & 4 deletions cli/src/tasks/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { checkWebDir, hasYarn, log, logError, logFatal, logInfo, resolveNode, re
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,9 +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);
} else {
throw `Platform ${platformName} is not valid.`;
}
Expand Down
11 changes: 1 addition & 10 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 { 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,8 +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);
} 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
3 changes: 0 additions & 3 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 { 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,8 +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) {
return openElectron(config);
} else {
throw `Platform ${platformName} is not valid.`;
}
Expand Down
2 changes: 0 additions & 2 deletions cli/src/tasks/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ export function updateChecks(config: Config, platforms: string[]): CheckFunction
return [];
} else if (platformName === config.web.name) {
return [];
} else if (platformName === config.electron.name) {
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 @@ -461,7 +461,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 dd14826

Please sign in to comment.