mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
docs: add a Module Publish section (#10407)
This commit is contained in:
parent
85e9300a78
commit
a71e382b95
67
doc/docs.md
67
doc/docs.md
@ -100,7 +100,8 @@ For more details and troubleshooting, please visit the [vab GitHub repository](h
|
||||
* [Builtin functions](#builtin-functions)
|
||||
* [Printing custom types](#printing-custom-types)
|
||||
* [Modules](#modules)
|
||||
* [Module/package management](#modulepackage-management)
|
||||
* [Manage Packages](#manage-packages)
|
||||
* [Publish package](#publish-package)
|
||||
* [Types 2](#types-2)
|
||||
* [Interfaces](#interfaces)
|
||||
* [Enums](#enums)
|
||||
@ -2243,7 +2244,7 @@ fn init() {
|
||||
The `init` function cannot be public - it will be called automatically. This feature is
|
||||
particularly useful for initializing a C library.
|
||||
|
||||
### Module/package management
|
||||
### Manage Packages
|
||||
|
||||
Briefly:
|
||||
|
||||
@ -2323,7 +2324,67 @@ v outdated
|
||||
Modules are up to date.
|
||||
```
|
||||
|
||||
You can also add your module to VPM by following the instructions on the website https://vpm.vlang.io/new
|
||||
### Publish package
|
||||
|
||||
1. Put a `v.mod` file inside the toplevel folder of your module (if you
|
||||
created your module with the command `v new mymodule` or `v init` you already have a v.mod file).
|
||||
|
||||
```sh
|
||||
v new mymodule
|
||||
Input your project description: My nice module.
|
||||
Input your project version: (0.0.0) 0.0.1
|
||||
Input your project license: (MIT)
|
||||
Initialising ...
|
||||
Complete!
|
||||
```
|
||||
|
||||
Example `v.mod`:
|
||||
```v ignore
|
||||
Module {
|
||||
name: 'mymodule'
|
||||
description: 'My nice module.'
|
||||
version: '0.0.1'
|
||||
license: 'MIT'
|
||||
dependencies: []
|
||||
}
|
||||
```
|
||||
|
||||
Minimal file structure:
|
||||
```
|
||||
v.mod
|
||||
mymodule.v
|
||||
```
|
||||
|
||||
Check that your module name is used in `mymodule.v`:
|
||||
```v
|
||||
module mymodule
|
||||
|
||||
pub fn hello_world() {
|
||||
println('Hello World!')
|
||||
}
|
||||
```
|
||||
|
||||
2. Create a git repository in the folder with the `v.mod` file
|
||||
(this is not required if you used `v new` or `v init`):
|
||||
```sh
|
||||
git init
|
||||
git add .
|
||||
git commit -m "INIT"
|
||||
````
|
||||
|
||||
3. Create a public repository on github.com.
|
||||
4. Connect your local repository to the remote repository and push the changes.
|
||||
5. Add your module to the public V module registry VPM:
|
||||
https://vpm.vlang.io/new
|
||||
|
||||
You will have to login with your Github account to register the module.
|
||||
**Warning:** _Currently it is not possibility to edit your entry after submiting.
|
||||
Check your module name and github url twice as this cannot be changed by you later._
|
||||
6. The final module name is a combination of your github account and
|
||||
the module name you provided e.g. `mygithubname.mymodule`.
|
||||
|
||||
**Optional:** tag your V module with `vlang` and `vlang-module` on github.com
|
||||
to allow a better search experiance.
|
||||
|
||||
## Types 2
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user