-
Hello there 👋 I am a full-stack web development teacher and I got to hear about this amazing project from the TLDR newsletter. I would like to start by thanking everyone involved for making such a wonderful tool. I am trying to help people who just started programming scaffold a full-stack (i.e. a frontend/backend) monorepo using ExpressJS for the backend and ReactJS for the frontend. We are using Prisma as the ORM for abstracting access to relational-model databases. One of my goals is to be able to share the Prisma-client types with the frontend. Both of the frontend and the backend use Typescript. We are using Rome for both the frontend and the backend with common (i.e. workspace-level) linting and formatting tasks. Aside from stating the goal relevant to my question, my question is about automating certain tasks to run when the workspace is setup (either using This feature is called lifecycle scripts in npm and includes pre and post scripts as well as others, such as the postinstall script which I am after (for generating the Prisma client and deploying the database). I would be keen to learn more about such features in moon if they exist. I really absolutely love this tool 💖
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@diraneyya Great question! Thanks for the in-depth discussion. At this time we do not support life-cycles, but it is definitely on our roadmap. Locking down what the API would look like is the hardest part. However, there is an approach that you could possible use. If you want a global "setup everything" kind of task, you can use With this, you can define a task in implicitDeps:
- '~:globalSetup'
tasks:
globalSetup:
command: 'do something' This should work how you want, but we can definitely prioritize life-cycles. |
Beta Was this translation helpful? Give feedback.
@diraneyya Great question! Thanks for the in-depth discussion. At this time we do not support life-cycles, but it is definitely on our roadmap. Locking down what the API would look like is the hardest part.
However, there is an approach that you could possible use. If you want a global "setup everything" kind of task, you can use
implicitDeps
: https://moonrepo.dev/docs/config/tasks#implicitdepsWith this, you can define a task in
.moon/tasks.yml
, and have it be inherited by every task as a dependency. So anytime a task is ran, this setup task will be also. Something like this:This should work how you wan…