Skip to content

Commit

Permalink
docs: migrate docs generator to vitepress (#403)
Browse files Browse the repository at this point in the history
* chore(vitepress): add basic files

* chore(vitepress): add dev deps & scripts for use

* chore(vitepress config): change to ts for type checks

* chore(vitepress config): remove js file

* chore(vitepress theme): add custom theme css

* chore(vitepress docs): add simple home page

* chore(gitignore): ignore doc dist

* chore(favicon): add icon to head

* feat(doc-features): add features spotlight

* chore(doc footer): made with ❤️

* chore(structure): move md files into `./src`

* chore(config): re-organise

* chore: custom dev port

* feat: documentation pages

* refactor: modified config

* feat: social links

* style: formatted code

* feat: removed code groups temporarily

* fix: fixed bundlephobia svg

* docs: general documentation remake

* docs: more rewritting

Co-authored-by: arthurfiorette <arthur.fiorette@gmail.com>
  • Loading branch information
cainthebest and arthurfiorette committed Dec 6, 2022
1 parent 11cbe81 commit de91d05
Show file tree
Hide file tree
Showing 103 changed files with 1,914 additions and 13,088 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ package-lock.json
.yarn/*
!.yarn/releases
!.yarn/plugins

benchmark/index.js
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
- uses: ahmadnassri/action-dependabot-auto-merge@v2.6
with:
github-token: ${{ secrets.AUTOMERGE_TOKEN }}
command: "squash and merge"
command: 'squash and merge'
target: minor
59 changes: 59 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy docs

on:
workflow_dispatch:
inputs:
version:
description: 'Publish as version:'
required: true
latest:
description: 'Override latest version:'
required: true


permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Setup node and restore cached dependencies
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org/'
cache: 'yarn'

- name: Install packages
run: yarn install --prefer-offline

- name: Build
run: npm run docs:build

- name: Deploy to ${{ github.event.inputs.version }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./docs/.vitepress/dist
branch: gh-pages
target-folder: ${{ github.event.inputs.version }}
clean: true
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Deploy docs for ${{ github.event.inputs.version }}"

- name: Deploy to latest
if: ${{ github.event.inputs.latest == 'true' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./docs/.vitepress/dist
target-folder: docs # To use the docs folder of github pages
clean: true
branch: gh-pages
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Deploy docs for latest"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ node_modules
/dist
/dev

# Documentation output
docs/.vitepress/dist

# Random
/ignore
*.log
Expand Down
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<p align="center">
Help axios-cache-interceptor grow! Star and share this amazing repo with your friends and co-workers!
<i>
Help axios-cache-interceptor grow! Star and share this amazing repo with your friends and co-workers!
</i>
</p>

<br />
Expand All @@ -17,16 +19,8 @@

<br />

<div align="center">
<pre>
<h1>⚡
Axios Cache Interceptor</h1>
</pre>
<br />
</div>

<h3 align="center">
<code>Axios Cache Interceptor</code> is a small and efficient cache interceptor for axios.
<b>⚡Axios Cache Interceptor</b> is a small and efficient cache interceptor for axios.
<br />
<br />
</h3>
Expand Down
10 changes: 6 additions & 4 deletions new-docs/benchmark.js → benchmark/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* eslint-disable */

const Benny = require('benny');
const { execSync } = require('child_process');
const { writeFileSync } = require('fs');
const path = require('path');

// Outputs into the documentation folder
const output = path.resolve(__dirname, '../docs/src/generated/benchmark.md');

const Axios = require('axios').default;
const AxiosInstance = Axios.create();
Expand Down Expand Up @@ -63,7 +65,7 @@ Benny.suite(
server.close();

writeFileSync(
'src/generated/benchmark.md',
output,
`# Result
Run at ${new Date().toUTCString()}
Expand All @@ -72,7 +74,7 @@ ${summary.results
.sort((a, b) => a.percentSlower - b.percentSlower)
.map(
(options) => `
- ${options.name.split('-').join(' ').toUpperCase()}
${options.name.split('-').join(' ').toUpperCase()}
Operations: ${options.ops}/s
Network requests: ${data[options.name]} of ${runs[options.name]}
Performance: ${(100 - options.percentSlower).toFixed(2)}%`
Expand Down
12 changes: 4 additions & 8 deletions new-docs/package.json → benchmark/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aci/docs",
"version": "0.0.1",
"name": "@aci/benchmark",
"version": "1.0.0",
"description": "Cache interceptor for axios",
"main": "index.js",
"authors": {
Expand All @@ -9,17 +9,13 @@
},
"repository": "https://github.com/arthurfiorette/axios-cache-interceptor/@aci/docs",
"scripts": {
"dev": "vuepress dev src",
"build": "vuepress build src",
"bench": "node benchmark.js"
"start": "node index.js"
},
"license": "MIT",
"devDependencies": {
"@vuepress/plugin-google-analytics": "^1.9.7",
"vuepress": "^1.5.3",
"axios": "^0.27.2",
"axios-cache-adapter": "^2.7.3",
"benny": "^3.7.1",
"express": "^4.18.1"
}
}
}
2 changes: 0 additions & 2 deletions docs/.gitignore

This file was deleted.

1 change: 1 addition & 0 deletions docs/.gitingore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vitepress/dist

0 comments on commit de91d05

Please sign in to comment.