Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
zce committed Nov 29, 2023
1 parent 76890b0 commit aa857a8
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 35 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default defineConfig({
{ text: 'Quick Start', link: 'quick-start' },
{ text: 'Define Collections', link: 'define-collections' },
{ text: 'Using Collections', link: 'using-collections' },
{ text: 'Velite Schemas', link: 'velite-shemas' }
{ text: 'Velite Schemas', link: 'velite-schemas' }
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions docs/guide/asset-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ This documentation is still being written. Please check back later.

## Refer

- [File Field](./velite-schemas.md#s-file)
- [Image Field](./velite-schemas.md#s-image)
- [Markdown Field](./velite-schemas.md#s-markdown)
- [MDX Field](./velite-schemas.md#s-mdx)
- [File Field](velite-schemas.md#s-file)
- [Image Field](velite-schemas.md#s-image)
- [Markdown Field](velite-schemas.md#s-markdown)
- [MDX Field](velite-schemas.md#s-mdx)

## Uploading Assets

Expand Down
14 changes: 7 additions & 7 deletions docs/guide/define-collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const posts = defineCollection({
The schema is usually a `ZodObject`, validating the shape of the content item. But it can be any valid Zod schema.
:::

For more useful schemas, I recommend that you use [Velite extended schemas `s`](velite-shemas.md):
For more useful schemas, I recommend that you use [Velite extended schemas `s`](velite-schemas.md):

- `s.slug()`: validate slug format, unique in posts collection.
- `s.isodate()`: format date string to ISO date string.
Expand Down Expand Up @@ -131,7 +131,7 @@ const posts = defineCollection({
})
```

For more information about Velite extended field schema, see [Velite Schemas](velite-shemas.md).
For more information about Velite extended field schema, see [Velite Schemas](velite-schemas.md).

## Schema Transform (Computed Fields)

Expand Down Expand Up @@ -191,8 +191,8 @@ The `content` field will be transformed from markdown to html, and the result wi

#### Reference

- [`s.markdown(options)`](velite-shemas.md#s-markdown-options)
- [`s.mdx(options)`](velite-shemas.md#s-mdx-options)
- [`s.markdown(options)`](velite-schemas.md#s-markdown-options)
- [`s.mdx(options)`](velite-schemas.md#s-mdx-options)

### Metadata

Expand All @@ -208,7 +208,7 @@ const posts = defineCollection({

#### Reference

- [`s.metadata()`](velite-shemas.md#s-metadata)
- [`s.metadata()`](velite-schemas.md#s-metadata)

### Excerpt

Expand All @@ -225,5 +225,5 @@ const posts = defineCollection({

#### Reference

- [`s.summary()`](velite-shemas.md#s-summary)
- [`s.excerpt()`](velite-shemas.md#s-excerpt)
- [`s.summary()`](velite-schemas.md#s-summary)
- [`s.excerpt()`](velite-schemas.md#s-excerpt)
12 changes: 7 additions & 5 deletions docs/guide/introduction.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Introduction

::: warning

🚧 this documentation is not yet complete currently. but the functionality is mostly stable, although there is still a possibility of significant changes being made.

However, I have provided some [examples](https://github.com/zce/velite/tree/main/examples) for your consideration.

:::

## What is Velite?
Expand All @@ -13,8 +15,6 @@ Velite is a tool for building type-safe data layer, turn Markdown / MDX, YAML, J
![Velite Workflow](/assets/flow-dark.svg#dark 'Velite Workflow')
![Velite Workflow](/assets/flow.svg#light 'Velite Workflow')

Inspired by [Contentlayer](https://contentlayer.dev), based on [Zod](https://zod.dev) and [Unified](https://unifiedjs.com), and powered by [ESBuild](https://esbuild.github.io).

### Naming Origin

"Velite" comes from the English word "elite".
Expand All @@ -25,11 +25,11 @@ Inspired by [Contentlayer](https://contentlayer.dev), based on [Zod](https://zod

- **Easy to use**: Move your contents into `content` folder, define collections schema, run `velite`, then use the output data in your application.
- **Type-safe**: Contents schema validation by [Zod](https://zod.dev), and generate type inference for TypeScript.
- **Framework Agnostic**: JSON & Entry & DTS output, out of the box support for React, Vue, Svelte, Solid, etc.
- **Framework Agnostic**: JSON & Entry & DTS output, out of the box support for any JavaScript framework or library.
- **Light-weight**: Choose more native APIs instead of bloated NPM modules, less runtime dependencies, so it is fast and efficiently.
- **Still powerful**: Built-in Markdown / MDX, YAML, JSON support, relative files & images processing, schema validation, etc.
- **Configurable**: Both input and output directories can be customized, and support for custom loaders, hooks, etc.
- **Extensible**: Support any file types by custom loaders, Custom field validation and transform by custom schema, and any output formats by hooks
- **Extensible**: Support any file types by custom loaders, Custom field validation and transform by custom schema, and any output formats by hooks.

Check out our detailed [Why Velite](#why-velite) to learn more about what makes Velite special. ✨

Expand Down Expand Up @@ -61,7 +61,7 @@ Velite validates your contents against a [Zod](https://zod.dev) schema, and gene

### Framework Agnostic

Velite is a tool for building type-safe data layer, it is framework agnostic, and out of the box support for React, Vue, Svelte, Solid, etc.
Velite is framework agnostic, and out of the box support for React, Vue, Svelte, Solid, etc.

### Less Runtime Dependencies

Expand All @@ -80,3 +80,5 @@ Velite is a tool for building type-safe data layer, it is framework agnostic, an
- custom collection schema validation
- error reporting friendly
- etc.

Velite is inspired by [Contentlayer](https://contentlayer.dev).
2 changes: 1 addition & 1 deletion docs/guide/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default defineConfig({
})
```

For more information about Velite extended field schemas, see [Velite Schemas](velite-shemas.md).
For more information about Velite extended field schemas, see [Velite Schemas](velite-schemas.md).

::: tip

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/other/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
The following are the features I want to achieve or are under development:

- [ ] Full documentation
- [ ] Optimize the config structure, bundle & load
- [ ] Refactor Static Assets Processing to Support More Scenarios (e.g. OSS)
- [ ] More built-in schemas
- [ ] Assets OSS support
- [ ] Unit & E2E tests ?
- [ ] Unit & E2E tests?
- [ ] Turborepo?
- [ ] Scoffolding tool
- [ ] Next.js plugin
- [ ] Gatsby plugin
Expand Down
18 changes: 5 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@
<br>
<a href="https://npm.im/velite"><img src="https://img.shields.io/npm/dm/velite" alt="NPM Downloads"></a>
<a href="https://packagephobia.com/result?p=velite"><img src="https://packagephobia.com/badge?p=velite" alt="Install Size"></a>
<a href="https://github.com/zce/velite"><img src="https://img.shields.io/github/repo-size/zce/velite" alt="Repo Size"></a>
<a href="https://github.com/zce/velite"><img src="https://img.shields.io/librariesio/release/npm/velite" alt="Dependencies Status"></a>
</p>
</div>

🚧 the [documentation](https://velite.js.org) is not yet complete currently. but the functionality is mostly stable, although there is still a possibility of significant changes being made.

However, I have provided some [examples](https://github.com/zce/velite/tree/main/examples) for your consideration.

## What is Velite?

Velite is a tool for building type-safe data layer, turn Markdown / MDX, YAML, JSON, or other files into app's data layer with Zod schema.
Expand All @@ -33,8 +28,6 @@ Velite is a tool for building type-safe data layer, turn Markdown / MDX, YAML, J
<img src="https://velite.js.org/assets/flow.svg" alt="Velite Workflow" title="Velite Workflow">
</picture>

Inspired by [Contentlayer](https://contentlayer.dev), based on [Zod](https://zod.dev) and [Unified](https://unifiedjs.com), and powered by [ESBuild](https://esbuild.github.io).

### Naming Origin

"Velite" comes from the English word "elite".
Expand All @@ -45,11 +38,11 @@ Inspired by [Contentlayer](https://contentlayer.dev), based on [Zod](https://zod

- **Easy to use**: Move your contents into `content` folder, define collections schema, run `velite`, then use the output data in your application.
- **Type-safe**: Contents schema validation by [Zod](https://zod.dev), and generate type inference for TypeScript.
- **Framework Agnostic**: JSON & Entry & DTS output, out of the box support for React, Vue, Svelte, Solid, etc.
- **Framework Agnostic**: JSON & Entry & DTS output, out of the box support for any JavaScript framework or library.
- **Light-weight**: Choose more native APIs instead of bloated NPM modules, less runtime dependencies, so it is fast and efficiently.
- **Still powerful**: Built-in Markdown, YAML, JSON support, relative files & images processing, schema validation, etc.
- **Still powerful**: Built-in Markdown / MDX, YAML, JSON support, relative files & images processing, schema validation, etc.
- **Configurable**: Both input and output directories can be customized, and support for custom loaders, hooks, etc.
- **Extensible**: Support any file types by custom loaders, Custom field validation and transform by custom schema, and any output formats by hooks
- **Extensible**: Support any file types by custom loaders, Custom field validation and transform by custom schema, and any output formats by hooks.

Check out our detailed [Why Velite](https://velite.js.org/guide/introduction#why-velite) to learn more about what makes Velite special. ✨

Expand All @@ -65,8 +58,6 @@ You can try Velite directly in your browser on StackBlitz:
The following are the features I want to achieve or are under development:

- [ ] Full documentation
- [ ] File \_raw output?
- [ ] Optimize the config structure, bundle & load
- [ ] Refactor Static Assets Processing to Support More Scenarios (e.g. OSS)
- [ ] More built-in schemas
- [ ] Unit & E2E tests?
Expand All @@ -87,7 +78,8 @@ See the [open issues](https://github.com/zce/velite/issues) for a list of propos
5. **Push** your work back up to your fork: `git push -u origin my-awesome-feature`
6. Submit a **Pull Request** so that we can review your changes.

> **NOTE**: Be sure to merge the latest from "upstream" before making a pull request!
> [!NOTE]
> Be sure to merge the latest from "upstream" before making a pull request!
## License

Expand Down
2 changes: 1 addition & 1 deletion src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const init = async (configFile?: string, clean?: boolean, logLevel?: LogLevel):
const dts: string[] = [`import config from '${configModPath}'\n`]

Object.entries(collections).map(([name, collection]) => {
const funcName = `get${name[0].toUpperCase() + name.slice(1)}` // getPosts
const funcName = `get${name[0].toUpperCase() + name.slice(1)}` // e.g. getPosts
entry.push(`export const ${funcName} = async () => await import('./${name}.json').then(m => m.default)\n`)
dts.push(`export type ${collection.name} = NonNullable<typeof config.collections>['${name}']['schema']['_output']`)
dts.push(`export declare const ${funcName}: () => Promise<${collection.name + (collection.single ? '' : '[]')}>\n`)
Expand Down

0 comments on commit aa857a8

Please sign in to comment.