Turborepo Tutorial | Part 1 - Typescript, Eslint, Tailwind, Husky shared config setup in a Monorepo

Поділитися
Вставка
  • Опубліковано 25 гру 2024

КОМЕНТАРІ •

  • @vcbiotech
    @vcbiotech Рік тому +1

    It took me almost two weeks to finally understand my tailwind components were not working. THANK YOU SO MUCH FOR THIS.

  • @interceptorghost1149
    @interceptorghost1149 4 місяці тому

    This video makes me level up my software engineering knowledge, nice video

  • @sweetwarmblanket
    @sweetwarmblanket 3 роки тому +11

    Hey Leo, I recently found you ( last month ) while looking for videos on GraphQL and your videos on GraphQL microservices and fedeartion are really amazing, I've learned a lot from it and has subscribed since the first day. I had seen your others videos and the monorepo one as well but this is something I was wanting to explore with a backend and frontend, sharing different module/plugins/husky commands using monorepo.
    I have learned everything from the internet and watching countless youtube videos from people like you and I really appreciate the work that you guys put in but I haven't seen a single video where someone has shown the entire procress from scratch to deploying a app ( FullStack app ) with all the industry standards. Things like, a scaleble backend and frontend fueled with typescript and graphql with proper authentication ( using cloud functions if needed ). Setting up CI/CD, docker, cloud for deployment ( AWS/Serverless ). It's a request if you could put out a video covering and explaing everything from start to finish of a FullStack ( doesn't have to be a complex a simple one like router protection with backend validation or something like that ) that'd be really helpful. Thanks again, I really appreciate your work and hope you grow to be a successful UA-camr.
    P.S. Happy Holidays

    • @CodeDunks
      @CodeDunks  3 роки тому +3

      Hey R, I appreciate this message a lot! Really nice to know that my content has been able to help out. I am currently working on a full-stack course that will cover from the beginning of a project to deployment right now. I hope to have it out here soon but it is just taking a little bit of time between work, holidays, and other projects! Good luck with everything.

    • @sweetwarmblanket
      @sweetwarmblanket 3 роки тому

      ​@@CodeDunks I appreciate the quick reply :) and yeah, I can completely understand, time management between work and your other hustles especially during this time of the year can be really difficult at times but I'm really looking forward to it. Take care and stay up!

  • @rudrava
    @rudrava 2 роки тому

    bruh u saved so much of my reading time ... best intro out there
    Love

  • @Merchance
    @Merchance 3 роки тому +39

    Would be the best series if you also integrate Storybook to the workspace

  • @workflowinmind
    @workflowinmind 2 роки тому

    If you've seen your watch time increase recently it might be me... I watched the whole channel! Keep it up

  • @musbell
    @musbell 3 роки тому

    Thanks Leo. Looking forward for the next video.

  • @Feetsha
    @Feetsha 2 роки тому +1

    Your content is one of the best out there ngl ! Keep up the amazing work

  • @gregederer6945
    @gregederer6945 3 роки тому +2

    This is exactly what I was looking for. Thanks!

  • @milad8436
    @milad8436 2 роки тому +1

    The course I was looking for. Exactly the one I wanted

  • @vedantbothikar
    @vedantbothikar 2 роки тому

    Thanks for this video man!

  • @meysam0213
    @meysam0213 2 роки тому

    tnx leo this is best practice for develop frontend monorepo,

  • @_kadirmetin
    @_kadirmetin 9 годин тому

    Thanks for the video 🙏

  • @quyetnguyen9161
    @quyetnguyen9161 3 роки тому

    This is awesome, thank you. Can't wait for the next video.

  • @footballrecap1631
    @footballrecap1631 Рік тому

    nice one man, this was really helpful

  • @NOBOKSify
    @NOBOKSify 3 роки тому

    literally saved my life - thank you so much!

  • @NotAllHeroesWearCapes-101
    @NotAllHeroesWearCapes-101 3 роки тому

    this is super awesome .. waiting for the next part ..:)

  • @taghavi_script
    @taghavi_script 4 місяці тому

    thanks man, i enjoyed

  • @codernerd7076
    @codernerd7076 3 роки тому

    Never heard of this sounds good!

  • @marcellciszekdruzynski
    @marcellciszekdruzynski 2 роки тому

    Really nice, thanks for this one !!

  • @b1chler
    @b1chler 3 роки тому

    Cool man! Thanks for the intro!

  • @andrewkorin
    @andrewkorin 3 роки тому

    Good stuff. Keep going! Liked. Subscribed. Waiting for the next part.

    • @alex9471
      @alex9471 2 роки тому

      You mean the next next part

  • @muratasarslan2359
    @muratasarslan2359 2 роки тому

    Very clear & helpful. Thank you Leo 🙂

  • @curiousprogrammer90
    @curiousprogrammer90 Рік тому

    Very nice and good explanations! Thanks! :)

  • @williamliu796
    @williamliu796 Рік тому

    Thanks so much for this video. I went absolutely nuts trying to figure out why my tailwind styles werent working through the UI library. They were being purged!!!

  • @mateh3273
    @mateh3273 2 роки тому

    You’re the best man

  • @binov5012
    @binov5012 2 роки тому

    Excellent! Thanks 🙏

  • @sirawichvoungchuy3128
    @sirawichvoungchuy3128 3 роки тому +4

    Storybook integration would be great thank you!!

  • @doobtom271
    @doobtom271 2 роки тому

    Your Christmas hat still applies at the time I watch this video, lol

  • @fooked1
    @fooked1 2 роки тому +1

    May I ask, why did you include the same dependencies in both next package.json files? Wouldn't it be better to move those deps to a common package.json -- perhaps the root package.json?

  • @juanzapatagomez8064
    @juanzapatagomez8064 2 роки тому +2

    By any chance could you make a tutorial on adding Prisma as a package?

  • @7iomka
    @7iomka 3 роки тому +3

    Storybook integration (at least for UI components) please! Subscribed!

  • @sokhuonguon9251
    @sokhuonguon9251 2 роки тому

    really really good

  • @lamogura
    @lamogura 2 роки тому +1

    I am curious what you would do if you are using a tailwind plugin or extending the theme etc only on the UI components? Or vice-versa? Would that still all work as expected? It seems only autocomplete etc is playing nice because you copy/pasted the same config to both places. The approach is different than how you did tsconfig, so I guess there isnt a way to put all the tailwind config in 1 place and share?

    • @CodeDunks
      @CodeDunks  2 роки тому

      I think you are asking about whether you could have a shared config? I found this article that might help tinypixel.dev/use-yarn-workspaces-to-share-a-tailwind-config-file-throughout-your-wordpress-application/

  • @PartneredAdmin
    @PartneredAdmin 4 місяці тому

    Hi how to add a new app using a command e.g. npx create-payload-app@latest as an app to a turborepo? I can 't find this anywhere clearly? So...is it just delete the node_modules and copy/move all the new app files to /apps and add name and version to the workspaces?

  • @Jamie-kf2vf
    @Jamie-kf2vf 2 роки тому

    Question;
    I have a Nextjs app currently (not a monorepo).
    If I create a Turborepo monorepo, could I just drag my NextJS project into the apps/ directory? It already has all the eslint and prettier config.

  • @SivakD
    @SivakD 3 роки тому +2

    Hey. Very nice video. I've been using this tool too and it seems good. Do you know if there's a way to specify a build order for apps that might depend on packages in the package folder? (e.g. if app A needs package A, it has to build that package before trying to build app A) Is it the pipelining or just the order of the build scripts? Thanks in advance.

    • @CodeDunks
      @CodeDunks  3 роки тому +1

      Yeah I believe you should be able to use the "dependsOn" pipeline configuration specificPackageTasks. So like you could do something like in "pipeline"
      "appA#build": { "dependsOn": ["packageA#Build"] }
      Check it out here turborepo.org/docs/features/pipelines

    • @SivakD
      @SivakD 3 роки тому +1

      @@CodeDunks Thanks for the reply. I was playing with it some and the pipeline is definitely the way to go as well as having dependencies defined in the app's package.json itself. I'm new to monorepos but I am liking this tool thus far.

  • @bridlershoc6569
    @bridlershoc6569 3 роки тому +1

    Hey great video, shared it with people! When will you release part 2?

    • @CodeDunks
      @CodeDunks  3 роки тому +1

      Hey there and thanks! I plan to release it sometime next week. Was just gone for the hoildays visiting family.

  • @martinlupa8692
    @martinlupa8692 Рік тому

    Hi Leo, great material. I am setting up a monorepo for a side project and this video helped me a lot to understand the shared configurations between projects. I have a question that I couldn't answer yet. When setting up the shared eslint config, why is it important to let "prettier" to the last in the extends array inside eslint-next.js? I have come across other projects that do not respect that ordering and was wondering why. Thanks a lot!

    • @CodeDunks
      @CodeDunks  Рік тому +1

      Hey Martin! Thanks for the kind words, from my understanding eslint applies configurations sequentially. Since prettier is pretty opinionated formatter, it can conflict with your other ESLint rules, putting it at the end ensures that prettier always "wins" and formats your code

    • @martinlupa8692
      @martinlupa8692 Рік тому

      @@CodeDunks thanks again!

  • @abdullahclementabdulshekur6736

    can this set up be used to build microservices

  • @lukafireman
    @lukafireman 2 роки тому

    Hey man, Awesome content!!
    Mind sharing details about your workspace setup?
    What you use to set up your Workspaces, VSCODE, OS, Extensions, etc.
    Including that lovely terminal of yours.

  • @alexandardimcevski9136
    @alexandardimcevski9136 Рік тому

    How do we add Font to the UI package and the Apps?

  • @MrEnsiferum77
    @MrEnsiferum77 3 роки тому +1

    Is it possible to remove deps and devDeps from packages and apps folder, and reuse what u can reuse from root package.json file, like typescript, react, react-dom and turrbo repo on build step to find all root depedencies?

    • @CodeDunks
      @CodeDunks  3 роки тому

      I believe that you should be able to reuse devDependencies, removing dependencies however might be a little bit more complicated. I found this interesting issue on the Lerna repo that might explain github.com/lerna/lerna/issues/1079. I haven't had to do this with turborepo yet so I am not 100% sure.

    • @MrEnsiferum77
      @MrEnsiferum77 3 роки тому

      @@CodeDunks I've managed to solve with shared dependencies like react, react-dom installed in packages/shared, and shared imported in apps/remix as "shared": "workspace:*, because I'm using pnpm... Now I have issue with finding every devDeps binary except eslint, like rimraf. Packages exists inside apps/remix node_modules folder, and I can see them as symlinks, but for some reason, is not working recursively. Opened discussion for help on github.

    • @CodeDunks
      @CodeDunks  3 роки тому

      @@MrEnsiferum77 sounds like quite the setup, could you link the issue so I can follow as well? Got me interested

    • @MrEnsiferum77
      @MrEnsiferum77 3 роки тому

      @@CodeDunks That eslint command, gets me tricky. Some other package from remix or directly remix isntalling eslint binary, that's why its is found. The problem is with pnpm, which is not possible to have subfolder dependencies and to be found upstream as binaries. U need to installed all of them in root package.json. I still trying to figure it our if monorepos tools or npm/yarn/pnpm can make binaries avaiabled installed in one packaged, into another one, which imports it.
      I'm planing to make turborepo monorepo with multiple techonologies as template, so probably when I'm done will be part of turborepo templates.

    • @CodeDunks
      @CodeDunks  3 роки тому

      @@MrEnsiferum77 Hmm interesting, I haven't had a chance to use pnpm yet but hope to get to it soon. Appreciate all the information and look forward to that repo once you have it done!

  • @alexand215
    @alexand215 3 роки тому

    thank you so much

  • @cesarpintos8418
    @cesarpintos8418 3 роки тому +1

    Thank you a lot christopher mintz plasse

  • @sourav_-_7038
    @sourav_-_7038 2 роки тому

    instead of next-app and next-next-app can you use mf-proj1 and mf-proj2

  • @hakanaki
    @hakanaki 2 роки тому

    Why can't Turborepo packages work with plane React 😥😥?

  • @ishanagarwal3464
    @ishanagarwal3464 2 роки тому

    Great video, I am very new to this, could you please tell advantages of turborepo over simple monorepo? Any is sharing ts config possible without turborepo?

    • @LarsRyeJeppesen
      @LarsRyeJeppesen Рік тому

      Caching. If you want more advanced stuff, go with NX which is superior but more advanced/complex

  • @lcui4813
    @lcui4813 3 роки тому

    nice video! do you know how to make vscode autoimport working in this video's monorepo? now i need to manually import once then it works

    • @CodeDunks
      @CodeDunks  3 роки тому

      Hmm I don't think I have ever used that extension unfortunately

  • @meysam0213
    @meysam0213 2 роки тому

    how to integrate storybook with this ?

  • @ngoclam98242
    @ngoclam98242 Рік тому

    sorry but can you explaint, why we use "./../packages/ui/**/*.{ts,tsx}" not "./packages/ui/**/*.{ts,tsx}"

  • @siya.abc123
    @siya.abc123 2 роки тому

    Great tutorial thank you. But, so many configs are intimidating

  • @hirisraharjo
    @hirisraharjo 2 роки тому

    How to do it without tailwind? (ex: purgecss only) Anyway great video as usual!

  • @jamielee4427
    @jamielee4427 2 роки тому

    Well this is simply brilliant! Thanks man. Btw, just to point out, prettier doesn't format on save for me unless I create a .vscode/settings.json and have the following config:
    {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true,
    "source.organizeImports": true
    }
    }
    This is fine, but more for those who aren't aware. I had a Next project with this set up but the Turborepo one didn't. Question - when I save a file, will it apply the correct prettier configuration? (say, you have one in next-app which is different to next-next-app).

    • @CodeDunks
      @CodeDunks  2 роки тому

      Thanks Jamie! You could also add those settings to your overall VSCode settings I believe so it doesn't need to be per project basis.
      1. CTRL + Shift + P -> Type settings and open Settings (JSON)
      2. Paste
      "editor.formatOnSave": true,
      "eslint.format.enable": true,
      "editor.defaultFormatter": "esbenp.prettier-vscode",
      "editor.codeActionsOnSave": {
      "source.fixAll.eslint": true
      },
      "eslint.options": {
      "extensions": [".js", ".jsx", ".md", ".mdx", ".ts", ".tsx"]
      },
      "eslint.validate": [
      "javascript",
      "javascriptreact",
      "typescript",
      "typescriptreact",
      "markdown",
      "mdx"
      ],
      That is what I have in my settings (JSON), might work for you. Sorry if it doesn't haha

  • @dimitrisefstathiadis6562
    @dimitrisefstathiadis6562 2 роки тому

    Your root commands should run yarn workspaces lint, and then run it for all packages. What you are doing there while correct is not reproducible..

  • @omkarkulkarni3644
    @omkarkulkarni3644 3 роки тому

    eslint not working unfortunately

    • @CodeDunks
      @CodeDunks  3 роки тому

      What seems to be the issue?

    • @shashwatgupta9993
      @shashwatgupta9993 2 роки тому

      Same... did you find any solution?

    • @shashwatgupta9993
      @shashwatgupta9993 2 роки тому

      @@CodeDunks getting this error but don't know how to solve it.
      Could not find a declaration file for module 'config/eslint-next.js'. '/Users/shashwat/Desktop/Turborepo/turborepo tailwind with jit-mode/packages/config/eslint-next.js' implicitly has an 'any' type.
      Try `npm i --save-dev @types/config` if it exists or add a new declaration (.d.ts) file containing `declare module 'config/eslint-next.js';`

    • @shashwatgupta9993
      @shashwatgupta9993 2 роки тому

      it works on putting noimplicitany to false but i want strict type checking

    • @CodeDunks
      @CodeDunks  2 роки тому

      @@shashwatgupta9993I ran into the same issue where the linting was actually not linting anything. I've updated the repository with a version that should be working. github.com/leoroese/turborepo-tutorial

  • @dimitrisefstathiadis6562
    @dimitrisefstathiadis6562 2 роки тому

    100% sure these configs are gonna change in v2 of turbo repo and will pivot to the way Nx has them. They confused themselves a bit and made the configs too complex.

    • @CodeDunks
      @CodeDunks  2 роки тому

      Yeah they've changed already lol. Turborepo now defaults to a turbo.json, if you happen to have an older version before that change, they also provide a command to update automatically to turbo.json

  • @fortunatmutunda4194
    @fortunatmutunda4194 2 роки тому

    This is what you don't find in the offical docs.

  • @LarsRyeJeppesen
    @LarsRyeJeppesen Рік тому +1

    I really hate how TurboRepo is so associated with NextJS. It is like they try to force to use that all the time. It would have been nice if you didn't set it up with the default NextJS, because anyone not using it cannot use the same approach as you did.

  • @dealerpriest
    @dealerpriest 2 роки тому

    The number of times you can skip saying the words "go ahead" is overwhelming. Those words are, in most part, just fluff😊

  • @markokraljevic1590
    @markokraljevic1590 Рік тому

    you should talk slower, sounds like you are nervous

  • @peroconino
    @peroconino 2 роки тому

    Its pretty hard to find content about monorepos on the internet, this video helps a lot understanding how it works. But unfortunately the solutions may deprecate with time. I was following your steps to configure eslint (tsconfig worked just fine) and the part where you configure the import resolver seems not to be working anymore. But it actually got easier to do it. I didn't had to override parserOptions in eslint.js project level. I just had to pass to next-preset.js at settings>import/resolver>typescript a property called project and there specify the path to next project like this : project: ["./apps/next-app/tsconfig.json"]. And worked just fine to recognize the absolute paths from tsconfig. Hopefully this helps someone in the future with the same problem I had.