Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: support pnpm and remove yarn support #498

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions .github/workflows/docs-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,21 @@ jobs:
# fetch all commits to get last updated time or other git log info
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
# choose pnpm version to use
version: 8
# install deps with pnpm
run_install: true

- name: Setup Node.js
uses: actions/setup-node@v4
with:
# choose node.js version to use
node-version: "16"

# cache node_modules
- name: Cache dependencies
uses: actions/cache@v4
id: yarn-cache
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

# install dependencies if the cache did not hit
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile
node-version: 20
# cache deps for pnpm
cache: pnpm

- name: Prettier check
run: npx prettier --check docs/
run: pnpm prettier:check
30 changes: 12 additions & 18 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,25 @@ jobs:
# fetch all commits to get last updated time or other git log info
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
# choose pnpm version to use
version: 8
# install deps with pnpm
run_install: true

- name: Setup Node.js
uses: actions/setup-node@v4
with:
# choose node.js version to use
node-version: "16"

# cache node_modules
- name: Cache dependencies
uses: actions/cache@v4
id: yarn-cache
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

# install dependencies if the cache did not hit
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile
node-version: 20
# cache deps for pnpm
cache: pnpm

# run build script
- name: Build VuePress site
run: yarn docs:build
run: pnpm docs:build

# please check out the docs of the workflow for more details
# @see https://github.com/crazy-max/ghaction-github-pages
Expand Down
10 changes: 5 additions & 5 deletions docs/.vuepress/components/ArticleInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { frontmatter } = toRefs(props);
</script>

<style>
.line {
.info_line {
display: flex;
flex-direction: row;
align-items: center;
Expand All @@ -28,8 +28,8 @@ const { frontmatter } = toRefs(props);
</style>

<template>
<div class="line">
<div v-if="frontmatter.author" class="line container">
<div class="info_line">
<div v-if="frontmatter.author" class="info_line container">
<svg
t="1658821554263"
class="icon"
Expand All @@ -48,7 +48,7 @@ const { frontmatter } = toRefs(props);
</svg>
<p class="text">{{ frontmatter.author }}</p>
</div>
<div v-if="frontmatter.date" class="line container">
<div v-if="frontmatter.date" class="info_line container">
<svg
t="1658821678607"
class="icon"
Expand All @@ -72,7 +72,7 @@ const { frontmatter } = toRefs(props);
</svg>
<p class="text">{{ frontmatter.date }}</p>
</div>
<div v-if="frontmatter.minute" class="line container">
<div v-if="frontmatter.minute" class="info_line container">
<svg
t="1658821512864"
class="icon"
Expand Down
7 changes: 5 additions & 2 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { defineUserConfig } from "@vuepress/cli";
import { defineUserConfig } from "vuepress";
import { path } from "vuepress/utils";
import { defaultTheme } from "@vuepress/theme-default";
import { docsearchPlugin } from "@vuepress/plugin-docsearch";
import { mdEnhancePlugin } from "vuepress-plugin-md-enhance";
import { registerComponentsPlugin } from "@vuepress/plugin-register-components";
import { navbar, sidebar } from "./configs";
import { path } from "@vuepress/utils";
import { viteBundler } from "@vuepress/bundler-vite";

export default defineUserConfig({
base: "/PolarDB-for-PostgreSQL/",

bundler: viteBundler(),

head: [
["link", { rel: "icon", href: "/PolarDB-for-PostgreSQL/favicon.ico" }],
],
Expand Down
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
},
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
"docs:build": "vuepress build docs",
"prettier:check": "prettier --check docs/",
"prettier:format": "prettier --write docs/"
},
"repository": {
"type": "git",
Expand All @@ -20,10 +22,13 @@
},
"homepage": "https://github.com/ApsaraDB/PolarDB-for-PostgreSQL#readme",
"devDependencies": {
"@vuepress/plugin-docsearch": "2.0.0-beta.67",
"@vuepress/plugin-register-components": "2.0.0-beta.67",
"prettier": "2.8.8",
"vuepress": "2.0.0-beta.67",
"vuepress-plugin-md-enhance": "^2.0.0-beta.235"
"@vuepress/bundler-vite": "^2.0.0-rc.9",
"@vuepress/plugin-docsearch": "^2.0.0-rc.9",
"@vuepress/plugin-register-components": "^2.0.0-rc.9",
"@vuepress/theme-default": "^2.0.0-rc.9",
"vue": "^3.4.0",
"vuepress": "^2.0.0-rc.9",
"prettier": "3.2.5",
"vuepress-plugin-md-enhance": "^2.0.0-rc.33"
}
}
Loading