Skip to content

Commit

Permalink
feat: support for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 13, 2020
1 parent d52a55c commit f050c6f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ You can also check out [`子曰<antfu/ziyue-wy>`](https://github.com/antfu/ziyue
- [刻漏](https://github.com/akira-cn/kelou-wy/tree/master) - JavaScript timers for wenyan-lang - by [akira-cn](https://github.com/akira-cn)
- [子曰](https://github.com/antfu/ziyue-wy/tree/master) - Cowsay for wenyan-lang - by [antfu](https://github.com/antfu)
- [柯裡化法](https://github.com/akira-cn/currying-wy/tree/master) - Currying for wenyan-lang - by [akira-cn](https://github.com/akira-cn)
- [符經](https://github.com/GLanguage/fujing-wy/tree/master) - Escape special characters in wenyan string - by [GLanguage](https://github.com/GLanguage)
- [简体秘术](https://github.com/lymslive/wyg-packages/tree/jiantihua) - Use simplified Chinese keywords and punctuation for wenyan-lang - by [lymslive](https://github.com/lymslive/wyg-packages)
- [腳本秘術](https://github.com/akira-cn/script-wy/tree/master) - Embed scripts into wenyan-lang - by [akira-cn](https://github.com/akira-cn)
- [解析整數](https://github.com/alainsaas/zh_parseint-wy/tree/master) - parseInt equivalent for wenyan-lang, working with both Chinese and European numerals - by [alainsaas](https://github.com/alainsaas)
- [質問](https://github.com/alainsaas/prompt-wy/tree/master) - Prompt for wenyan-lang - by [alainsaas](https://github.com/alainsaas)
- [符經](https://github.com/GLanguage/fujing-wy/tree/master) - Escape special characters in wenyan string - by [GLanguage](https://github.com/GLanguage)
- [連加連乘](https://github.com/XingZiLong/continuous-operation/tree/master) - Do continuous addition and mutiplication easily. - by [XingZiLong](https://github.com/XingZiLong)

<!--package_list_end-->

> The list above might not be always update to date, you can check out https://wyg.wy-lang.org/ for realtime list.
> The list above might not be updated to date, you can check out https://wyg.wy-lang.org/ for realtime one.
## License

Expand Down
37 changes: 24 additions & 13 deletions registry-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,31 @@ import { PackageInfo } from './scripts/types'
Please append your package infomation to the following array
and then make a PR for your changes.
The `name` should be in Chinese, you can add pinyin or English `aliases` to your packages
Name:
The `name` should be in Chinese, you can add pinyin or English `aliases` to your packages
For the `repo` field, you can set by following format:
GitHub - `owner/name` or `github:owner/name`
GitLab - `gitlab:owner/name`
Bitbucket - `bitbucket:owner/name`
REPO:
For the `repo` field, you can set by following format:
GitHub - `owner/name` or `github:owner/name`
GitLab - `gitlab:owner/name`
Bitbucket - `bitbucket:owner/name`
If you would like specify the branch
`owner/name#my-branch`
If your packages have dependencies to other packages, you well need to set `dependencies`
dependencies: {
腳本秘術: '*',
},
Package versioning system is not implemented yet, please leave the value to '*' for now.
If you would like specify the branch
`owner/name#my-branch`
EXAMPLES:
You can provide `examples` to your packages, it can be viewed by the Online IDE and wyg homepage.
examples: ['例一', '範例/三人行'],
This will refer to `例一.wy` and `範例/三人行.wy` from the root for your repo.
DEPENDENCIES:
If your packages have dependencies to other packages, you well need to set `dependencies`
dependencies: {
腳本秘術: '*',
},
Package versioning system is not implemented yet, please leave the value to '*' for now.
*/

export const packages: PackageInfo[] = [
Expand All @@ -32,6 +42,7 @@ export const packages: PackageInfo[] = [
url: 'https://github.com/antfu',
},
aliases: ['ziyue'],
examples: ['例一'],
},
{
name: '简体秘术',
Expand Down
1 change: 1 addition & 0 deletions scripts/build-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function BuildIndex (writeToFile = true) {
entry: `${getRepoRawRoot(pkg.repo)}/序.wy`,
author: typeof pkg.author === 'string' ? pkg.author : pkg.author?.name,
dependencies: pkg.dependencies,
examples: pkg.examples,
}

if ((pkg.aliases || []).length > 5)
Expand Down
2 changes: 2 additions & 0 deletions scripts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface RegistryIndex {
description?: string
author?: string
dependencies?: DependenciesDefine
examples?: string[]
}>
alias: Record<string, string>
}
Expand All @@ -23,4 +24,5 @@ export interface PackageInfo {
author?: AuthorInfo
description?: string
dependencies?: DependenciesDefine
examples?: string[]
}

0 comments on commit f050c6f

Please sign in to comment.