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
3 changes: 2 additions & 1 deletion bin/template/cordova/lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports.run = function (args) {
args.port = args.port || 8000;
args.target = args.target || 'default'; // make default the system browser
args.noLogOutput = args.silent || false;
args.https = args.https || false;

const wwwPath = path.join(__dirname, '../../www');
const manifestFilePath = path.resolve(path.join(wwwPath, 'manifest.json'));
Expand All @@ -53,7 +54,7 @@ module.exports.run = function (args) {
startPage = 'index.html';
}

const projectUrl = (new url.URL(`http://localhost:${server.port}/${startPage}`)).href;
const projectUrl = (new url.URL(` ${(args.https) ? 'https' : 'http'}://localhost:${server.port}/${startPage}`)).href;

console.log('startPage = ' + startPage);
console.log('Static file server running @ ' + projectUrl + '\nCTRL + C to shut down');
Expand Down
6 changes: 4 additions & 2 deletions bin/template/cordova/run
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const args = process.argv;
start(args);

function start (argv) {
const args = nopt({ help: Boolean, target: String, port: Number }, { help: ['/?', '-h', 'help', '-help', '/help'] }, argv);
const args = nopt({ help: Boolean, target: String, port: Number, https: Boolean }, { help: ['/?', '-h', 'help', '-help', '/help'] }, argv);
if (args.help) {
help();
} else {
Expand All @@ -36,13 +36,15 @@ function start (argv) {
}

function help () {
console.log('\nUsage: run [ --target=<browser> ] [ --port=<number> ]');
console.log('\nUsage: run [ --target=<browser> ] [ --port=<number> ] [ --https]');
console.log(' --target=<browser> : Launches the specified browser. Chrome is default.');
console.log(' --port=<number> : Http server uses specified port number.');
console.log(' --https : Http server runs over SSL.');
console.log('Examples:');
console.log(' run');
console.log(' run -- --target=ie');
console.log(' run -- --target=chrome --port=8000');
console.log(' run -- --target=chrome --port=8000 --https');
console.log('');
process.exit(0);
}