Skip to content
Permalink
Browse files

fix(browser-sync): update the mechanism to stop the server

1. Stop application server with browser-sync api
2. Run the application in non-watch mode
  • Loading branch information...
shahabganji authored and 3cp committed Aug 26, 2019
1 parent 1291be4 commit 3ffc7ec42647bdf54cfb92eb037871f6016d745e
@@ -63,12 +63,11 @@ const run = gulp.series(
done => { watch(reload); done(); }
);

const shutdownAppServer = (code) =>{
const shutdownAppServer = () =>{
return new Promise(resolve => {
bs.exit();
process.exit(code || 0);
resolve();
});
};

export { run as default , shutdownAppServer };
export { run as default, serve , shutdownAppServer };
@@ -8,7 +8,12 @@ import * as config from '../../cypress.config';
// @endif
import { CLIOptions } from 'aurelia-cli';
import * as project from '../aurelia.json';
// @if feat["cli-bundler"]
import { serve as runAppServer, shutdownAppServer } from './run';
// @endif
// @if feat.webpack
import { default as runAppServer, shutdownAppServer } from './run';
// @endif

const runCypress = (cb) => {
if (CLIOptions.hasFlag('run')) {
@@ -20,7 +25,7 @@ const runCypress = (cb) => {
shutdownAppServer().then(cb);
}
else {
shutdownAppServer(1)
shutdownAppServer()
.then(_ => {
cb('Tests failed');
});
@@ -34,8 +39,8 @@ const runCypress = (cb) => {

export default (cb) => {
if (CLIOptions.hasFlag('start')) {
runCypress(cb);
runAppServer();
runCypress(cb);
return;
}

@@ -7,7 +7,13 @@ import * as gulp from 'gulp';
const {protractor, webdriver_update } = require('gulp-protractor');

import { CLIOptions } from 'aurelia-cli';
// @if feat["cli-bundler"]
import { serve as runAppServer, shutdownAppServer } from './run';
// @endif
// @if feat.webpack
import { default as runAppServer, shutdownAppServer } from './run';
// @endif


function runApp(cb) {
if (CLIOptions.hasFlag('start')) {
@@ -28,7 +34,7 @@ function runProtractor(cb) {
shutdownAppServer().then(cb);
})
.on('error', () => {
shutdownAppServer(1).then(cb);
shutdownAppServer().then(cb);
});
}

0 comments on commit 3ffc7ec

Please sign in to comment.
You can’t perform that action at this time.