Skip to content

How Yarn v2 Workspace can resolve dependencies from registry gitlabΒ #3062

@Piero87

Description

@Piero87

I'm trying to create a monorepo with yarn v2 workspace, and then I want publish each packages inside gitlab packages registry to avoid build each time a packages if there is already the same version in the registry. My project example is public on gitlab: https://gitlab.com/p.nompleggio/monorepov3

With this configuration all works fine, these two lines in .gitlab-ci.yml:

yarn workspaces foreach -pt run build
yarn workspaces foreach --no-private npm publish

All packages are build and published inside the registry so it's all right.

But now I'm trying to build only changed package inside the workspace and not only all packages. So I've tried just for understanding how all works to mantain this package inside registry @monorepov3/common@1.0.1 and edit the .gitlab-ci.yml in this way:

yarn workspace @monorepov3/backoffice-app run build
yarn workspace @monorepov3/backoffice-app npm publish

So I have tried to build only the @monorepov3/backoffice-app package and I wanna retrieve @monorepov3/common dependices inside @monorepov3/backoffice-app from the registry, but when the build command start doesn't work because doesn't find the @monorepov3/common locally and doesn't look in the registry.

Can anyone tell me how can I achieve this? How can I build with the package inside the registry for dependencies inside the ci/cd pipeline?

Another question is how can I build only the packages that are changed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions