folke / ultra-runner

🏃⛰ Ultra fast monorepo script runner and build tool
https://www.npmjs.com/package/ultra-runner
Apache License 2.0
1.2k stars 32 forks source link

Is it possible to run specific commands in monorepo? #224

Open rxliuli opened 3 years ago

rxliuli commented 3 years ago

Summarize

progress

I saw that only the example of ultra -r build is given in the README. When I try the ultra -r setup command, it will prompt error The "path" argument must be of type string. Received undefined, I Not sure what happened? The specific project is in https://github.com/rxliuli/joplin-utils


In addition, I want to know whether it is possible to run commands in the modules that the specified module depends on, for example, the following modules

app1 only depends on lib1 and lib2, I want to run the build commands in lib1 and lib2 only before running app1, and ignore other modules


The problem is determined because my package.json script contains the usage of yarn and yarn <other script>, which will cause an error, Is it possible to be compatible with them, because it is really common to use yarn to install dependencies and run other scripts directly


After fixing the problem with the yarn script, other errors appeared, but in fact this directory can run successfully. It seems that it has not detected the joplin-api package (it feels related to the operation mechanism of ultra)

[!] (plugin rpt2) Error: C:/Users/rxliuli/Code/Web/joplin-utils/apps/joplin-blog/src/wiki/WikiDocsifyIntegrated.ts(27,22): semantic error TS2345: Argument of type 'object[]' is not assignable to parameter of type 'ListNode[]'.
          │   Type '{}' is missing the following properties from type 'ListNode': id, title

When I add the parameter of --concurrency 1, it can run correctly. It seems that joplin-blog cannot be run after it depends on joplin-api.

ultra-runner-error


By adding -b, it is forced to build in parallel as much as possible according to the dependencies, but the dist generated by each build will affect the node_modules, which will cause the cache to never take effect. It feels related to another problem: https://github.com/folke/ultra-runner/issues/165

image


The reason for the above situation is that our monorepo project contains cli, so after each build, we need lerna clean -y && yarn to write cli.js to the _nodemodules/.bin directory of the submodule used , So are there other ways to circumvent this?