Skip to content

Commit

Permalink
chore(webpack): reactivation of au task as alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayan751 committed Jul 23, 2019
1 parent c03991f commit 76ffaef
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 29 deletions.
10 changes: 5 additions & 5 deletions build/tasks/release-checks/suite-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ module.exports = function(suite) {

if (applicable(features, 'webpack')) {
steps.push(
new tests.webpack.NpmStartDoesNotThrowCommandLineErrors(),
new tests.webpack.NpmStartLaunchesServer(),
new tests.webpack.NpmStartRendersPage(),
new tests.webpack.NpmStartAppLaunchesWithoutJavascriptErrors(),
new tests.webpack.NpmStartWatchPicksUpFileChanges()
new tests.webpack.AuRunDoesNotThrowCommandLineErrors(),
new tests.webpack.AuRunLaunchesServer(),
new tests.webpack.AuRunRendersPage(),
new tests.webpack.AuRunAppLaunchesWithoutJavascriptErrors(),
new tests.webpack.AuRunWatchPicksUpFileChanges()
);
}

Expand Down
2 changes: 1 addition & 1 deletion build/tasks/release-checks/tests/generic/au-cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AuCypressRunsTests extends Test {
}

execute() {
this.executeCommand = new ExecuteCommand('npm', ['start'], (msg) => this.onOutput(msg));
this.executeCommand = new ExecuteCommand('au', ['run'], (msg) => this.onOutput(msg));
return this.executeCommand.executeAsNodeScript();
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/release-checks/tests/generic/au-protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AuProtractorRunsTests extends Test {
}

execute() {
this.executeCommand = new ExecuteCommand('npm', ['start'], (msg) => this.onOutput(msg));
this.executeCommand = new ExecuteCommand('au', ['run'], (msg) => this.onOutput(msg));
return this.executeCommand.executeAsNodeScript();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const StepRunner = require('../../step-runner');
const path = require('path');
const fs = require('fs');

class NpmStartDoesNotThrowCommandLineErrors extends Test {
class AuRunDoesNotThrowCommandLineErrors extends Test {
constructor() {
super('npm start does not throw commandline errors');
super('au run does not throw commandline errors');
}

onOutput(message) {
Expand All @@ -24,14 +24,14 @@ class NpmStartDoesNotThrowCommandLineErrors extends Test {
}

execute() {
this.executeCommand = new ExecuteCommand('npm', ['start'], (msg) => this.onOutput(msg));
this.executeCommand = new ExecuteCommand('au', ['run'], (msg) => this.onOutput(msg));
return this.executeCommand.executeAsNodeScript();
}
}

class NpmStartLaunchesServer extends Test {
class AuRunLaunchesServer extends Test {
constructor() {
super('npm start launches server');
super('au run launches server');
}

onOutput(message) {
Expand All @@ -44,14 +44,14 @@ class NpmStartLaunchesServer extends Test {
}

execute() {
this.executeCommand = new ExecuteCommand('npm', ['start'], (msg) => this.onOutput(msg));
this.executeCommand = new ExecuteCommand('au', ['run'], (msg) => this.onOutput(msg));
return this.executeCommand.executeAsNodeScript();
}
}

class NpmStartWatchPicksUpFileChanges extends Test {
class AuRunWatchPicksUpFileChanges extends Test {
constructor(fileToChange) {
super('npm start picks up file changes');
super('au run picks up file changes');

this.fileToChange = fileToChange || path.join('src', 'app.html');
this.watchingForFileChangeNotification = false;
Expand Down Expand Up @@ -99,14 +99,14 @@ class NpmStartWatchPicksUpFileChanges extends Test {
execute(context) {
this.context = context;

this.executeCommand = new ExecuteCommand('npm', ['start'], (msg) => this.onOutput(msg));
this.executeCommand = new ExecuteCommand('au', ['run'], (msg) => this.onOutput(msg));
return this.executeCommand.executeAsNodeScript();
}
}

class NpmStartAppLaunchesWithoutJavascriptErrors extends Test {
class AuRunAppLaunchesWithoutJavascriptErrors extends Test {
constructor() {
super('npm start app launches without javascript errors');
super('au run app launches without javascript errors');
}

onOutput(message) {
Expand All @@ -127,14 +127,14 @@ class NpmStartAppLaunchesWithoutJavascriptErrors extends Test {
}

execute() {
this.executeCommand = new ExecuteCommand('npm', ['start'], (msg) => this.onOutput(msg));
this.executeCommand = new ExecuteCommand('au', ['run'], (msg) => this.onOutput(msg));
return this.executeCommand.executeAsNodeScript();
}
}

class NpmStartRendersPage extends Test {
class AuRunRendersPage extends Test {
constructor() {
super('npm start renders page');
super('au run renders page');
}

onOutput(context, message) {
Expand All @@ -144,7 +144,7 @@ class NpmStartRendersPage extends Test {
this.isUp = true;
const url = getURL(message);

const screenshot = new TakeScreenShotOfPage(url, path.join(context.resultOutputFolder, 'screenshot-of-npm-start.png'));
const screenshot = new TakeScreenShotOfPage(url, path.join(context.resultOutputFolder, 'screenshot-of-au-run.png'));

return new StepRunner(screenshot).run()
.then(() => {
Expand All @@ -155,7 +155,7 @@ class NpmStartRendersPage extends Test {
}

execute(context) {
this.executeCommand = new ExecuteCommand('npm', ['start'], (msg) => this.onOutput(context, msg));
this.executeCommand = new ExecuteCommand('au', ['run'], (msg) => this.onOutput(context, msg));
return this.executeCommand.executeAsNodeScript();
}
}
Expand All @@ -171,9 +171,9 @@ function getURL(msg) {
}

module.exports = {
NpmStartDoesNotThrowCommandLineErrors,
NpmStartLaunchesServer,
NpmStartWatchPicksUpFileChanges,
NpmStartAppLaunchesWithoutJavascriptErrors,
NpmStartRendersPage
AuRunDoesNotThrowCommandLineErrors,
AuRunLaunchesServer,
AuRunWatchPicksUpFileChanges,
AuRunAppLaunchesWithoutJavascriptErrors,
AuRunRendersPage
};
2 changes: 1 addition & 1 deletion build/tasks/release-checks/tests/webpack/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
...require('./run')
...require('./au-run')
};
8 changes: 8 additions & 0 deletions skeleton/webpack/aurelia_project/tasks/build.ext
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NPM } from 'aurelia-cli/lib/package-managers/npm';

export default function() {
console.log('`au build` is an alias of the `npm run build`, you may use either of those; see README for more details.');

const args = process.argv.slice(3);
return (new NPM()).install(['--', ...args], process.cwd(), 'run');
}
4 changes: 4 additions & 0 deletions skeleton/webpack/aurelia_project/tasks/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "build",
"description": "Builds and processes all application assets. It is an alias of the `npm run build`, you may use either of those; see README for more details."
}
8 changes: 8 additions & 0 deletions skeleton/webpack/aurelia_project/tasks/run.ext
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NPM } from 'aurelia-cli/lib/package-managers/npm';

export default function() {
console.log('`au run` is an alias of the `npm start`, you may use either of those; see README for more details.');

const args = process.argv.slice(3);
return (new NPM()).install(['--', ...args], process.cwd(), 'start');
}
4 changes: 4 additions & 0 deletions skeleton/webpack/aurelia_project/tasks/run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "run",
"description": "Builds the application and serves up the assets via a local web server, watching files for changes as you work. It is an alias of the `npm start`, you may use either of those; see README for more details."
}

0 comments on commit 76ffaef

Please sign in to comment.