Skip to content

Multiple Projects in a Single Seed #1157

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

Closed
mko opened this issue Jul 25, 2016 · 4 comments
Closed

Multiple Projects in a Single Seed #1157

mko opened this issue Jul 25, 2016 · 4 comments

Comments

@mko
Copy link

mko commented Jul 25, 2016

It appears that gulp-typescript requires (as of v2.13.6) a new TS Project file created for each running build task, as opposed to the intent which is for the TS Project file to be reused to reduce compilation time ( ivogabe/gulp-typescript#307 (comment) ). For most users, that means the current setup of angular2-seed is perfectly fine, as they're only building and rebuilding a single application. Unfortunately, if you are building and rebuilding a complex suite of applications with a single seed (or an Angular2 library and a demo app using the library), this becomes an issue very fast.

I found a workaround by disabling gulp-cached in the build steps and moving the TS Project creation into the task itself ( ivogabe/gulp-typescript#342 (comment) ).

There's a few things to unpack here:

  1. For the angular2-seed, is there any intention of having "out of the box" support for multiple projects in a single seed? I feel like this is a non-trivial decision, but I think having support for multiple projects in a single seed is a very valuable and useful feature.
  2. By utilizing gulp-cached in the TypeScript compilation task for caching TS Project, we're triggering an error in which gulp-typescript can't recompile changes to the watched files, thus making incremental builds problematic. Note: I have seen reports of this problem affecting non-complex seed project builds as well, but they're seem less likely to occur. I love gulp-cached but I think it would be valuable to identify somewhere to the users of the angular2-seed what files get cached and why.
  3. Is there any value in adding some sort of configuration value like TSPROJECT_CACHING = argv['tsprojcache'] || true; where we can allow the user at runtime or in their project config to override the use of TSProject Caching but leaving in place the current caching for existing seed users? I'd be happy to put together a pull request to implement this if people think it would be valuable.
@ivogabe
Copy link

ivogabe commented Jul 25, 2016

Author of gulp-typescript here. I would advise to not use gulp-cached with gulp-typescript. TypeScript already has incremental compilation, which is supported by gulp-typescript too. gulp-cached can actually prevent this incremental compilation, and it can be dangerous in certain situations. The emit of an unchanged file can change when some other file does change, and type checking of files depends on other files too. So, I'd advise to call createProject outside of the compilation tasks (create one for each task) and drop gulp-cached for TypeScript compilation. If this is too slow, you can use isolatedModules to get very fast and safe (incremental) compilation, though I'm not sure whether that works with Angular and decorator metadata.

@mko
Copy link
Author

mko commented Jul 25, 2016

@ivogabe: Thanks for the input!

@mgechev
Copy link
Owner

mgechev commented Jul 26, 2016

Hey @mko! This issue aims to solve similar problem #913.

@d3viant0ne and @NathanWalker were working on it but experienced some issues with the SystemJS configuration. AFAIK @NathanWalker builds multiple projects for multiple platforms in his advanced seed.

It makes sense to drop gulp-cached as @ivogabe mentioned. Here are other strategies for speeding the build up https://github.com/mgechev/angular2-seed/wiki/Speeding-the-build-up.

Is there anything else except gulp-cached that is blocking you from building multiple projects with the seed?

@mgechev
Copy link
Owner

mgechev commented Aug 2, 2016

Closing it due to lack of activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants