-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additionally small refactor in package manager to easily export NPM and Yarn. Added a new method `run` in base package manager.
- Loading branch information
Showing
7 changed files
with
79 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const Test = require('../test'); | ||
const ExecuteCommand = require('../../tasks/execute-command'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
class AuBuildDoesNotThrowCommandLineErrors extends Test { | ||
constructor() { | ||
super('au build does not throw commandline errors'); | ||
} | ||
|
||
onOutput(message) { | ||
this.debug(message); | ||
|
||
if (message.toLowerCase().indexOf('error') > -1) { | ||
this.executeCommand.stop(); | ||
this.fail(); | ||
} else if (isBuildCompletedMessage(message)) { | ||
this.success(); | ||
this.executeCommand.stop(); | ||
} | ||
} | ||
|
||
execute() { | ||
this.executeCommand = new ExecuteCommand('au', ['build'], (msg) => this.onOutput(msg)); | ||
return this.executeCommand.executeAsNodeScript(); | ||
} | ||
} | ||
|
||
class AuBuildStartsWebpackInWatchMode extends Test { | ||
constructor(fileToChange) { | ||
super('au build --watch starts webpack in watch mode'); | ||
|
||
this.fileToChange = fileToChange || path.join('src', 'app.html'); | ||
this.firstBuildCompleted = false; | ||
} | ||
|
||
onOutput(message) { | ||
this.debug(message); | ||
|
||
if (message.toLowerCase().indexOf('error') > -1) { | ||
this.executeCommand.stop(); | ||
this.fail(); | ||
} else if (message.indexOf('webpack is watching the files') > -1) { | ||
this.success(); | ||
this.executeCommand.stop(); | ||
} | ||
} | ||
|
||
execute(context) { | ||
this.context = context; | ||
|
||
this.executeCommand = new ExecuteCommand('au', ['build', '--watch'], (msg) => this.onOutput(msg)); | ||
return this.executeCommand.executeAsNodeScript(); | ||
} | ||
} | ||
|
||
function isBuildCompletedMessage(msg) { | ||
return msg.indexOf('Built at') > -1; | ||
} | ||
|
||
module.exports = { | ||
AuBuildDoesNotThrowCommandLineErrors, | ||
AuBuildStartsWebpackInWatchMode | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module.exports = { | ||
...require('./au-run') | ||
...require('./au-run'), | ||
...require('./au-build') | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { NPM } from 'aurelia-cli/lib/package-managers/npm'; | ||
import { NPM } from 'aurelia-cli'; | ||
|
||
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'); | ||
return (new NPM()).run('run', ['build', '--', ...args]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { NPM } from 'aurelia-cli/lib/package-managers/npm'; | ||
import { NPM } from 'aurelia-cli'; | ||
|
||
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'); | ||
return (new NPM()).run('start',['--', ...args]); | ||
} |