Help with structuring a monorepo

I have a project that I’m in the process of porting to elm, and I’d like to do it as a monorepo. I currently have it setup using Lerna, with the basic structure

project
-- packages
-- -- elm_gui
-- -- device_one
-- -- device_two

Where each device package consumes the elm_gui package and outputs a device specific package.

The problem I have is where to put my elm.json and how to best use elm-webpack-loader with webpack. If anyone has any suggestions, I’d very much appreciate it!

I’m not sure that I understand everything, so this might not help.

You could have an elm.json in each package, if they represent libraries or apps. You could then reference elm-gui without publishing it by adding its directory to the source directories entry in each elm.json.

Sorry for being confusing. I don’t have much experience with monorepos, but for this project is feels really appropriate.

I did some work on it this morning and I think I like it a lot better. Being that I’m inexperienced with monorepos I thought lerna would be a great tool to use, however I think it over complicated things. For anyone that comes across this in the future, and for my own reference, I’m just using yarn link to work on both a dependency and the dependent at the same time.

Thank you @Y0hy0h for the input, it’s very much appreciated!

I have a case where I have an admin website, official website and an application with a folder for each project. There is also a shared folder for shared code between projects. I’m using monorepo for for it. I have just one elm.json and one webpack.config.js. Since Elm does dead code elimination it’s just much easier to have one elm.json file. In package.json I have three different tasks to run a webpack build for each project. In webpack file I read the name of the task and based on the name I do project specific configuration (e.g. path to correct entry file). It works great for me. Please let me know if you have any questions.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.