Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
fix(serve): add flag to indicate to serve for a cordova app
Browse files Browse the repository at this point in the history
  • Loading branch information
jthoms1 authored and danbucholtz committed Nov 30, 2016
1 parent a0c3f5d commit 93782e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dev-server/http-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ function servePlatformResource(req: express.Request, res: express.Response, next
const userAgent = req.header('user-agent');
let resourcePath = config.wwwDir;

if (!config.isCordovaServe) {
return next();
}

if (isUserAgentIOS(userAgent)) {
resourcePath = path.join(config.rootDir, IOS_PLATFORM_PATH);
} else if (isUserAgentAndroid(userAgent)) {
Expand Down
1 change: 1 addition & 0 deletions src/dev-server/serve-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface ServeConfig {
rootDir: string;
wwwDir: string;
buildDir: string;
isCordovaServe: boolean;
launchBrowser: boolean;
launchLab: boolean;
browserToLaunch: string;
Expand Down
5 changes: 5 additions & 0 deletions src/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function serve(context?: BuildContext) {
rootDir: context.rootDir,
wwwDir: context.wwwDir,
buildDir: context.buildDir,
isCordovaServe: isCordovaServe(context),
launchBrowser: launchBrowser(context),
launchLab: launchLab(context),
browserToLaunch: browserToLaunch(context),
Expand Down Expand Up @@ -99,6 +100,10 @@ function useServerLogs(context: BuildContext) {
return hasConfigValue(context, '--serverlogs', '-s', 'ionic_serverlogs', false);
}

function isCordovaServe(context: BuildContext) {
return hasConfigValue(context, '--iscordovaserve', '-z', 'ionic_cordova_serve', false);
}

function launchBrowser(context: BuildContext) {
return !hasConfigValue(context, '--nobrowser', '-b', 'ionic_launch_browser', false);
}
Expand Down

0 comments on commit 93782e7

Please sign in to comment.