-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
feat(webpack):enable CLI-less webpack build + run #1137
Conversation
Usage of aurelia-cli is removed from building and running the webpack apps. This gives developers more control over webpack, and a way to easily change the configuration, without aurelia-cli meddling in between. The commands `au run` or `au build` will not work anymore in the webpack apps, use `npm start`, or `npm run build` instead. This commit closes the webpack part of the the issue aurelia#1098. Conflicts: skeleton/webpack/webpack.config.js
While removing the dependency to the CLI for building and running the webpack apps is great, I think it should still be possible to use the |
- Gulp is removed from webpack project; del is replaced by clean-webpack-plugin - Environment import is retained for cli-buindler
I played your branch, the new app still has some gulp files in
|
@3cp I have missed the tasks files in |
Are you talking about |
It's unfortunate this change could not get rid of all of aurelia-cli and gulp. 😄 |
The dependency to gulp is added back for the webpack projects as there are still some au tasks that depends on gulp. Additionally, removed environment task.
Since gulp is still there, I think we should have a run.ext doing something like this :-) import NPM from 'aurelia-cli/lib/package-managers/npm';
export default function() {
// first print out a warning to say `au run` is replaced by `npm start`
return (new NPM()).install([], process.cwd(), 'start');
// gulp understand the returned promise
} For build.ext, it is |
Oh no, just came into my mind, this PR will complicate #1132 where @shahabganji tries to add |
@3cp @shahabganji I have not went thoroughly with the other PR. However, if devs want to change any the default config, this PR will make it easier to manipulate any configuration option in webpack. This PR generates the webpack skeletons with following npm script. "start": "webpack-dev-server --env.extractCss --port 8080" Devs can now simply use |
@3cp I would suggest to have the following deprecation notice.
Otherwise, release checks needs to be written for |
@jwx That can be arranged as @3cp pointed out. In that case, the warning/deprecation notice can also be avoided. However, if those tasks are generated in the skeletons, there needs to be release check tests in place to assert the functionality. One possibility is that in those tests it is asserted that However, I would like to point out that devs can always write those tasks. The readme can be updated with copy-paste-able snippets. |
We didn't assert in release-check, it's all predefined based on what features user selected (webpack or cli-bundler). |
If we got the compatible run/build tasks, We might be able to avoid changing release-check tasks, less code change in this PR. |
What is more important than overriding e.g. check out this line, in which we run the application before running |
@shahabganji Does this support your use case? |
@3cp Does supporting the |
I'll check it, but off the top of my head, it only supports
This PR is about when we are using webpack, right? What about built-in cli bundler? |
@shahabganji I think I the package has nothing specific for cypress. In fact, I tested it on one of the generated skeletons, and it worked quite well. I just added the following npm scripts, and used "protractor": "webdriver-manager update && protractor ./test/protractor.conf.js",
"e2e": "start-server-and-test :8080 protractor"
You are right, this PR is about webpack only, and does not affect the cli-bundler. This means that the existing tasks will still continue to work for the cli-bundler. |
Don't have to. We can do very cheaply to send all the args to webpack. So the new webpack config has to support the old args as much as possible. const additional = process.argv.slice(3); // get `--host xxx` from `au run --host xxx`.
if (additional.length) {
// calls `npm start -- --host 127.0.0.1` which pass to webpack directly
return (new NPM()).install(['--', ...additional], process.cwd(), 'start');
} |
@3cp That's nice, I can make the change |
Sounds great, just one question out of curiosity, for And, one thing more, don't you think it would be great to keep the old version as well as adding this new approach? Kinda have the --EDIT: ------ And AFAIK, when we use cli, no package need to be installed globally, but cli, I think it would be better these npm scripts follow the same rule and reference the locally installed packages "protractor": "./node_modules/.bin/webdriver-manager update \
&& ./node_modules/.bin/protractor ./test/protractor.conf.js",
"e2e": "./node_modules/.bin/start-server-and-test :8080 protractor" cc: @3cp |
LGTM. Waiting for #1140 fix on master head. |
Additionally small refactor in package manager to easily export NPM and Yarn. Added a new method `run` in base package manager.
I will test this one locally first before merging other PRs. |
Usage of aurelia-cli is removed from building and running the webpack apps. This gives developers more control over webpack, and a way to easily change the configuration, without aurelia-cli meddling in between.
The commands
au run
orau build
will not work anymore in the webpack apps, usenpm start
, ornpm run build
instead. This commit closes the webpack part of the the issue #1098.Summary of changes:
*.spec.ts
files during test with karma(+webpack).package.json
,aurelia_project/tasks
, and release check tests. For pre-build cleanup activity, there is a small gulpfile introduced.tsconfig.json
to havetyperoots
applied for all cases, without that the release checks were failing for couple of suites. Other changes here enable loading a json file with ES6 import syntax.environment.ts
s to json files, which are loaded using the app-settings-loader.Note: This PR is an updated version of PR #1105 (justification)