Commit 93e1070a authored by Avi Chazen's avatar Avi Chazen

Update doc/user/packages/workflows/monorepo.md

parent 152b4c65
...@@ -14,10 +14,10 @@ subprojects or submodules that all get packaged and published individually. ...@@ -14,10 +14,10 @@ subprojects or submodules that all get packaged and published individually.
The number and name of packages you can publish to one project is not limited. The number and name of packages you can publish to one project is not limited.
You can accomplish this by setting up different configuration files for each You can accomplish this by setting up different configuration files for each
package. See the documentation for the package manager of your choice since package. See the documentation for the package manager of your choice since
each will have its own specific files and instructions to follow to publish each has its own specific files and instructions to follow to publish
a given package. a given package.
Here, we will walk through how to do this with [NPM](../npm_registry/index.md). Here, we take a walk through how to do this with [NPM](../npm_registry/index.md).
Let us say we have a project structure like so: Let us say we have a project structure like so:
...@@ -44,19 +44,19 @@ If you follow the instructions you can publish `MyProject` by running ...@@ -44,19 +44,19 @@ If you follow the instructions you can publish `MyProject` by running
`npm publish` from the root directory. `npm publish` from the root directory.
Publishing `Foo` is almost exactly the same, you simply have to follow the steps Publishing `Foo` is almost exactly the same, you simply have to follow the steps
while in the `Foo` directory. `Foo` will need its own `package.json` file, while in the `Foo` directory. `Foo` needs its own `package.json` file,
which can be added manually or using `npm init`. And it will need its own which can be added manually or using `npm init`. It also needs its own
configuration settings. Since you are publishing to the same place, if you configuration settings. Since you are publishing to the same place, if you
used `npm config set` to set the registry for the parent project, then no used `npm config set` to set the registry for the parent project, then no
additional setup is necessary. If you used a `.npmrc` file, you will need an additional setup is necessary. If you used a `.npmrc` file, you need an
additional `.npmrc` file in the `Foo` directory (be sure to add `.npmrc` files additional `.npmrc` file in the `Foo` directory (be sure to add `.npmrc` files
to the `.gitignore` file or use environment variables in place of your access to the `.gitignore` file or use environment variables in place of your access
tokens to prevent them from being exposed). It can be identical to the tokens to prevent them from being exposed). It can be identical to the
one you used in `MyProject`. You can now run `npm publish` from the `Foo` one you used in `MyProject`. You can now run `npm publish` from the `Foo`
directory and you will be able to publish `Foo` separately from `MyProject` directory and you can publish `Foo` separately from `MyProject`
A similar process could be followed for Conan packages, instead of dealing with A similar process could be followed for Conan packages, instead of dealing with
`.npmrc` and `package.json`, you will just be dealing with `conanfile.py` in `.npmrc` and `package.json`, you just deal with `conanfile.py` in
multiple locations within the project. multiple locations within the project.
## Publishing to other projects ## Publishing to other projects
...@@ -64,9 +64,9 @@ multiple locations within the project. ...@@ -64,9 +64,9 @@ multiple locations within the project.
A package is associated with a project on GitLab, but the package does not A package is associated with a project on GitLab, but the package does not
need to be associated with the code in that project. Notice when configuring need to be associated with the code in that project. Notice when configuring
NPM or Maven, you only use the `Project ID` to set the registry URL that the NPM or Maven, you only use the `Project ID` to set the registry URL that the
package will be uploaded to. If you set this to any project that you have package is to be uploaded to. If you set this to any project that you have
access to and update any other config similarly depending on the package type, access to and update any other config similarly depending on the package type,
your packages will be published to that project. This means you can publish your packages are published to that project. This means you can publish
multiple packages to one project, even if their code does not exist in the same multiple packages to one project, even if their code does not exist in the same
place. See the [project registry workflow documentation](./project_registry.md) place. See the [project registry workflow documentation](./project_registry.md)
for more details. for more details.
...@@ -77,7 +77,7 @@ CI pipelines open an entire world of possibilities for dealing with the patterns ...@@ -77,7 +77,7 @@ CI pipelines open an entire world of possibilities for dealing with the patterns
described in the previous sections. A common desire would be to publish described in the previous sections. A common desire would be to publish
specific packages only if changes were made to those directories. specific packages only if changes were made to those directories.
Using the example project above, this `gitlab-ci.yml` file will publish Using the example project above, this `gitlab-ci.yml` file publishes
`Foo` anytime changes are made to the `Foo` directory on the `master` branch, `Foo` anytime changes are made to the `Foo` directory on the `master` branch,
and publish `MyPackage` anytime changes are made to anywhere _except_ the `Foo` and publish `MyPackage` anytime changes are made to anywhere _except_ the `Foo`
directory on the `master` branch. directory on the `master` branch.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment