It would be very convenient to have to single command I can run to do a full build.
It would:
This would make setting up a CI server a lot easier. This seems like something that everyone who uses CI is going to need. It could be configured for to run everything sequentially or in parallel as much as possible to speed things up.
Can this not be achieved using node? Inside your package.json file, you can have something like
"scripts": {
"prestart": "npm test && npm run e2e"
"start": "ng server",
"postinstall": "typings install",
"lint": "tslint \"src/**/*.ts\"",
"pretest": "npm run lint && ng build --prod"
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
@machi1990 It can probably be solved using node. What command would you run in your example?
In my example, running npm start, would execute a sequence of the linting, building, testing (unit && e2e), and starting the server commands. The last command will only be executed if there was no error generated by any of the previous commands.
If that works I think something like it should be in the package.json file that gets generated.
I think this is a user feature tbh. Any shell gives you the ability to chain commands and you can also add your own npm scripts.
My suggestion for running the e2e tests and a e2e server is https://github.com/kimmobrunfeldt/concurrently, see an example here https://github.com/angular/quickstart/blob/master/package.json#L10.
Another reason why I don't think it should be included in the generated package.json is because you might want to test different environment/build targets, and that's specified manually.
@filipesilva I had to put a sleep command before ng e2e to allow time for ng serve to compile and serve the app, is there a better way of doing this? Do you think it would be worth adding a section to the README about running these sorts of commands on a CI server? Even though it's up to the user to implement, I think it's useful letting people know about the concurrently package.
@Blasz my recommendation would be to instead do something like what we do in the quickstart: https://github.com/angular/quickstart/blob/master/package.json#L10. In this case, you'd do ng build instead of tsc.
Tbh I'm thinking of adding something similar to the ng e2e command, to make it use a whatever app is in dist/.
You might actually have to use lite-server instead of http-server though, because the latter doesn't support fallback to urls: https://github.com/johnpapa/lite-server#why
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
If that works I think something like it should be in the package.json file that gets generated.