Skip to content

Commit

Permalink
fix in doc
Browse files Browse the repository at this point in the history
Signed-off-by: d4v1d03 <amit08072005@gmail.com>
  • Loading branch information
d4v1d03 committed May 30, 2024
1 parent 5441529 commit 87b3299
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions docs/kpm_sparse_checkout.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ kpm which is the package management tool for KCL, does not support sparse-checko
## 2. User Worklow
- Adding a Subdirectory Dependency via Command Line
- Specifying a Subdirectory in `kcl.mod`
- Adding a Subdirectory Dependency via Configuration File

## 3. Command Line Inteface
We will try to keep the command line interface as simple and straightforward as possible for adding a Git repository subdirectory as a dependency. The below steps show how a user can use the feature:
Expand All @@ -16,6 +17,9 @@ The following command will lead to the addition of a dependency:

This command will add the specified subdirectory as a dependency in the current KCL project.

- Non-interactive Method :
In addition to the command line interface, users can specify subdirectory dependencies directly in the `kcl.mod` file, which can be particularly useful for automated environments.

## 4. Example Use-case
Considering the nginx-ingres module, on typing the command

Expand All @@ -25,8 +29,21 @@ kpm add https://github.com/kcl-lang/modules/tree/main/nginx-ingress /restrict-in

The following command will lead to the addition of restrict-ingress-anotations package to the current KCL project and will update the kcl.mod accordingly.

Alternatively, for non-interactive environments, users can directly edit the `kcl.mod` file:
```
[package]
name = "test"
edition = "v0.9.0"
version = "0.0.1"
[dependencies]
my_dependency = { git = "https://github.com/example/repo", subdirectory = "path/to/package" }
```

## 5. Specifying how kcl.mod will specify the added subdirectories
To support the specification of a subdirectory for dependencies that are sourced from Git repositories, we need to extend the kcl.mod file structure. This involves adding an optional `subdirectory` field under each dependency.
To support the specification of a subdirectory for dependencies that are sourced from Git repositories, we need to extend the kcl.mod file structure. This involves adding an optional `subdirectory` field under each dependency. This can be manually edited or automatically updated by the kpm add command.

A sample kcl mod for the same would look like this.

```
Expand Down Expand Up @@ -55,4 +72,4 @@ if err != nil {
```

## 7. Conclusion
By extending the kcl.mod file to include a subdirectory field for Git-based dependencies, users can now specify and manage dependencies that reside in specific subdirectories of a Git repository. This enhancement will enable kpm to download only the necessary parts of large repositories, significantly improving performance when dealing with monorepos. The user interface remains intuitive, and the implementation leverages Git's sparse-checkout feature to achieve the desired functionality.
By extending the kcl.mod file to include a subdirectory field for Git-based dependencies, users can now specify and manage dependencies that reside in specific subdirectories of a Git repository. This enhancement will enable kpm to download only the necessary parts of large repositories, significantly improving performance when dealing with monorepos. The user interface remains intuitive, and the implementation leverages Git's sparse-checkout feature to achieve the desired functionality even when used in automated CI/CD pipelines.
Empty file.

0 comments on commit 87b3299

Please sign in to comment.