-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: support
VitePress
official docs 🚀 (#71)
* docs: support `VitePress` official docs 🚀 * ci: release docs workflow
- Loading branch information
Showing
23 changed files
with
1,959 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Deploy VitePress Docs 📚 | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'docs/**' | ||
- '.github/workflows/deploy-docs.yaml' | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: pages | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
checks: | ||
name: Checks 🧪 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checks 🧪 | ||
uses: ./.github/workflows/health-check | ||
|
||
build: | ||
name: Build 🔨 | ||
runs-on: ubuntu-latest | ||
needs: | ||
- checks | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 🖥️ Setup Env | ||
uses: ./.github/workflows/install | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
|
||
- name: Build with VitePress | ||
run: npm run docs:build | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: 'dist/docs' | ||
|
||
deploy: | ||
name: Deploy 🚀 | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
--- | ||
name: '📦 Create New Release' | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- 'docs/**' | ||
branches: | ||
- master | ||
- beta | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cache/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { defineConfig } from 'vitepress' | ||
import { remoteDefaultBranch, repositoryFullname } from './constants/repository.mjs' | ||
import { NAVBAR } from './navbar.config.mjs' | ||
import { SIDEBAR } from './sidebar.config.mjs' | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
title: 'Shell Config', | ||
description: 'CLI Tool for MacOS setup - apps, shell, assets, etc', | ||
base: `/pages/${repositoryFullname}/`, | ||
cleanUrls: true, | ||
ignoreDeadLinks: false, | ||
outDir: '../dist/docs/', | ||
markdown: { | ||
defaultHighlightLang: 'typescript', | ||
breaks: true, | ||
lineNumbers: true, | ||
}, | ||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
nav: NAVBAR, | ||
sidebar: SIDEBAR, | ||
socialLinks: [ | ||
// | ||
{ icon: 'github', link: `https://github.com/${repositoryFullname}#readme` }, | ||
], | ||
search: { provider: 'local' }, | ||
editLink: { | ||
pattern: `https://github.com/${repositoryFullname}/edit/${remoteDefaultBranch}/docs/:path`, | ||
text: 'Edit this page on GitHub', | ||
}, | ||
lastUpdated: { | ||
formatOptions: { dateStyle: 'medium' }, | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { execSync } from 'node:child_process'; | ||
import { env } from 'node:process'; | ||
|
||
const remoteOrigin = | ||
env.GITHUB_SERVER_URL && env.GITHUB_REPOSITORY | ||
? `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}.git` | ||
: execSync('git remote get-url origin').toString().trim(); | ||
|
||
export const remoteBaseURL = new URL(remoteOrigin).origin; | ||
|
||
export const repositoryLink = remoteOrigin.replace(/\.git$/m, ''); | ||
|
||
export const repositoryFullname = env.GITHUB_REPOSITORY || remoteOrigin.match(/^https:\/\/.*\/(.*\/.*).git$/m)?.[1]; | ||
|
||
// TODO: dynamically get the default branch | ||
export const remoteDefaultBranch = 'master'; | ||
|
||
if (!remoteBaseURL) { | ||
throw new Error('Could not find remote base URL!'); | ||
} else if (!repositoryLink) { | ||
throw new Error('Could not find repository link!'); | ||
} else if (!repositoryFullname) { | ||
throw new Error('Could not find repository fullname!'); | ||
} else if (!remoteDefaultBranch) { | ||
throw new Error('Could not find remote default branch!'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { DefaultTheme } from 'vitepress'; | ||
|
||
export const NAVBAR: DefaultTheme.NavItem[] = [{ text: 'Home', link: '/' }]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { DefaultTheme } from 'vitepress' | ||
|
||
export const SIDEBAR: DefaultTheme.Sidebar = [ | ||
{ | ||
text: 'Commands', | ||
collapsed: false, | ||
base: '/app/commands/', | ||
items: [ | ||
{ | ||
text: 'Install', | ||
link: '/install.md', | ||
}, | ||
{ | ||
text: 'Shell', | ||
link: '/shell.md', | ||
}, | ||
{ | ||
text: 'Assets', | ||
link: '/assets.md', | ||
}, | ||
{ | ||
text: 'Update', | ||
link: '/update.md', | ||
}, | ||
], | ||
}, | ||
{ | ||
text: 'Troubleshooting', | ||
collapsed: false, | ||
base: '/app/troubleshooting/', | ||
items: [ | ||
{ | ||
text: 'Permissions', | ||
link: '/permissions.md', | ||
}, | ||
{ | ||
text: 'Not Found', | ||
link: '/not-found.md', | ||
}, | ||
], | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<script setup> | ||
const repoUrl = 'https://github.com/Avivbens/shell-config/tree/HEAD' | ||
</script> | ||
|
||
# Assets Command | ||
|
||
The `assets` command is used to configure your MacOS assets, such as `gitconfig` and `npmrc`. | ||
|
||
## Usage | ||
|
||
```bash | ||
shell-config assets | ||
``` | ||
|
||
Select and customize the assets according to your needs, by using the arrow keys and space bar to enter into menus. Press `Enter` to apply the selected assets. | ||
|
||
For each selected asset, you'd be asked to provide the required information. | ||
|
||
::: warning **Note ❗** | ||
For some configuration, you may be asked to provide your password. | ||
Pay attention to the password inputs if needed! *(key icon)* | ||
::: | ||
|
||
## Multi Profiles Support | ||
|
||
Both `gitconfig` and `npmrc` assets support multi profiles. | ||
|
||
You can create as many profiles as you wish, and simply switch between them using the `npmrc` NPM package / `swgit` command for `gitprofile`. | ||
|
||
## Assets | ||
|
||
- [Git Profile](https://github.com/Avivbens/shell-config/tree/HEAD/assets/.gitconfig.template) | ||
- [npmrc Default](https://github.com/Avivbens/shell-config/tree/HEAD/assets/.npmrc.template) | ||
- [npmrc Custom](https://github.com/Avivbens/shell-config/tree/HEAD/assets/.npmrc.custom.template) | ||
|
||
## Examples | ||
|
||
![Assets Page](../../assets/assets-command.jpg) |
Oops, something went wrong.