Skip to content

Enable Lerna computation caching, given the repo uses v5 of Lerna #1156

@juristr

Description

@juristr

Describe the enhancement

I've seen you upgraded Lerna to the latest version (#1149). This also comes with performance improvements when running tasks (e.g. improved task scheduling + caching). See the docs for more info: https://lerna.js.org/docs/features/cache-tasks

This is done by delegating the task execution to Nx underneath, rather than using the p-queue package.

Code Snippet
What would be required is first to enable Nx by changing the lerna.json as follows:

{
  "packages": [
    "packages/*"
  ],
+ "useNx": true,
  "version": "independent"
}

And then run npx nx init to create a new nx.json where one can specify the cacheable operations for this workspace. Usually build, test, lint etc.

{
  "tasksRunnerOptions": {
    "default": {
      "runner": "nx/tasks-runners/default",
      "options": {
+        "cacheableOperations": ["build", "test"]
      }
    }
  }
}

The Lerna docs have all the details for that :)

Additional information

Happy to help with more info if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions