Is there any way we can import one specific lerna package from another repo

Viewed 603

Newbie question - Not sure whether I am doing anything wrong. Is there a way to import a specific package from a lerna repository?

design system repo

// ./lerna.js
{
  "packages": [
    "packages/Button",
    "..."
  ],
}

// ./packages/Button/package.json
{
  name: "@namespace/button"
}

application repo

// ./package.json
{
  "dependencies": {
    "@namespace/button": "git+ssh://git@github.com/design-system-private/repo.git",
  }
}

It seems to download the root design system repo but not the button.

1 Answers

You need to version the internal package that you want to use.

    // ./package.json
    {
      "dependencies": {
        "@namespace/button": "1.0.0",
      }
    }
    
    // ./lerna.js
    {
      "packages": [
        "packages/Button",
        "..."
      ],
    }
    
    // ./packages/Button/package.json
    {
      name: "@namespace/button",
      "version": "1.0.0",
    }
Related