feat: documentation

This commit is contained in:
arashsheyda
2023-06-05 21:26:30 +03:00
parent 182b760404
commit 6ca94dc574
23 changed files with 6945 additions and 41 deletions

12
docs/.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
node_modules
*.iml
.idea
*.log*
.nuxt
.vscode
.DS_Store
coverage
dist
sw.*
.env
.output

2
docs/.npmrc Normal file
View File

@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false

41
docs/app.config.ts Normal file
View File

@ -0,0 +1,41 @@
export default defineAppConfig({
docus: {
title: 'Nuxt Mongoose',
description: 'A Nuxt module for simplifying the use of Mongoose in your project.',
image: 'https://user-images.githubusercontent.com/904724/185365452-87b7ca7b-6030-4813-a2db-5e65c785bf88.png',
socials: {
github: 'arashsheyda/nuxt-mongoose',
},
github: {
dir: 'docs/content',
branch: 'main',
repo: 'nuxt-mongoose',
owner: 'arashsheyda',
edit: true,
},
aside: {
level: 0,
collapsed: false,
exclude: [],
},
main: {
padded: true,
fluid: true,
},
header: {
logo: true,
showLinkIcon: true,
exclude: [],
fluid: true,
},
footer: {
fluid: true,
iconLinks: [
{
href: 'https://nuxt.com',
icon: 'simple-icons:nuxtdotjs',
},
],
},
},
})

View File

@ -0,0 +1,12 @@
<template>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 235.5 33.2">
<rect width="32" height="32" rx="7.5" style="fill:#023430" />
<path d="M21.4,13.4C20.1,7.6,17.3,6.1,16.6,5a10.1,10.1,0,0,1-.7-1.5,1.6,1.6,0,0,1-.6,1.2,14.1,14.1,0,0,0-4.9,10.5c-.3,6.1,4.5,9.9,5.1,10.3a1.4,1.4,0,0,0,1.4-.2,12.1,12.1,0,0,0,4.5-11.9" style="fill:#10aa50" />
<path d="M16.1,22.2a17.8,17.8,0,0,1-.5,3.3s.2,1.5.3,3h.5a30.6,30.6,0,0,1,.5-3.2C16.3,25,16.1,23.6,16.1,22.2Z" style="fill:#b8c4c2" />
<path d="M16.9,25.3c-.6-.3-.8-1.7-.8-3.1s.2-4.3.1-6.5,0-10.7-.3-12.1L16.6,5c.7,1.1,3.5,2.6,4.8,8.4A12,12,0,0,1,16.9,25.3Z" style="fill:#12924f" />
<text transform="translate(32.8 25.6)" style="font-size:25.818214416503906px;font-family:OpenSans-Bold, Open Sans;font-weight:700">
<tspan fill="currentColor" x="4" y="0">Nuxt</tspan>
<tspan x="70.8" y="0" style="fill:#10aa50">Mongoose</tspan>
</text>
</svg>
</template>

36
docs/content/0.index.md Normal file
View File

@ -0,0 +1,36 @@
---
title: Home
navigation: false
layout: page
main:
fluid: false
---
:ellipsis{right=0px width=75% blur=150px}
::block-hero
---
cta:
- Get started
- /getting-started/setup
secondary:
- Open on GitHub →
- https://github.com/arashsheyda/nuxt-mongoose
---
#title
Nuxt Mongoose
#description
A Nuxt module for simplifying the use of [Mongoose](https://mongoosejs.com/) in your project.
#support
::terminal
---
content:
- npm i nuxt-mongoose -D
---
::
::
<!-- TODO: features -->

View File

@ -0,0 +1,51 @@
# Setup
A Nuxt module for simplifying the use of Mongoose in your project.
## Installation
1. Install `nuxt-mongoose` to your dependencies.
::code-group
```bash [pnpm]
pnpm add nuxt-mongoose -D
```
```bash [npm]
npm install nuxt-mongoose -D
```
```bash [yarn]
yarn add nuxt-mongoose -D
```
::
2. Add `nuxt-mongoose` to the `modules` section of your `nuxt.config` file.
```ts [nuxt.config]
export default defineNuxtConfig({
modules: [
'nuxt-mongoose',
],
})
```
::alert{ type=success }
That's it! You can now use Mongoose in your Nuxt app ✨
::
## Options
You can configure the module by adding a `mongoose` section to your `nuxt.config` file.
read more about [Mongoose options](/getting-started/configuration).
```ts [nuxt.config]
export default defineNuxtConfig({
mongoose: {
// Options
},
})
```

View File

@ -0,0 +1,21 @@
# Configuration
Configure Nuxt Mongoose with the `mongoose` property.
```ts [nuxt.config]
export default defineNuxtConfig({
mongoose: {
uri: 'process.env.MONGODB_URI',
options: {},
modelsDir: 'models',
devtools: true,
},
})
```
| **Key** | **Type** | **Default** | **Description** |
| ---------------------------- | ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------- |
| `uri` | `string` | process.env.MONGODB_URI | Connection Uri String |
| `options` | `ConnectOptions` | { } | Connection Options |
| `modelsDir` | `string` | models | The models(schema) directory located in `server` for auto-import |
| `devtools` | `boolean` | true | Enable Mongoose module in [`Nuxt Devtools`](https://github.com/nuxt/devtools) |

View File

@ -0,0 +1,2 @@
icon: tabler:brand-mongodb
navigation.redirect: /getting-started/setup

View File

@ -0,0 +1,52 @@
# Utils
Discover all available utils.
## `defineMongooseModel`
This function creates a new Mongoose model with schema. Example usage:
::code-group
```ts [named parameters]
export const User = defineMongooseModel({
name: 'User',
schema: {
name: {
type: String,
required: true,
},
},
options: {
},
})
```
```ts [positional parameters]
import { defineMongooseModel } from '#nuxt/mongoose'
export const User = defineMongooseModel('User', {
name: {
type: String,
required: true,
},
}, {
})
```
::
## `defineMongooseConnection`
This function creates a new Mongoose connection.
- `nuxt-mongoose` provides a default connection for you, it auto-register a plugin in nitro, so you don't need to use this function unless you want to create a new connection. more info [here](https://github.com/arashsheyda/nuxt-mongoose/blob/main/src/runtime/server/plugins/mongoose.db.ts).
Example usage:
```ts
import { defineMongooseConnection } from '#nuxt/mongoose'
export const connection = defineMongooseConnection('mongodb://127.0.0.1/nuxt-mongoose')
```

View File

@ -0,0 +1,3 @@
# Devtools (beta)
`nuxt-mongoose` comes with a [Nuxt Devtools](https://github.com/nuxt/devtools) module that allows you to manage your collections and generate api-endpoints & schemas...

View File

@ -0,0 +1,2 @@
title: API
icon: tabler:book

8
docs/nuxt.config.ts Normal file
View File

@ -0,0 +1,8 @@
export default defineNuxtConfig({
extends: '@nuxt-themes/docus',
modules: [
'@nuxthq/studio',
'@nuxt/devtools',
],
})

17
docs/package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "docus-starter",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate",
"preview": "nuxi preview",
"lint": "eslint ."
},
"devDependencies": {
"@nuxt-themes/docus": "^1.12.0",
"@nuxthq/studio": "^0.13.2",
"nuxt": "^3.5.0"
}
}

6655
docs/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

BIN
docs/public/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

BIN
docs/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><g fill="none"><rect width="256" height="256" fill="#023430" rx="60"/><path fill="#10AA50" d="M171.173 107.591c-10.537-46.481-32.497-58.855-38.099-67.602A99.398 99.398 0 0 1 126.949 28c-.296 4.13-.84 6.73-4.35 9.862c-7.047 6.283-36.977 30.673-39.496 83.486c-2.347 49.242 36.2 79.605 41.292 82.744c3.916 1.927 8.685.041 11.012-1.728c18.581-12.752 43.969-46.75 35.786-94.773"/><path fill="#B8C4C2" d="M128.545 177.871c-.97 12.188-1.665 19.27-4.129 26.235c0 0 1.617 11.603 2.753 23.894h4.019a223.446 223.446 0 0 1 4.384-25.732c-5.203-2.56-6.827-13.702-7.027-24.397Z"/><path fill="#12924F" d="M135.565 202.275c-5.258-2.429-6.779-13.806-7.013-24.404a499.824 499.824 0 0 0 1.136-52.545c-.276-9.194.13-85.158-2.265-96.28a92.425 92.425 0 0 0 5.651 10.936c5.602 8.754 27.569 21.128 38.099 67.609c8.203 47.941-17.047 81.849-35.608 94.684Z"/></g></svg>

After

Width:  |  Height:  |  Size: 926 B

View File

@ -1,26 +1 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 520.1 232.7" style="enable-background:new 0 0 520.1 232.7;" xml:space="preserve">
<style type="text/css">
.st0{fill:#880000;}
.st1{fill:#00DC82;}
</style>
<path class="st0" d="M323.9,193.5c-47.8-6.5-96.2,6.6-134.1,36.4c-9.7-24.3-21.1-48-34.1-70.8c-10.8-19.1-18.1-29.1-28.6-29.9
s-21.3,9.9-25.3,15C94,126,82.2,113.3,71.2,114.3c-6.5,0.6-12,7.6-22.6,21.5C38.3,149.5,31,161.7,25,172.5
c-5.4,9.7-12.4,22.7-19.9,38.5C5.3,133.1,6,75,5.8,49.3c0-4.6-0.1-15.1,6.8-22.9c7.3-8.2,18.6-9.1,34.2-10.2
c9.6-0.7,23.6-0.8,40.5,2.3c1.2,12,8.2,42,31.4,72.1c14.4,18.7,31.7,31.1,48.4,33.8c-14.4-13.7-33.3-29-48.6-47.3
c-13.2-15.6-21.3-34.8-21-56.6c0.2-12.6,5.8-19.8,17.5-18.2c23.3,3.5,46.3,8.9,69.3,13.6c2.5,0.5,4.9,1.7,8.4,0.5L169.6,4.9
c0.4-1.4,0.7-2.8,1.1-4.2c114.6-5.8,221.8,26,328.4,65.5c-1.4,7.4-2.5,12.9-3.6,18.4l1.5,0.6l7.1-14c16.3,2.2,18.3,6.4,14.1,20.7
c-7.4,25.7-24.1,39.2-50,44.1c-41.3,7.9-82.2,17.2-123.5,25.3C318.2,166.6,317.3,167.5,323.9,193.5z M185,62.7
c-16.8-20-51.7-37.3-67.5-34.9c-2.3,22.4,34.4,68.2,57.8,71.7c-2.7-4.4-5.3-8.4-7.8-12.6l6.4-3.5l-15.2-19.8l18.7,7.9l-6.6-13.7
L185,62.7z M375.9,66.2l0.2-4.8L285.7,44l-1.3,4.5c14.2,7,27.8,16.7,42.8,20.2C343.4,72.3,360.2,71.5,375.9,66.2L375.9,66.2z
M363.3,130.2l-1.6-4.3c-20.4,8.3-41.2,15.8-61,25.3c-11.1,5.3-10.9,14-3,22.5C305.5,138.6,340.3,142.8,363.3,130.2z"/>
<path class="st1" d="M103.4,232.7h59.5c1.9,0,3.7-0.5,5.4-1.4c3.3-1.9,5.3-5.5,5.3-9.3c0-1.9-0.5-3.7-1.4-5.3l-40-68.7
c-0.9-1.6-2.3-2.9-3.9-3.8c-3.3-2-7.5-2-10.8,0c-1.6,0.9-2.9,2.2-3.9,3.8l-10.2,17.6l-20-34.4c-1-1.6-2.4-2.9-4-3.8
c-3.3-2-7.4-2-10.7,0c-1.6,0.9-2.9,2.2-3.9,3.8l-49.9,85.5c-3,5-1.3,11.5,3.7,14.5c1.7,1,3.6,1.5,5.6,1.5h37.4
c14.7,0,25.7-6.4,33.3-19l18.2-31.4l9.8-16.7l29.3,50.4h-39.1L103.4,232.7z M61,215.9H34.9L74,148.8l19.5,33.6l-13.1,22.4
C75.5,213,69.8,215.9,61,215.9L61,215.9z"/>
<path class="st1" d="M375.9,66.2l0.2-4.8L285.7,44l-1.3,4.5c14.2,7,27.8,16.7,42.8,20.2C343.4,72.3,360.2,71.5,375.9,66.2
L375.9,66.2z"/>
</svg>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 235.5 33.2"><rect width="32" height="32" rx="7.5" style="fill:#023430"/><path d="M21.4,13.4C20.1,7.6,17.3,6.1,16.6,5a10.1,10.1,0,0,1-.7-1.5,1.6,1.6,0,0,1-.6,1.2,14.1,14.1,0,0,0-4.9,10.5c-.3,6.1,4.5,9.9,5.1,10.3a1.4,1.4,0,0,0,1.4-.2,12.1,12.1,0,0,0,4.5-11.9" style="fill:#10aa50"/><path d="M16.1,22.2a17.8,17.8,0,0,1-.5,3.3s.2,1.5.3,3h.5a30.6,30.6,0,0,1,.5-3.2C16.3,25,16.1,23.6,16.1,22.2Z" style="fill:#b8c4c2"/><path d="M16.9,25.3c-.6-.3-.8-1.7-.8-3.1s.2-4.3.1-6.5,0-10.7-.3-12.1L16.6,5c.7,1.1,3.5,2.6,4.8,8.4A12,12,0,0,1,16.9,25.3Z" style="fill:#12924f"/><text transform="translate(32.8 25.6)" style="font-size:25.818214416503906px;font-family:OpenSans-Bold, Open Sans;font-weight:700">Nuxt <tspan x="70.8" y="0" style="fill:#10aa50">Mongoose</tspan></text></svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 851 B

8
docs/renovate.json Normal file
View File

@ -0,0 +1,8 @@
{
"extends": [
"@nuxtjs"
],
"lockFileMaintenance": {
"enabled": true
}
}

18
docs/tokens.config.ts Normal file
View File

@ -0,0 +1,18 @@
import { defineTheme } from 'pinceau'
export default defineTheme({
color: {
primary: {
50: '#e8f5e9',
100: '#c8e6c9',
200: '#a5d6a7',
300: '#81c784',
400: '#66bb6a',
500: '#10a74f',
600: '#10a74f',
700: '#388e3c',
800: '#2e7d32',
900: '#1b5e20',
},
},
})

3
docs/tsconfig.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "./.nuxt/tsconfig.json"
}