-
Notifications
You must be signed in to change notification settings - Fork 12k
Build a set of projects with a single command #11002
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
Comments
Any plans for this feature? |
Hi @filipesilva, Every project in a workspace already contains I have written myself a node executable that does exactly that. Follows the dependency tree and builds the libraries in the correct sequence. If that is something you see as a valuable addition to Angular CLI I would be more than happy to contribute. |
@klemenoslaj the approach we are looking at now would be able to do that implicitly, we hope. We're still finishing up the Architect API (this is what we use for build definitions). |
@filipesilva, that sounds good 👍 I however still like the idea of using I can see how that can be a bit complex for someone, but I still think handling dependencies via package.json is a good way to go. |
Are there any plans when it can be expected? |
Is it possible with the new CLI builders announced here : https://blog.angular.io/introducing-cli-builders-d012d4489f1b ? If yes could we have an example ? |
Actually, the builder approach is just project related and not workspace related. We already implemented npm script that just analyzes all projects, builds dependency tree and calls sequentially build but still problems during watch mode: build is too slow! During development time I guess only productive way is to change tsconfig path as described on #10643 (comment) |
@meriturva Is this possible for multiple libraries within a single project? I understand schematics exposes options to invoke external schematics and builder is just an extension of schematics!? |
@Goonersid our approach is just for a single project with multiple libraries. Right now we have all to test new build based on bazel before improving our internal solution. |
@meriturva I'm looking for a cli cmd that builds all libraries within a single project... Is it possible with v6 or the latest stable? Something like ng build-all |
@Goonersid you have to write you own task script and run as: |
@Goonersid I was also looking for something like this and created a script, which reads the EDIT: The script looks like this:
This script can be compiled to Javascript and then you can run it using |
@Springrbua but you're not following any dependencies, therefore if some library depends on another this will break or work by accident. |
@klemenoslaj You are right, I never used the normal Angular CLI for multi app projects and therefore forgot, that you need to build libraries yourself. |
I think this is an important feature for enterprise project with many library |
I'm using |
Any plans actually? |
A dirty hack (that ignores inner-dependencies) for windows would also be this BATCH-script:
I do the FOR-loop twice because of an inner dependency in my projects. Also i use "call" to ignore errors in the first run.... dirty as hell but it's a workaround. |
Any progress on this? |
you can use https://nx.dev/latest/angular/generators/workspace-generators to build set of project, I'm using it to generate 6 project and 20 lib support for it will 1 command, easy |
As an exercise, I recently developed a little CLI tool that reads the dependencies from the TypeScript AST and executes the commands in the right sequence and parallel (if so specified). I tried to use it on a quite large Angular CLI monorepo and the results were great. Dropping the sequential builds from 865s to 118s. I did not publicly release this because a) It was an exercise b) Nx already does something like that. Bottom line is, there is a lot of potential in this so if the community requires this I'm sure the Angular team will implement something similar. I have a feeling tho that this is a bit exotic request so it might never happen. Expand to see CLI in action videosparallel-builds.movverbose-parallel-builds.movinteractive.mov |
This is pretty good having various options to build. I think you should publish it out too if that's okay for you though. I also do not understand why would this be an exotic request. As we could create just one repo instead on multiple for multiple libraries and there is a high chance that a library depends on an other one. Doesn't it? Either I don't understand why or I am completely doing things wrong. 🤔 |
@krishnathota I probably will, but need to think if I can cope with the maintenance that comes along with it.
It is just my feeling/assumption, not the fact. I think the majority of applications out there are built without libraries or they go for Nx. I'd be super happy seeying this in Angular CLI |
We had the need too, to build multiple libraries depending on their dependency tree, in order to publish them with GitHub Actions to NPM. For this we used depcheck and toposort to generate the execution order (based on peerDependencies) and then used a small script to run all ng build commands. But we also would be happy to see "workspace commands" for |
@boeckMt this is almost the same solution we used to have before. 😂 nice! We moved to the CLI I showcased above because it got very slow. since all builds are sequential, so it sometimes took very long (big monorepo). I think if Angular CLI builds that in, they'd need to account for parallel builds. Glad to see there is someone else with similar issues 😆 |
@klemenoslaj we only need this for for publishing our packages. e.g. import { xyz } from '@scope/package';
... // tsconfig.json
...
"paths": {
"@scope/*": [
"dist/*",
"projects/*"
],
...
}
... |
We have this too 👍 We even generate it with out own schematics. I wonder if there is any chance of getting this into Angular CLI. @filipesilva WDYT? |
There is not much going on in this feature request. I would still like to offer my repository for possible inspiration but will leave it at that due to lack of interest. @filipesilva feel free to have a peek at the following repository. I implemented an implicit approach, so no additional config is required whatsoever. The repository: https://github.com/klemenoslaj/ong-cli |
I have to move nx to have this: https://nx.dev/generators/workspace-generators
|
Our way (without using nx) is to analyze all projects from See how we read |
Hi, We are facing the same problem as you and you're solution sounds perfect! Would you be willing to share how you create the dependency tree and run build commands based on it? Thanks in advance |
@meriturva I would also be interested in how you did this because it sounds very similar to what we did :) @K3CharlieStuart current solutions I know now are:
|
@boeckMt thanks for the suggestions! I'm just looking into your second suggestion but I cant seem to figure out how we would utilise this in our project. Would it be a case of copying the script folder into our application and somehow executing the quoted function? |
Here is just a code snippet of how we build our dependencies tree, it is really simple,
|
Sorry for repeating the same thing, but I feel we are going back to basics here - reading angular.json etc. Have a look at the #11002 (comment) where I made an entire repo public - it even supports parallel builds no matter the complexity of dependency tree. Running example in the following comment: #11002 (comment) Due to lack of interest I did not yet made this an npm package tho, but feel free to consume & contribute. |
Definitely interested in something like this. It would be nice to specify what projects to build and the order to build them. I know it can be done manually through scripts in the |
I would be highly interested in a "native" Angular CLI solution as well. |
It would be useful to have a way to build a certain set of projects on a workspace.
Perhaps this can be achieved with global workspace targets, or via a filtering mechanism.
Followup to #10397
The text was updated successfully, but these errors were encountered: