Skip to content

Commit 53259f4

Browse files
authored
Merge pull request #71 from Peefy/bump-artifacthub-repo-to-modules
chore: bump modules repo and use kcl mod instead of kpm
2 parents e73c48a + 1f54f3c commit 53259f4

File tree

2 files changed

+44
-33
lines changed

2 files changed

+44
-33
lines changed

README-zh.md

+24-17
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
### 准备工作
1313

14-
- 安装 [kpm](https://kcl-lang.io/zh-CN/docs/user_docs/guides/package-management/installation/)
14+
- 安装 [KCL](https://kcl-lang.io/docs/user_docs/getting-started/install)
1515
- 安装 [git](https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git)
1616
- [注册一个 Github 账户(可选)](https://docs.github.com/zh/get-started/signing-up-for-github/signing-up-for-a-new-github-account)
1717

@@ -21,7 +21,7 @@
2121

2222
### 准备您的 KCL 包
2323

24-
通过 `kpm init <module_name>` 命令, 您可以创建一个合法的 KCL 程序模块。
24+
通过 `kcl mod init <module_name>` 命令, 您可以创建一个合法的 KCL 程序模块。
2525

2626
目前,仓库能够识别的合法的程序的目录结构如下:
2727

@@ -44,10 +44,10 @@
4444

4545
#### 1. 下载代码仓库
4646

47-
首先,您需要使用 git 将仓库 https://github.com/kcl-lang/artifacthub 下载到您的本地
47+
首先,您需要使用 git 将仓库 https://github.com/kcl-lang/modules 下载到您的本地
4848

49-
```
50-
git clone https://github.com/kcl-lang/artifacthub --depth=1
49+
```shell
50+
git clone https://github.com/kcl-lang/modules --depth=1
5151
```
5252

5353
#### 2. 为您的包创建一个分支
@@ -56,25 +56,29 @@ git clone https://github.com/kcl-lang/artifacthub --depth=1
5656

5757
以包 helloworld 为例
5858

59-
进入您下载的artifacthub目录中
60-
```
61-
cd artifacthub
59+
进入您下载的 modules 目录中
60+
61+
```shell
62+
cd modules
6263
```
64+
6365
为包 helloworld 创建一个分支 `publish-pkg-helloworld`
64-
```
66+
67+
```shell
6568
git checkout -b publish-pkg-helloworld
6669
```
6770

6871
#### 3. 添加您的包
6972

70-
您需要将您的包移动到当前目录下,在我们的例子中,我们使用 kpm init 命令创建包 helloworld
73+
您需要将您的包移动到当前目录下,在我们的例子中,我们使用 `kcl mod init` 命令创建包 helloworld
7174

72-
```
73-
kpm init helloworld
75+
```shell
76+
kcl mod init helloworld
7477
```
7578

7679
您可以为 helloworld 包增加一个 README.md 文件保存在包的根目录下,用来展示在 AH 的首页中。
77-
```
80+
81+
```shell
7882
echo "## Introduction" >> helloworld/README.md
7983
echo "This is a kcl module named helloworld." >> helloworld/README.md
8084
```
@@ -85,17 +89,19 @@ echo "This is a kcl module named helloworld." >> helloworld/README.md
8589

8690
使用 `git add .` 命令将您的包添加到 git 的暂存区中
8791

88-
```
92+
```shell
8993
git add .
9094
```
9195

9296
使用 `git commit -s` 命令提交您的包, 我们推荐您的 commit message 遵循 “publish module <module_name>” 的格式。
93-
```
97+
98+
```shell
9499
git commit -m "publish module helloworld" -s
95100
```
96101

97102
使用 `git push` 命令将您的包提交到您的分支 publish-pkg-<module_name> 中
98-
```
103+
104+
```shell
99105
git push
100106
```
101107

@@ -109,7 +115,8 @@ git push
109115
完成包的内容上传后,您可以通过 PR 升级您的包。
110116

111117
注意:**我们没有提供任何改变包的内容但是不改变版本号的升级策略。** 如果您想要升级您的包,并希望您升级后的包被展示在 AH 上,您需要修改您的包的版本号。即在 kcl.mod 文件的 module 章节中的 version 字段。
112-
```
118+
119+
```toml
113120
[package]
114121
name = "my_module"
115122
edition = "*"

README.md

+20-16
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ In the next section, we will show you how to publish your module with a `hellowo
1111

1212
### Prerequisites
1313

14-
- Install [kpm](https://kcl-lang.io/docs/user_docs/guides/package-management/installation/)
14+
- Install [KCL](https://kcl-lang.io/docs/user_docs/getting-started/install)
1515
- Install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
1616
- [Register a GitHub account (optional)](https://docs.github.com/en/get-started/signing-up-for-github/signing-up-for-a-new-github-account)
1717

@@ -21,7 +21,7 @@ NOTE: If you want to publish your KCL module to the `kcl-lang` official registry
2121

2222
### Prepare your KCL Module
2323

24-
By the `kpm init <module_name>` command, you can create a valid KCL module.
24+
By the `kcl mod init <module_name>` command, you can create a valid KCL module.
2525

2626
Currently, the directory structure of a valid KCL module that the repository can recognize is as follows:
2727

@@ -50,8 +50,8 @@ Currently, the directory structure of a valid KCL module that the repository can
5050

5151
First, you need to clone the repository
5252

53-
```
54-
git clone https://github.com/kcl-lang/artifacthub --depth=1
53+
```shell
54+
git clone https://github.com/kcl-lang/modules --depth=1
5555
```
5656

5757
#### 2. Create a branch for your module
@@ -60,26 +60,29 @@ We recommend that your branch name be: `publish-pkg-<module_name>`, `<module_nam
6060

6161
Take the module `helloworld` as an example
6262

63-
Enter the artifacthub directory you downloaded
64-
```
65-
cd artifacthub
63+
Enter the `modules` directory you downloaded
64+
65+
```shell
66+
cd modules
6667
```
6768

6869
Create a branch `publish-pkg-helloworld` for the module `helloworld`
69-
```
70+
71+
```shell
7072
git checkout -b publish-pkg-helloworld
7173
```
7274

7375
#### 3. Add your KCL module
7476

75-
You need to move your module to the current directory. In our example, we use the `kpm init` command to create the module `helloworld`
77+
You need to move your module to the current directory. In our example, we use the `kcl mod init` command to create the module `helloworld`
7678

77-
```
78-
kpm init helloworld
79+
```shell
80+
kcl mod init helloworld
7981
```
8082

8183
You can add a `README.md` file to the root directory of the module to display on the homepage of AH.
82-
```
84+
85+
```shell
8386
echo "## Introduction" >> helloworld/README.md
8487
echo "This is a kcl module named helloworld." >> helloworld/README.md
8588
```
@@ -90,18 +93,19 @@ You can use the following command to commit your module
9093

9194
Use `git add .` command to add your module to the staging area of git
9295

93-
```
96+
```shell
9497
git add .
9598
```
9699

97100
Use `git commit -s` command to commit your module, we recommend that your commit message follow the format "publish module <module_name>".
98-
```
101+
102+
```shell
99103
git commit -m "publish module helloworld" -s
100104
```
101105

102106
Use `git push` command to submit your module to your branch `publish-pkg-<module_name>`
103107

104-
```
108+
```shell
105109
git push
106110
```
107111

@@ -117,7 +121,7 @@ After completing the upload of the module content, you can upgrade your module b
117121

118122
NOTE: **We do not provide any upgrade strategy that changes the content of the module but does not change the version number.** If you want to upgrade your module and want your upgraded module to be displayed on AH, you need to modify the version number of your module. That is, the version field in the module section of the kcl.mod file.
119123

120-
```
124+
```toml
121125
[package]
122126
name = "my_module"
123127
edition = "*"

0 commit comments

Comments
 (0)