Creación de un mono repositorio en Angular

¿Qué es un mono repositorio?

El concepto de mono repo podríamos entenderlo como una estructura general (de proyecto de Angular) que contiene que contiene todo el código, funcionalidades y dependencias necesarios para el funcionamiento de distintos proyectos agrupadas en uno solo proyecto (o workspace).

¿Porque trabajar con mono repositorios en Angular?

Si miramos lo que ocupa un proyecto normal como el que hemos creado en el artículo Instalando Angular, creando un proyecto y arrancándolo en local podemos observar que su tamaño es desproporcionado.

Normalmente, a nivel corporativo, nos podemos encontrar con los tres tipos: MonoRepo, MultiRepo o Monolitotrabajar.

Se pueden crear muchos repositorios que se comunican entre si. Por ejemplo Google trabaja de esta manera en muchas ocasiones.

Pero dejando a Google de lado, si en nuesrto caso tenemos ejercicios pequeños ¿Tiene sentido crear constantemente una estructura de 400 MB para realizar mini ejercicios en Angular? La respuesta es no.

Por ello, existe la posibilidad de crear un solo workspace (area de trabajo) sobre el que montemos nuestros proyectos. Esta manera de organizar nuestros proyectos es ideal cuando se trata de proyectos pequeños.

Creando un monoRepositorio

Para ello, primeramente, vamos a crear un mono repositorio en Angular (el WorkSpace) que albergará a todos nuestros proyectos de Angular:

Para saber que significan los parámetros que le hemos añadido a la creación de nuestro proyecto, podemos realizar un ng new –help:

Podemos usar algunos parámetros como:

  • --createApplication controla la creación del proyecto predeterminado, se establece en true de forma predeterminada. Para omitir la creación de un proyecto predeterminado, lo configuramos como falso. De lo contrario, Angular CLI crea una aplicación en la src carpeta del nuevo espacio de trabajo. Es más limpio generar todas las aplicaciones en la subcarpeta projects del espacio de trabajo.
  • --directory=frontend es el nombre del directorio en el que se creará el espacio de trabajo. Si no lo especificamos valor predeterminado para el nombre del directorio que contendrá nuestra área de trabajo del mono repo, es el nombre del espacio de trabajo.

Si por ejemplo le hubiéramos especificado el parámetro, el proyecto no se llamaría como se llama nuestro nombre del espacio de trabajo sino se llamaría frontend.

Situándonos en nuestro workspace (my-monorepo-workspace)

Una vez creado, nos situamos en el directorio del mono repo que acabamos de crear:

Y le indicamos a VSC, que nos abra el proyecto:

De hecho, si nos metemos en el archivo angular.json, vemos que no tenemos proyectos añadidos.

Es más, si miramos el proyecto, vemos que tampoco tenemos el directorio SRC. Esto es debido a que hemos creado solamente la estructura general para todos los proyectos.

Creando App1 y App2 en nuestro workspace my-monorepo-workspace

Ahora nos falta crear los proyectos en sí que añadiremos a dicho mono repo. Vamos a ello:

Creando App1:

Creando App2:

Si miramos la estructura de nuestro proyecto, podemos ver que se ha añadido una carpeta projects que contiene las dos aplicaciones de Angular.

Además de ello, podemos ver que el archivo angular.json ha añadido los dos proyectos y también que ha establecido app1 como defaultProject.

Por lo que nuestro esquema se quedaría de la siguiente manera:

Modificando el HTML de ambos proyectos (app1 y app2)

Vamos a modificar la estructura de ambos documentos a un H1 con el nombre de App1 y App2. Con el fin de saber mejor cual es la App que estamos arrancando por defecto.

Arrancando el proyecto por defecto

Si arrancamos un ng serve, podemos ver que arranca el defaultProject (proyecto por defecto) del fichero de angular.json:

Si por cualquier cosa no tenemos una web tan clara como la anterior que contiene un H1 con App1 en grande y queremos ver por consola que aplicación estamos arrancando, podemos utilizar:

Nos sacará mucho más detalle y al final de toda la información que envía, podemos ver que aplicación de Angular estamos arrancando. En este caso, podemos ver que es app1:

Si queremos arrancar app2, una opción que tenemos es modificar el defaultProject (proyecto por defecto) del fichero de angular.json:

Si ahora queremos arrancar app2, podemos ver que:

Otra opción para arrancar un proyecto es utilizar npm start:

Arrancando un proyecto que no es defecto

Si queremos arrancar un proyecto que no está definido como el defaultProject en angular.json, podemos utilizar ng server junto al nombre del proyecto:

O bien, también existe la posibilidad de utilizar npm start junto al nombre de la app a usar:

Alguna vez, también lo he visto de la siguiente manera:

Espero que os haya gustado el artículo. ¡Un saludo y hasta pronto!

79 comentarios

  1. Yes! Finally something about website.

  2. Can you tell us more about this? I’d like to find out some additional information.

    Also visit my web page; Viking XL Keto BHB

  3. This is a topic which is near to my heart… Best wishes!
    Exactly where are your contact details though?

    My webpage – Hyper XXL Review

  4. Yes! Finally something about website.

  5. Admiring the time and energy you put into your website and in depth
    information you present. It’s awesome to come across a blog every once in a while that isn’t
    the same outdated rehashed information. Wonderful read!
    I’ve bookmarked your site and I’m including your RSS feeds to
    my Google account.

    My web-site; VikingXL Keto

  6. F*ckin’ awesome things here. I’m very satisfied to look your
    post. Thanks a lot and i am having a look ahead to touch you.
    Will you kindly drop me a mail?

    Also visit my blog … Primiene Review

  7. There’s certainly a lot to find out about this issue. I love all of the points you made.

  8. As I website possessor I conceive the content material here
    is really fantastic, appreciate it for your efforts.

    my web page Optimum Keto Ingredients

  9. Thank you for the good writeup. It in fact was a amusement account it.

    Look advanced to far added agreeable from you! By the way, how can we communicate?

    Also visit my web-site: Luiresse Skin (http://www.mhes.tyc.edu.tw)

  10. Hey very nice blog!! Man .. Beautiful .. Superb ..
    I will bookmark your website and take the feeds additionally?I’m glad to find numerous useful info here
    in the submit, we want develop extra techniques on this regard, thanks
    for sharing.

    Here is my page … Vialis Male Enhancement Pills

  11. Attractive section of content. I just stumbled upon your
    web site and in accession capital to assert that I get actually enjoyed
    account your blog posts. Any way I will be subscribing to
    your feeds and even I achievement you access consistently rapidly.

    Also visit my web-site: Botanical Farms CBD Gummies

  12. What’s Taking place i am new to this, I stumbled upon this I’ve discovered It positively useful and it has
    aided me out loads. I’m hoping to give a contribution & help other users like its aided me.
    Good job.

    My web page – Infinuity CBD

  13. I’m gone to tell my little brother, that he should also pay a quick
    visit this weblog on regular basis to obtain updated from
    latest news update.

    Feel free to visit my web-site Keto Max XR Reviews

  14. You have brought up a very fantastic details, thanks for the post.

    Look into my web page Insights CBD Review

  15. Yeah bookmaking this wasn’t a speculative decision outstanding post!

    my site Modern Belle Cream

  16. Thanks for ones marvelous posting! I genuinely enjoyed reading it,
    you could be a great author.I will be sure to bookmark your blog and will eventually come back very soon. I
    want to encourage you to continue your great writing, have a nice
    day!

    Here is my web page :: Vigor Max Male Enhancement Reviews

  17. Hey! Would you mind if I share your blog with my facebook group?
    There’s a lot of people that I think would really enjoy your content.
    Please let me know. Thanks

    Visit my web page … Keto Secret Pills – cointalkforum.com

  18. Amazing! Its in fact amazing post, I have got much clear
    idea concerning from this article.

    Look into my page: Insights CBD

  19. Wonderful goods from you, man. I have take into accout your stuff
    previous to and you’re just extremely wonderful. I really like what you’ve
    bought here, really like what you’re saying and the way in which by which you say
    it. You’re making it entertaining and you still take care of
    to stay it wise. I can’t wait to learn far more from you.
    That is actually a wonderful site.

    my webpage; Natural Burn Keto

  20. Thank you, I have just been searching for information about this topic for ages and yours is
    the greatest I’ve discovered till now. However, what in regards to the conclusion?
    Are you certain in regards to the source?

  21. Nice blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple tweeks would really make
    my blog shine. Please let me know where you got
    your theme. Appreciate it

    Take a look at my webpage; BioShed Keto (duna-anapa.net.ru)

  22. WOW just what I was searching for. Came here by searching for teenager
    smoking

    my web-site :: http://forum.adm-tolka.ru/

  23. Merely wanna remark on few general things, The website style
    is perfect, the content is really fantastic :D.

    Feel free to surf to my web page – Wawaza Apple Cider Gummies

  24. Heya! I realize this is kind of off-topic but I needed to ask.

    Does running a well-established blog such as yours require a massive amount work?
    I’m brand new to blogging but I do write in my diary every day.

    I’d like to start a blog so I will be able to share my personal experience and thoughts online.
    Please let me know if you have any recommendations or tips for brand new aspiring blog owners.
    Thankyou!

    my webpage Ketorol (donkhamin.go.th)

  25. May I simply just say what a comfort to discover someone that truly knows what they’re talking about over the internet.

    You definitely realize how to bring a problem to light and make it important.

    A lot more people must read this and understand this side of the story.
    I was surprised you aren’t more popular since you certainly possess
    the gift.

  26. Pretty! This has been an extremely wonderful article. Thank
    you for providing this info.

    Here is my web site … Green Earth CBD

  27. Can I simply just say what a comfort to uncover somebody who actually knows what they are talking about
    on the internet. You definitely know how to bring an issue to light
    and make it important. More people should look at this and
    understand this side of the story. It’s
    surprising you’re not more popular because you certainly possess the gift.

  28. Thanks for the marvelous posting! I certainly enjoyed
    reading it, you are a great author.I will make sure to bookmark your blog and
    will eventually come back at some point. I want to encourage
    continue your great work, have a nice evening!

    Here is my page; Vissentials Max BHB

  29. Very interesting subject, regards for putting up.

    Feel free to surf to my web blog :: Yec Keto Reviews

  30. It’s going to be finish of mine day, but before ending
    I am reading this enormous article to increase my know-how.

  31. I believe this internet site has got some rattling fantastic info for everyone
    :D.

    Also visit my site … Luiresse Cream

  32. I’m gone to convey my little brother, that he should also go to see this web site on regular basis
    to get updated from latest reports.

    Also visit my blog post; http://www.comptine.biz

  33. When I originally left a comment I appear to have clicked on the
    -Notify me when new comments are added- checkbox and
    now whenever a comment is added I recieve four emails with the same comment.

    Perhaps there is a means you are able to remove me from that
    service? Thanks!

    Stop by my web blog … Arctos Air Conditioner

  34. Really when someone doesn’t know after that its up to other visitors that they will help, so here it happens.

    my web blog; SynoGut

  35. Why viewers still use to read news papers when in this technological globe everything
    is accessible on web?

    My blog – Wawza Apple Cider Vinegar

  36. Lovely just what I was looking for. Thanks to the author for taking his time on this
    one.

    My blog post :: Pure Keto Burn

  37. This is a good tip particularly to those new to the
    blogosphere. Short but very precise information… Many thanks for
    sharing this one. A must read post!

    Look at my page – Sparkling Pure CBD Gummies [Esther]

  38. I’d like to find out more? I’d care to find out more details.

    Here is my webpage; ColonBroom (http://vip5.moisait2021.ru/)

  39. Hi, i feel that i noticed you visited my web site thus i came to ?return the prefer?.I am attempting to in finding things
    to improve my website!I assume its good enough to use some of
    your ideas!!

    my web page – Heriberto

  40. WOW just what I was looking for. Came here by searching
    for website

  41. Today, I went to the beach front with my children. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed.
    There was a hermit crab inside and it pinched her
    ear. She never wants to go back! LoL I know this is completely off topic
    but I had to tell someone!

  42. Would love to incessantly get updated great web blog!

    my web page – Yec Keto Reviews

  43. You are so awesome! I do not suppose I have read through anything like this before.
    So wonderful to find someone with some unique
    thoughts on this subject matter. Really.. many thanks for starting this up.
    This web site is something that’s needed on the internet,
    someone with a bit of originality!

    Here is my web page … Apple Cider Vinegar Keto Diet

  44. I’m gone to tell my little brother, that he should
    also pay a visit this webpage on regular basis to take updated from most up-to-date news update.

    my site: http://www.meteoritegarden.com

  45. I needed to thank you for this good read!! I definitely enjoyed every bit of it.
    I have you book-marked to look at new things you post…

    Here is my webpage: Primiene Review

  46. This excellent website really has all the information and facts
    I wanted about this subject and didn’t know who to ask.

    Also visit my homepage :: Alpha Edge Male Enhancement

  47. This site truly has all of the information I needed about this subject and didn’t
    know who to ask.

  48. Saved as a favorite, I love your web site!

  49. I blog frequently and I really appreciate your information. The article has
    really peaked my interest. I will bookmark your blog and keep checking for new details about once per week.
    I subscribed to your Feed too.

    my website … Tetra Male Enhancement

  50. Some really nice and useful info on this internet site, besides I conceive the style contains superb features.

    Feel free to visit my web blog :: http://www.aniene.net/

  51. Very nice post. I just stumbled upon your blog and wanted to say
    that I have truly enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write
    again soon!

  52. Very good written story. It will be useful to anyone who utilizes it, as well as me.
    Keep up the good work – i will definitely read more posts.

    Here is my blog post :: Eagle CBD Review

  53. Thank you for any other informative site. The place else may just I am getting that
    type of information written in such an ideal method?
    I’ve a project that I’m simply now working on, and I
    have been on the look out for such info.

    Feel free to visit my page … EcoHack Chip

  54. After checking out a number of the articles on your web page, I seriously appreciate your
    technique of writing a blog. I saved as a favorite it
    to my bookmark website list and will be checking back soon. Take a
    look at my website too and tell me what you think.

  55. Hi there, i read your blog occasionally and i own a similar one and
    i was just curious if you get a lot of spam responses? If so how do you reduce it, any plugin or anything you
    can suggest? I get so much lately it’s driving me crazy so any
    help is very much appreciated.

  56. It’s an remarkable paragraph in support of all the web users; they will
    take advantage from it I am sure.

  57. Terrific work! This is the type of information that should be
    shared around the internet. Disgrace on the search engines for no longer positioning this submit higher!
    Come on over and seek advice from my web site . Thanks =)

  58. This information is priceless. When can I find out more?

  59. I’ve been absent for some time, but now I remember why I used to love this site.
    Thanks, I will try and check back more often.
    How frequently you update your website?

    My webpage – True Burn Keto Pills (http://vip5.moisait2021.ru)

  60. Great ? I should certainly pronounce, impressed with your web
    site. I had no trouble navigating through all tabs and
    related info ended up being truly simple to do to access.
    I recently found what I hoped for before you know it in the
    least. Quite unusual. Is likely to appreciate it for those who add forums or something,
    site theme . a tones way for your client to communicate.

    Nice task.

    Also visit my website … Moscatcher (Launa)

  61. Hello there I am so excited I found your blog, I really found
    you by error, while I was browsing on Yahoo
    for something else, Nonetheless I am here now and would just
    like to say cheers for a incredible post and a all
    round thrilling blog (I also love the theme/design), I don’t have time to browse it all at the moment but I have saved it and also added your RSS feeds,
    so when I have time I will be back to read much more, Please do keep up the great work.

    Also visit my homepage; Ketorol Review

  62. Thanks for your whole work on this web site. Kate takes
    pleasure in working on research and it is simple to grasp why.
    My spouse and i notice all regarding the dynamic
    mode you render helpful things by means of the web site and even welcome participation from the others on this area so our own princess is always discovering a lot.
    Enjoy the rest of the year. You are always carrying out a superb job.

    My blog: Molten Keto Garcinia Review

  63. I’m not that much of a internet reader to be
    honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your website
    to come back in the future. Cheers

  64. Excellent way of describing, and pleasant paragraph to take information about my presentation topic, which
    i am going to present in school.

  65. You are so awesome! I don’t suppose I have read
    through anything like that before. So wonderful to find another person with unique thoughts on this subject matter.
    Seriously.. thanks for starting this up.
    This website is one thing that is needed on the internet, someone with
    a little originality!

    Here is my website Luiresse Skin Cream

  66. We absolutely love your blog and find a lot of your post’s to be
    exactly I’m looking for. Does one offer guest writers to write
    content for you personally? I wouldn’t mind writing a post or elaborating on some of the subjects
    you write related to here. Again, awesome web log!

    Feel free to surf to my blog … Synaptic IQ Pills

  67. Hi there, just became alert to your blog through Google,
    and found that it is really informative. I’m gonna watch
    out for brussels. I will appreciate if you continue this in future.
    Lots of people will be benefited from your writing. Cheers!

  68. Very rapidly this website will be famous amid all blog users, due to it’s good posts

    Also visit my website :: Health Flow Male Enhancement Reviews

  69. Thanks for finally talking about > Creación de
    un mono repositorio en Angular – Java desde 0 < Loved it!

    Feel free to surf to my blog post – Glacier Air Cooler

  70. I’ve learn a few excellent stuff here. Certainly price bookmarking for
    revisiting. I surprise how so much attempt you place to make such a magnificent informative web site.

    Also visit my blog post :: Forti Prime Side Effects

  71. I was suggested this blog by my cousin. I’m not sure whether this post is written by
    him as nobody else know such detailed about my difficulty.

    You’re amazing! Thanks!

    Feel free to surf to my blog post CoolCube Reviews

  72. Highly energetic post, I loved that a lot. Will there be a part 2?

    Feel free to surf to my website – Glacier Air Cooler Reviews

  73. Hmm it appears like your website ate my first comment (it was super long) so I guess I’ll
    just sum it up what I wrote and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to everything.
    Do you have any tips for novice blog writers?
    I’d certainly appreciate it.

    Here is my blog – Advanced CBD Oil

  74. Very efficiently written story. It will be supportive to anybody
    who employess it, as well as yours truly :). Keep up the good work – for sure i will check out more posts.

    Also visit my site :: forum.m2clasic.ro

  75. Thank you for sharing your thoughts. I truly appreciate your
    efforts and I will be waiting for your next post thanks once again.

    Have a look at my web blog – Brilliance Keto Pills

  76. I went over this internet site and I conceive you have a lot of excellent info,
    saved to favorites (:.

    My blog post MosQiller S Review

  77. I have learn several excellent stuff here.
    Certainly value bookmarking for revisiting. I surprise how a
    lot attempt you put to make any such magnificent informative web site.

  78. Stunning quest there. What occurred after? Thanks!

  79. Hurrah! In the end I got a website from where I know how to genuinely
    get valuable information concerning my study and knowledge.
    scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

La Ley 34/2002 nos obliga a avisarte de que usamos cookies propias y de terceros con objetivos estadísticos y de sesión y para mostrarte la 'publi' que nos da de comer. Tranquilo, este mensaje solo sale una vez. Más información

Java desde 0 comunica a los usuarios, a través de este aviso, que puede utilizar cookies cuando el usuario navega por las diferentes pantallas y páginas del sitio. Durante el uso de nuestra página Web usted acepta y autoriza expresamente el uso de cookies, de acuerdo con nuestra Política de Privacidad. Este sitio web utiliza las siguientes cookies propias: - Cookies de sesión, para garantizar que los usuarios que escriban comentarios en el blog sean humanos y no aplicaciones automatizadas. De esta forma se combate el spam. Este sitio web utiliza las siguientes cookies de terceros: - Google AdManager y AdSense: Utiliza cookies para mejorar la publicidad. Entre otros fines, suelen utilizarse para segmentarla según el contenido que sea relevante para los usuarios o su ubicación, mejorar los informes de rendimiento de las campañas y evitar mostrar anuncios que los usuarios ya hayan visto. Las cookies no contienen información personal identificable. Consulta cómo utiliza Google la información de sitios web o aplicaciones. y cómo bloquear determinados anuncios. - Google Analytics: Almacena cookies para poder elaborar estadísticas sobre el tráfico y volumen de visitas de esta web. Al utilizar este sitio web está consintiendo el tratamiento de información acerca de usted por Google. Por tanto, el ejercicio de cualquier derecho en este sentido deberá hacerlo comunicando directamente con Google. - Redes sociales: Cada red social utiliza sus propias cookies para que usted pueda pinchar en botones del tipo Me gusta o Compartir.

Cerrar