-
-
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.
fix(webpack): bring back au run --env prod
- Loading branch information
Showing
4 changed files
with
97 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
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.'); | ||
|
||
console.log('`au build` is an alias of the `npm run build:dev`, you may use either of those; see README for more details.'); | ||
const args = process.argv.slice(3); | ||
return (new NPM()).run('run', ['build', '--', ...args]); | ||
return (new NPM()).run('run', ['build:dev', '--', ... cleanArgs(args)]); | ||
} | ||
|
||
// Cleanup --env prod to --env.production | ||
// for backwards compatability | ||
function cleanArgs(args) { | ||
const cleaned = []; | ||
for (let i = 0, ii = args.length; i < ii; i++) { | ||
if (args[i] === '--env' && i < ii - 1) { | ||
const env = args[++i].toLowerCase(); | ||
if (env.startsWith('prod')) { | ||
cleaned.push('--env.production'); | ||
} else if (env.startsWith('test')) { | ||
cleaned.push('--tests'); | ||
} | ||
} else { | ||
cleaned.push(args[i]); | ||
} | ||
} | ||
return cleaned; | ||
} |
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,4 +1,21 @@ | ||
{ | ||
"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." | ||
{ | ||
"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.", | ||
"flags": [ | ||
{ | ||
"name": "analyze", | ||
"description": "Enable Webpack Bundle Analyzer. Typically paired with --env prod", | ||
"type": "boolean" | ||
}, | ||
{ | ||
"name": "env", | ||
"description": "Sets the build environment.", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "watch", | ||
"description": "Watches source files for changes and refreshes the bundles automatically.", | ||
"type": "boolean" | ||
} | ||
] | ||
} |
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,4 +1,36 @@ | ||
{ | ||
"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." | ||
{ | ||
"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.", | ||
"flags": [ | ||
{ | ||
"name": "analyze", | ||
"description": "Enable Webpack Bundle Analyzer. Typically paired with --env prod", | ||
"type": "boolean" | ||
}, | ||
{ | ||
"name": "env", | ||
"description": "Sets the build environment.", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "hmr", | ||
"description": "Enable Hot Module Reload", | ||
"type": "boolean" | ||
}, | ||
{ | ||
"name": "port", | ||
"description": "Set port number of the dev server", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "host", | ||
"description": "Set host address of the dev server, the accessible URL", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "open", | ||
"description": "Open the default browser at the application location.", | ||
"type": "boolean" | ||
} | ||
] | ||
} |