Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,14 @@ export function runProgram(config: Config): void {
.option('--host <host>', 'Host used for live reload')
.option('--port <port>', 'Port used for live reload')
.option('--configuration <name>', 'Configuration name of the iOS Scheme')
.option('--https', 'Enable HTTPS for live reload server')
.action(
wrapAction(
telemetryAction(
config,
async (
platform,
{ scheme, flavor, list, json, target, sync, forwardPorts, liveReload, host, port, configuration },
{ scheme, flavor, list, json, target, sync, forwardPorts, liveReload, host, port, configuration, https },
) => {
const { runCommand } = await import('./tasks/run');
await runCommand(config, platform, {
Expand All @@ -261,6 +262,7 @@ export function runProgram(config: Config): void {
host,
port,
configuration,
https,
});
},
),
Expand Down
5 changes: 3 additions & 2 deletions cli/src/tasks/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface RunCommandOptions {
host?: string;
port?: string;
configuration?: string;
https?: boolean;
}

export async function runCommand(
Expand Down Expand Up @@ -90,7 +91,7 @@ export async function runCommand(
}
const cordovaPlugins = await getCordovaPlugins(config, platformName);
if (options.liveReload) {
await CapLiveReloadHelper.editCapConfigForLiveReload(config, platformName, options);
await CapLiveReloadHelper.editCapConfigForLiveReload(config, platformName, options, false, options.https);
if (platformName === config.android.name) {
await await writeCordovaAndroidManifest(cordovaPlugins, config, platformName, true);
}
Expand All @@ -106,7 +107,7 @@ export async function runCommand(
})
.then(() => process.exit());
logger.info(
`App running with live reload listing for: http://${options.host}:${options.port}. Press Ctrl+C to quit.`,
`App running with live reload listing for: ${options.https ? 'https' : 'http'}://${options.host}:${options.port}. Press Ctrl+C to quit.`,
);
await sleepForever();
}
Expand Down
3 changes: 2 additions & 1 deletion cli/src/util/livereload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class CapLiveReload {
platformName: string,
options: RunCommandOptions,
rootConfigChange = false,
useHttps = false,
): Promise<void> {
const platformAbsPath =
platformName == config.ios.name
Expand All @@ -161,7 +162,7 @@ class CapLiveReload {
const configJson = readJSONSync(capConfigPath);
this.configJsonToRevertTo.json = JSON.stringify(configJson, null, 2);
this.configJsonToRevertTo.platformPath = capConfigPath;
const url = `http://${options.host}:${options.port}`;
const url = `${useHttps ? 'https' : 'http'}://${options.host}:${options.port}`;
configJson.server = {
url,
};
Expand Down