pack: separate documentation build script from root package.json to docs directory root

This commit is contained in:
leejooy96 committed 2023-03-08 13:13:46 +09:00
1 parent 47d27ee7ca
commit a3b554fa8f
19 files changed
+1145 -28

No files matched your search

-1
View File
@@ -1,7 +1,6 @@
node_modules/ node_modules/
buildAssets/ buildAssets/
dist/ dist/
distDocs/
release/ release/
docs/ docs/
+10 -9
View File
@@ -15,18 +15,21 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
working_directory: ./docs
with: with:
# fetch all commits to get last updated time or other git log info # fetch all commits to get last updated time or other git log info
fetch-depth: 0 fetch-depth: 0
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v1 uses: actions/setup-node@v1
working_directory: ./docs
with: with:
node-version: '18' node-version: '18'
# cache node_modules # cache node_modules
- name: Cache dependencies - name: Cache dependencies
uses: actions/cache@v2 uses: actions/cache@v2
working_directory: ./docs
id: npm-cache id: npm-cache
with: with:
path: | path: |
@@ -37,19 +40,16 @@ jobs:
# install dependencies if the cache did not hit # install dependencies if the cache did not hit
- name: Install dependencies - name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true' if: steps.npm-cache.outputs.cache-hit != 'true'
working_directory: ./docs
run: npm i run: npm i
# install for document build
- name: Install for document dependencies
run: npm run docs:install
# copy and replace string index.md file # copy and replace string index.md file
- name: Copy and replace string index.md file - name: Copy and replace string index.md file
run: cp README.md docs/index.md run: cp README.md docs/src/index.md
- name: Copy image asset (logo) - name: Copy image asset (logo)
run: cp src/renderer/public/images/vutron-logo.webp docs/public run: cp src/renderer/public/images/vutron-logo.webp docs/src/public
- name: Copy image asset (sample) - name: Copy image asset (sample)
run: cp .github/resources/vutron-sample.webp docs/public run: cp .github/resources/vutron-sample.webp docs/src/public
- name: Find and Replace (logo) - name: Find and Replace (logo)
uses: jacobtomlinson/gha-find-replace@v2 uses: jacobtomlinson/gha-find-replace@v2
@@ -67,7 +67,8 @@ jobs:
# run build script # run build script
- name: Build VitePress site - name: Build VitePress site
run: npm run docs:build working_directory: ./docs
run: npm run build
# please check out the docs of the workflow for more details # please check out the docs of the workflow for more details
# @see https://github.com/crazy-max/ghaction-github-pages # @see https://github.com/crazy-max/ghaction-github-pages
@@ -77,7 +78,7 @@ jobs:
# deploy to gh-pages branch # deploy to gh-pages branch
target_branch: gh-pages target_branch: gh-pages
# deploy the default output dir of VitePress # deploy the default output dir of VitePress
build_dir: distDocs build_dir: docs/dist
jekyll: false jekyll: false
fqdn: 'vutron.jooy2.com' fqdn: 'vutron.jooy2.com'
env: env:
-8
View File
@@ -28,14 +28,6 @@ TEST*.xml
# Generated by Windows # Generated by Windows
Thumbs.db Thumbs.db
# VitePress files
/distDocs
/distDocs/*
/docs/.vitepress/.temp
/docs/.vitepress/.temp/*
/docs/.vitepress/.cache
/docs/.vitepress/.cache/*
# Applications # Applications
*.app *.app
*.exe *.exe
+1 -1
View File
@@ -9,5 +9,5 @@
.github/ .github/
buildAssets/ buildAssets/
dist/ dist/
distDocs/ docs/dist/
release/ release/
+10
View File
@@ -0,0 +1,10 @@
# Node artifact files
node_modules/
# VitePress files
dist
dist/*
src/.vitepress/.temp
src/.vitepress/.temp/*
src/.vitepress/cache
src/.vitepress/cache/*
+1103
View File
File diff suppressed because it is too large. Load diff
+17
View File
@@ -0,0 +1,17 @@
{
"name": "docs",
"version": "1.0.0",
"scripts": {
"install": "npm i --no-save vitepress vitepress-sidebar",
"dev": "vitepress dev src",
"build": "vitepress build src",
"serve": "vitepress serve src"
},
"author": "jooy2 <jooy2.contact@gmail.com>",
"license": "MIT",
"dependencies": {
"vitepress": "^1.0.0-alpha.50",
"vitepress-sidebar": "^1.2.0",
"vue": "^3.2.47"
}
}
@@ -1,21 +1,20 @@
// @ts-ignore // @ts-ignore
import { generateSidebar } from 'vitepress-sidebar' import { generateSidebar } from 'vitepress-sidebar'
import { name, description, repository } from '../../package.json' import { name, description, repository } from '../../../package.json'
const capitalizeFirst = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1) const capitalizeFirst = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1)
export default { export default {
title: capitalizeFirst(name), title: capitalizeFirst(name),
description, description,
outDir: '../distDocs', outDir: '../dist',
head: [ head: [
['link', { rel: 'icon', href: '/logo.png' }], ['link', { rel: 'icon', href: '/logo.png' }],
['link', { rel: 'shortcut icon', href: '/favicon.ico' }] ['link', { rel: 'shortcut icon', href: '/favicon.ico' }]
], ],
themeConfig: { themeConfig: {
sidebar: generateSidebar({ sidebar: generateSidebar({
root: 'docs', root: 'src',
collapsible: false,
collapsed: false, collapsed: false,
useTitleFromFileHeading: true, useTitleFromFileHeading: true,
sortByFileName: [ sortByFileName: [
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1 -5
View File
@@ -27,11 +27,7 @@
"lint": "eslint --ext .js,.ts,.vue -f ./node_modules/eslint-friendly-formatter src", "lint": "eslint --ext .js,.ts,.vue -f ./node_modules/eslint-friendly-formatter src",
"lint:fix": "eslint --ext .js,.ts,.vue -f ./node_modules/eslint-friendly-formatter --fix src", "lint:fix": "eslint --ext .js,.ts,.vue -f ./node_modules/eslint-friendly-formatter --fix src",
"format": "prettier .", "format": "prettier .",
"format:fix": "prettier . --write", "format:fix": "prettier . --write"
"docs:install": "npm i --no-save vitepress vitepress-sidebar",
"docs:dev": "vitepress dev docs",
"docs:build": "npm run format:fix && vitepress build docs",
"docs:serve": "npm run docs:build && vitepress serve docs"
}, },
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"