Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI-less webpack build #1105

Closed
wants to merge 17 commits into from
Closed
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
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.AuRunDoesNotThrowCommandLineErrors(),
new tests.webpack.AuRunLaunchesServer(),
new tests.webpack.AuRunRendersPage(),
new tests.webpack.AuRunAppLaunchesWithoutJavascriptErrors(),
new tests.webpack.AuRunWatchPicksUpFileChanges()
new tests.webpack.NpmStartDoesNotThrowCommandLineErrors(),
new tests.webpack.NpmStartLaunchesServer(),
new tests.webpack.NpmStartRendersPage(),
new tests.webpack.NpmStartAppLaunchesWithoutJavascriptErrors(),
new tests.webpack.NpmStartWatchPicksUpFileChanges()
);
}

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('au', ['run'], (msg) => this.onOutput(msg));
this.executeCommand = new ExecuteCommand('npm', ['start'], (msg) => this.onOutput(msg));
Sayan751 marked this conversation as resolved.
Show resolved Hide resolved
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('au', ['run'], (msg) => this.onOutput(msg));
this.executeCommand = new ExecuteCommand('npm', ['start'], (msg) => this.onOutput(msg));
return this.executeCommand.executeAsNodeScript();
}
}
Expand Down
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('./au-run')
...require('./run')
};
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 AuRunDoesNotThrowCommandLineErrors extends Test {
class NpmStartDoesNotThrowCommandLineErrors extends Test {
constructor() {
super('au run does not throw commandline errors');
super('npm start does not throw commandline errors');
}

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

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

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

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

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

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

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

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

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

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

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

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

onOutput(context, message) {
Expand All @@ -142,7 +142,7 @@ class AuRunRendersPage extends Test {
if (isApplicationAvailableMessage(message)) {
const url = getURL(message);

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

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

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

module.exports = {
AuRunDoesNotThrowCommandLineErrors,
AuRunLaunchesServer,
AuRunWatchPicksUpFileChanges,
AuRunAppLaunchesWithoutJavascriptErrors,
AuRunRendersPage
NpmStartDoesNotThrowCommandLineErrors,
NpmStartLaunchesServer,
NpmStartWatchPicksUpFileChanges,
NpmStartAppLaunchesWithoutJavascriptErrors,
NpmStartRendersPage
};
4 changes: 4 additions & 0 deletions skeleton/common/config/environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"debug": true,
"testing": true
}
4 changes: 4 additions & 0 deletions skeleton/common/config/environment.production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"debug": false,
"testing": false
}
5 changes: 2 additions & 3 deletions skeleton/common/tsconfig.json__if_typescript
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
"types": ["node", "jest"],
// @endif

// @if feat.webpack && feat['postcss-typical'] && feat.protractor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you accidentally removed some lines?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I saw your commit message. But we did this conditional typeRoots to do minimum impact for users of lerna (where "./node_modules/@types" does not work).

"typeRoots": ["./node_modules/@types"],
// @endif


"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Expand All @@ -44,6 +42,7 @@
"lib": ["es2015", "dom"],
"moduleResolution": "node",
"baseUrl": "src",
"resolveJsonModule": true,

// @if feat.plugin
"paths": { "resources": [ "" ] },
Expand Down
2 changes: 1 addition & 1 deletion skeleton/scaffold-minimum/src/main.ext
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'regenerator-runtime/runtime';
// @if feat.typescript
import {Aurelia} from 'aurelia-framework'
// @endif
import environment from './environment';
import * as environment from '../config/environment.json';
// @if feat.webpack
import {PLATFORM} from 'aurelia-pal';
// @endif
Expand Down
2 changes: 1 addition & 1 deletion skeleton/scaffold-navigation/src/main.ext
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'bootstrap';
// @if feat.typescript
import {Aurelia} from 'aurelia-framework';
// @endif
import environment from './environment';
import * as environment from '../config/environment.json';
// @if feat.webpack
import {PLATFORM} from 'aurelia-pal';
// @endif
Expand Down
12 changes: 5 additions & 7 deletions skeleton/webpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ For more information, go to https://aurelia.io/docs/cli/webpack

## Run dev app

Run `au run`, then open `http://localhost:/* @if feat.web */8080/* @endif *//* @if feat['dotnet-core'] */5000/* @endif */`
Run `npm start`, then open `http://localhost:/* @if feat.web */8080/* @endif *//* @if feat['dotnet-core'] */5000/* @endif */`

To open browser automatically, do `au run --open`.
You can change the standard webpack configurations from CLI easily with something like this: `npm start -- --open --port 8888`. However, it is better to change the respective npm scripts or `webpack.config.js` with these options, as per your need.

To change dev server port, do `au run --port 8888`.
To enable Webpack Bundle Analyzer, do `npm run analyze` (production build).

To enable Webpack Bundle Analyzer, do `au run --analyze`.

To enable hot module reload, do `au run --hmr`.
To enable hot module reload, do `npm start -- --env.hmr`.

## Build for production

Run `au build --env prod`.
Run `npm run build`.
67 changes: 0 additions & 67 deletions skeleton/webpack/aurelia_project/tasks/build.ext

This file was deleted.

21 changes: 0 additions & 21 deletions skeleton/webpack/aurelia_project/tasks/build.json

This file was deleted.

62 changes: 0 additions & 62 deletions skeleton/webpack/aurelia_project/tasks/run.ext

This file was deleted.

Loading