From ad9b3b733eb3c73f9149624f1f33b48c8a3178ab Mon Sep 17 00:00:00 2001 From: "Mr.Hope" Date: Wed, 6 Dec 2023 18:48:49 +0800 Subject: [PATCH] style: introduce prettier and lint --- .gitignore | 12 +---- .prettierignore | 9 ++++ package.json | 4 ++ pnpm-lock.yaml | 11 ++++ src/.vuepress/config.ts | 28 +++++----- src/.vuepress/navbar/en.ts | 46 ++++++++--------- src/.vuepress/navbar/index.ts | 4 +- src/.vuepress/navbar/zh.ts | 45 ++++++++-------- src/.vuepress/sidebar/en.ts | 51 ++++++++++--------- src/.vuepress/sidebar/index.ts | 4 +- src/.vuepress/sidebar/zh.ts | 51 ++++++++++--------- src/.vuepress/styles/index.scss | 9 ++-- .../install/install_zlmediakit_using_vcpkg.md | 27 +++------- 13 files changed, 154 insertions(+), 147 deletions(-) create mode 100644 .prettierignore diff --git a/.gitignore b/.gitignore index 0ea0392..bad9162 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,15 @@ # Node modules **/node_modules/** -# Build files -docs-shared/lib/ -packages/*/lib/ - # Vuepress Cache **/.vuepress/.cache/** # Vuepress Temp **/.vuepress/.temp/** # Vuepress Output -#dist/ +**/.vuepress/dist/ # npm config .npmrc -# Typescript build info -*.tsbuildinfo - -# Coverage Files -coverage/ - # macOS .DS_Store diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..3737648 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +# Node modules +**/node_modules/** + +# Vuepress Cache +**/.vuepress/.cache/** +# Vuepress Temp +**/.vuepress/.temp/** +# Vuepress Output +**/.vuepress/dist/ diff --git a/package.json b/package.json index c4e7fdb..b96ff8b 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "docs:build": "vuepress build src", "docs:clean-dev": "vuepress dev src --clean-cache", "docs:dev": "vuepress dev src", + "docs:lint": "prettier --check --write src", "docs:update-package": "npx vp-update" }, "packageManager": "pnpm@8.11.0", @@ -19,5 +20,8 @@ "vue": "^3.3.10", "vuepress": "2.0.0-rc.0", "vuepress-theme-hope": "2.0.0-rc.2" + }, + "dependencies": { + "prettier": "^3.1.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 883c62b..1c8dac5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +dependencies: + prettier: + specifier: ^3.1.0 + version: 3.1.0 + devDependencies: '@vuepress/bundler-vite': specifier: 2.0.0-rc.0 @@ -4778,6 +4783,12 @@ packages: source-map-js: 1.0.2 dev: true + /prettier@3.1.0: + resolution: {integrity: sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==} + engines: {node: '>=14'} + hasBin: true + dev: false + /pretty-bytes@5.6.0: resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} engines: {node: '>=6'} diff --git a/src/.vuepress/config.ts b/src/.vuepress/config.ts index 2f6f51a..5d1687d 100644 --- a/src/.vuepress/config.ts +++ b/src/.vuepress/config.ts @@ -1,21 +1,21 @@ -import { viteBundler } from "@vuepress/bundler-vite"; -import { path } from "@vuepress/utils"; -import { defineUserConfig } from "vuepress"; -import theme from "./theme.js"; +import { viteBundler } from '@vuepress/bundler-vite' +import { path } from '@vuepress/utils' +import { defineUserConfig } from 'vuepress' +import theme from './theme.js' export default defineUserConfig({ - base: "/", + base: '/', locales: { - "/": { - lang: "en-US", - title: "ZLMediaKit", - description: "Official documentation for ZLMediaKit", + '/': { + lang: 'en-US', + title: 'ZLMediaKit', + description: 'Official documentation for ZLMediaKit', }, - "/zh/": { - lang: "zh-CN", - title: "ZLMediaKit", - description: "ZLMediaKit 官方文档", + '/zh/': { + lang: 'zh-CN', + title: 'ZLMediaKit', + description: 'ZLMediaKit 官方文档', }, }, @@ -30,4 +30,4 @@ export default defineUserConfig({ theme, shouldPrefetch: false, -}); +}) diff --git a/src/.vuepress/navbar/en.ts b/src/.vuepress/navbar/en.ts index 69879b7..6fdde47 100644 --- a/src/.vuepress/navbar/en.ts +++ b/src/.vuepress/navbar/en.ts @@ -1,25 +1,25 @@ -import {navbar} from "vuepress-theme-hope"; +import { navbar } from 'vuepress-theme-hope' export const enNavbar = navbar([ - "/", - "/guide/", - "/tutorial/", - { - text: "Reference", - icon: "lightbulb", - prefix: "/reference/", - children: ["test", - "resources", - "documents", - "development_log" - ], - }, - { - text: "More", - icon: "lightbulb", - prefix: "/more/", - children: [ - "collaborative_projects", 'license', 'thanks', "contact", "use_cases" - ], - }, -]); + '/', + '/guide/', + '/tutorial/', + { + text: 'Reference', + icon: 'lightbulb', + prefix: '/reference/', + children: ['test', 'resources', 'documents', 'development_log'], + }, + { + text: 'More', + icon: 'lightbulb', + prefix: '/more/', + children: [ + 'collaborative_projects', + 'license', + 'thanks', + 'contact', + 'use_cases', + ], + }, +]) diff --git a/src/.vuepress/navbar/index.ts b/src/.vuepress/navbar/index.ts index e508968..7183393 100644 --- a/src/.vuepress/navbar/index.ts +++ b/src/.vuepress/navbar/index.ts @@ -1,2 +1,2 @@ -export * from "./en.js"; -export * from "./zh.js"; +export * from './en.js' +export * from './zh.js' diff --git a/src/.vuepress/navbar/zh.ts b/src/.vuepress/navbar/zh.ts index fcb7364..18e5c51 100644 --- a/src/.vuepress/navbar/zh.ts +++ b/src/.vuepress/navbar/zh.ts @@ -1,24 +1,25 @@ -import {navbar} from "vuepress-theme-hope"; +import { navbar } from 'vuepress-theme-hope' export const zhNavbar = navbar([ - "/zh/", - "/zh/guide/", - "/zh/tutorial/", - { - text: "参考", - icon: "lightbulb", - prefix: "/zh/reference/", - children: ["test", - "resources", - "documents", "development_log" - ], - }, - { - text: "了解更多", - icon: "laptop-code", - prefix: "/zh/more/", - children: [ - "collaborative_projects", 'license', 'thanks', "contact", "use_cases" - ], - }, -]); + '/zh/', + '/zh/guide/', + '/zh/tutorial/', + { + text: '参考', + icon: 'lightbulb', + prefix: '/zh/reference/', + children: ['test', 'resources', 'documents', 'development_log'], + }, + { + text: '了解更多', + icon: 'laptop-code', + prefix: '/zh/more/', + children: [ + 'collaborative_projects', + 'license', + 'thanks', + 'contact', + 'use_cases', + ], + }, +]) diff --git a/src/.vuepress/sidebar/en.ts b/src/.vuepress/sidebar/en.ts index 03d3eb9..20d2ef3 100644 --- a/src/.vuepress/sidebar/en.ts +++ b/src/.vuepress/sidebar/en.ts @@ -1,27 +1,28 @@ -import {sidebar} from "vuepress-theme-hope"; +import { sidebar } from 'vuepress-theme-hope' export const enSidebar = sidebar({ - "/": [ - "", - "tutorial/", - { - text: "Docs", - icon: "book", - prefix: "guide/", - children: "structure", - }, { - text: "Reference", - icon: "laptop-code", - prefix: "reference/", - link: "reference/", - children: "structure", - }, - { - text: "More", - icon: "laptop-code", - prefix: "more/", - link: "more/", - children: "structure", - }, - ], -}); + '/': [ + '', + 'tutorial/', + { + text: 'Docs', + icon: 'book', + prefix: 'guide/', + children: 'structure', + }, + { + text: 'Reference', + icon: 'laptop-code', + prefix: 'reference/', + link: 'reference/', + children: 'structure', + }, + { + text: 'More', + icon: 'laptop-code', + prefix: 'more/', + link: 'more/', + children: 'structure', + }, + ], +}) diff --git a/src/.vuepress/sidebar/index.ts b/src/.vuepress/sidebar/index.ts index e508968..7183393 100644 --- a/src/.vuepress/sidebar/index.ts +++ b/src/.vuepress/sidebar/index.ts @@ -1,2 +1,2 @@ -export * from "./en.js"; -export * from "./zh.js"; +export * from './en.js' +export * from './zh.js' diff --git a/src/.vuepress/sidebar/zh.ts b/src/.vuepress/sidebar/zh.ts index 637b7bc..6eabeb7 100644 --- a/src/.vuepress/sidebar/zh.ts +++ b/src/.vuepress/sidebar/zh.ts @@ -1,27 +1,28 @@ -import {sidebar} from "vuepress-theme-hope"; +import { sidebar } from 'vuepress-theme-hope' export const zhSidebar = sidebar({ - "/zh/": [ - "", - "tutorial/", - { - text: "指南", - icon: "book", - prefix: "guide/", - children: "structure", - }, { - text: "参考", - icon: "laptop-code", - prefix: "reference/", - link: "reference/", - children: "structure", - }, - { - text: "了解更多", - icon: "laptop-code", - prefix: "more/", - link: "more/", - children: "structure", - }, - ], -}); + '/zh/': [ + '', + 'tutorial/', + { + text: '指南', + icon: 'book', + prefix: 'guide/', + children: 'structure', + }, + { + text: '参考', + icon: 'laptop-code', + prefix: 'reference/', + link: 'reference/', + children: 'structure', + }, + { + text: '了解更多', + icon: 'laptop-code', + prefix: 'more/', + link: 'more/', + children: 'structure', + }, + ], +}) diff --git a/src/.vuepress/styles/index.scss b/src/.vuepress/styles/index.scss index d4fe869..0af66c4 100644 --- a/src/.vuepress/styles/index.scss +++ b/src/.vuepress/styles/index.scss @@ -1,9 +1,10 @@ .vp-hero-info-wrapper { - width:100vw; + width: 100vw; background: url(/assets/image/bg.svg) center/cover no-repeat; } + @media (min-width: 768px) { - .vp-hero-info-wrapper { - height:100vh - } + .vp-hero-info-wrapper { + height: 100vh; + } } diff --git a/src/guide/install/install_zlmediakit_using_vcpkg.md b/src/guide/install/install_zlmediakit_using_vcpkg.md index 0df2985..56feaa4 100644 --- a/src/guide/install/install_zlmediakit_using_vcpkg.md +++ b/src/guide/install/install_zlmediakit_using_vcpkg.md @@ -2,11 +2,13 @@ title: Installing zlmediakit with vcpkg --- -# Introduction -vcpkg is a cross-platform SDK package management tool, similar to yum/apt on Linux and Homebrew on macOS. It supports multiple platforms such as Linux, macOS, and Windows, making it a powerful tool for C/C++ developers to manage dependencies. +## Introduction + +vcpkg is a cross-platform SDK package management tool, similar to yum/apt on Linux and Homebrew on macOS. It supports multiple platforms such as Linux, macOS, and Windows, making it a powerful tool for C/C++ developers to manage dependencies. Currently, zlmediakit has been added to vcpkg on August 8, 2023. Users can conveniently install zlmediakit C SDK and MediaServer executable program using vcpkg, resolving various compilation dependency-related issues. The inclusion of zlmediakit in vcpkg has received extensive support from [@JackBoosY](https://github.com/JackBoosY), and we express our sincere gratitude for that! -# Installation Guide +## Installation Guide + ## 1. Install vcpkg Taking Linux platform as an example: @@ -20,8 +22,6 @@ git clone https://github.com/microsoft/vcpkg > For specific instructions on different platforms, please refer to the [official documentation](https://github.com/microsoft/vcpkg/blob/master/README.md). - - ## 2. Install zlmediakit - Install dependencies first @@ -30,8 +30,6 @@ git clone https://github.com/microsoft/vcpkg sudo apt-get install pkg-config ``` - - - Install zlmediakit with default features ```bash @@ -39,24 +37,18 @@ git clone https://github.com/microsoft/vcpkg ./vcpkg/vcpkg install zlmediakit ``` - - - Install zlmediakit with all features (including webrtc datachannel) ```bash ./vcpkg/vcpkg install zlmediakit\[core,mp4,openssl,webrtc,sctp\] ``` - - - Install zlmediakit with minimum features ```bash ./vcpkg/vcpkg install zlmediakit\[core\] ``` - - - Uninstall zlmediakit ```bash @@ -64,8 +56,8 @@ git clone https://github.com/microsoft/vcpkg ``` - Installation path -![](/images/install_zlmediakit_using_vcpkg_1.png) -> The MediaServer process depends on config.ini, default.pem, www, and other related files, which can be copied from the source code. + ![](/images/install_zlmediakit_using_vcpkg_1.png) + > The MediaServer process depends on config.ini, default.pem, www, and other related files, which can be copied from the source code. ## 3. Install different versions @@ -75,8 +67,6 @@ git clone https://github.com/microsoft/vcpkg ./vcpkg/vcpkg help triplet ``` - - - Example for Linux ```bash @@ -111,6 +101,5 @@ git clone https://github.com/microsoft/vcpkg # Then install the dynamic library version ./vcpkg/vcpkg install zlmediakit\[core,mp4,openssl,webrtc,sctp\]:x64-linux-dynamic ``` -![install_zlmediakit_using_vcpkg_2](/images/install_zlmediakit_using_vcpkg_2.png) - + ![install_zlmediakit_using_vcpkg_2](/images/install_zlmediakit_using_vcpkg_2.png)