Skip to content

Commit

Permalink
📝 docs(docs): update docs config
Browse files Browse the repository at this point in the history
  • Loading branch information
Ángel Albiñana Espejo authored and Ángel Albiñana Espejo committed Aug 23, 2024
1 parent 0d1aa7d commit a431da3
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 116 deletions.
125 changes: 125 additions & 0 deletions .dev/docs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import {
funding, extra, bugs, repository,
} from '../package.json'
import {
joinPath, joinUrl,
} from '@backan/config/core'

const sidebarConstructor = [
{
text : 'Introduction',
items : [
{
text : 'What is BACKAN?', link : joinPath( extra.docsPath.guide,'/' ),
},
],
},
{
text : 'Reference',
items : [
{
text : '📚 Library',
collapsed : false,
items : [
{
text : '🏁 Get started',
link : joinPath( extra.docsPath.core ),
},
{
text : 'App',
link : joinPath( extra.docsPath.core, 'app' ),
},
{
text : 'Route',
link : joinPath( extra.docsPath.core, 'route' ),
},
{
text : 'Endpoints',
collapsed : true,
items : [
{
text : 'GET',
link : joinPath( extra.docsPath.core, 'get' ),
},
{
text : 'POST',
link : joinPath( extra.docsPath.core, 'post' ),
},
{
text : 'STREAM',
link : joinPath( extra.docsPath.core, 'stream' ),
},
{
text : 'PUT',
link : joinPath( extra.docsPath.core, 'put' ),
},
{
text : 'DELETE',
link : joinPath( extra.docsPath.core, 'delete' ),
},
{
text : 'PATCH',
link : joinPath( extra.docsPath.core, 'patch' ),
},
],
},
],
},
{
text : '🎉 Create (setup)',
link : joinPath( extra.docsPath.create, 'index.md' ),
},
{
text : '🗄️ Server',
link : joinPath( extra.docsPath.server, 'index.md' ),
},
{
text : '📦 Builder',
link : joinPath( extra.docsPath.builder, 'index.md' ),
},
],
},
{
text : 'Contribute',
items : [
{
text : 'Report issues', link : bugs.url,
},
{
text : 'Todo', link : joinPath( extra.docsPath.todo,'/v1' ),
},
],
},
{
text : 'About',
items : [
{
text : 'License',
link : joinUrl( repository.url, 'blob/main/LICENSE' ),
},
{
text : 'More projects',
link : extra.collective.web,
},
],
},
]
export const sidebar = {
'/guide/' : sidebarConstructor,
'/todo/' : sidebarConstructor,
}
export const nav = [
{
text : 'Home',
link : '/',
},
{
text : 'Guide',
activeMatch : '/^\\/guide\\//',
link : joinPath( extra.docsPath.guide ),
},
{
text : 'Donate',
link : funding.url,
},
]
2 changes: 1 addition & 1 deletion .dev/workflow.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import {
initCache ,
initCache,
execChild,
execProcess,
getFilteredFileNames,
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"serve": "pnpm --filter @backan/server $@",
"creator": "pnpm --filter create-backan $@",
"doc": "pnpm --filter @backan/docs $@",

"build": "pnpm run --sequential \"/^build:.*/\"",
"build:core": "pnpm --filter @backan/core build",
"build:lib": "pnpm --filter backan build",
Expand All @@ -47,6 +48,7 @@
"test-file": "vitest run $@",
"lint": "pnpm eslint .",
"lint-fix": "pnpm eslint . --fix",

"prepare": "husky .dev/husky",
"cm": "cz",
"prepush": "pnpm readme && pnpm --filter core build:schema && pnpm --filter api build:schema",
Expand Down Expand Up @@ -144,6 +146,7 @@
"contributors": [
],
"extra": {
"shortDesc": "All in one web API builder",
"productName": "backan",
"libraryUrl": "https://www.npmjs.com/package/backan",
"libraryId": "backan",
Expand Down
120 changes: 6 additions & 114 deletions packages/docs/src/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,120 +7,16 @@
*/

import { defineConfig } from 'vitepress'
import { description, funding, extra, repository, bugs, license} from "../../../../package.json"
import { joinPath, joinUrl } from '@backan/config/core'
import { description, extra, repository, license} from "../../../../package.json"
import { joinUrl } from '@backan/config/core'
import MarkdownItTaskList from 'markdown-it-task-lists'
import {srcDir,npmSVG } from './const'
import { sidebar, nav } from '../../../../.dev/docs.mjs'

const name = extra.productName
const repoUrl = repository.url.endsWith('/') ? repository.url : repository.url +'/' ;

const sidebar = [
{
text: 'Introduction',
items: [
{ text: 'What is BACKAN?', link: joinPath(extra.docsPath.guide,'/') },
]
},
{
text: 'Reference',
items: [
{
text: '📚 Library',
collapsed: false,
items: [
{
text: '🏁 Get started',
link: joinPath(extra.docsPath.core)
},
{
text: 'App',
link: joinPath(extra.docsPath.core, 'app')
},
{
text: 'Route',
link: joinPath(extra.docsPath.core, 'route')
},
{
text: 'Endpoints',
collapsed: true,
items: [
{
text: 'GET',
link: joinPath(extra.docsPath.core, 'get')
},
{
text: 'POST',
link: joinPath(extra.docsPath.core, 'post')
},
{
text: 'STREAM',
link: joinPath(extra.docsPath.core, 'stream')
},
{
text: 'PUT',
link: joinPath(extra.docsPath.core, 'put')
},
{
text: 'DELETE',
link: joinPath(extra.docsPath.core, 'delete')
},
{
text: 'PATCH',
link: joinPath(extra.docsPath.core, 'patch')
},
]
},
]
},
{
text: '🎉 Create (setup)',
link: joinPath(extra.docsPath.create, 'index.md')
},
{
text: '🗄️ Server',
link: joinPath(extra.docsPath.server, 'index.md')
},
{
text: '📦 Builder',
link: joinPath(extra.docsPath.builder, 'index.md')
},
]
},
{
text: 'Contribute',
items: [
{ text: 'Report issues', link: bugs.url },
{ text: 'Todo', link: joinPath(extra.docsPath.todo,'/v1') },
]
},
{
text: 'About',
items: [
{ text: 'License', link: repoUrl+ 'blob/main/LICENSE'},
{ text: 'More projects', link: extra.collective.web },
]
}
]
const nav = [
{
text: 'Home',
link: '/'
},
{
text: 'Guide',
activeMatch: '/^\/guide\//',
link: joinPath(extra.docsPath.guide),
},
{
text: 'Donate',
link: funding.url
},
]

export default defineConfig({

title: `${name} - A Cross-Browser Extension Builder`,
title: `${name} - ${extra.shortDesc}`,
titleTemplate: `:title - ${name} Documentation`,
description,
lang: 'en',
Expand Down Expand Up @@ -149,15 +45,11 @@ export default defineConfig({
provider: 'local'
},
editLink: {
pattern: joinUrl(repoUrl, 'edit/main/docs/:path'),
pattern: joinUrl(repository.url, 'edit/main/docs/:path'),
},
outline: 'deep',
nav,
sidebar: {
'/guide/': sidebar,
'/todo/': sidebar,
},
// socialLinks: extra.socialLinks as DefaultTheme.SocialLink[],
sidebar,
socialLinks: [
{
icon: {svg: npmSVG},
Expand Down
3 changes: 2 additions & 1 deletion packages/docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"include": [
"./src/*.vue",
"./node_modules/*.json",
"../../package.json"
"../../package.json",
"../../.dev"
]
}

0 comments on commit a431da3

Please sign in to comment.