-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #568 from holistics/upgrade/homepage-to-docusaurus
Docs - Migrate dbml homepage to docusaurus
- Loading branch information
Showing
27 changed files
with
10,547 additions
and
24 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 |
---|---|---|
@@ -1,33 +1,33 @@ | ||
name: build docs | ||
name: Build DBML docs | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
paths: | ||
- 'dbml-homepage/**' | ||
pull_request: | ||
branches: [ master ] | ||
types: [opened, synchronize] | ||
branches: | ||
- master | ||
paths: | ||
- 'dbml-homepage/**' | ||
- 'dbml-docs/**' | ||
|
||
jobs: | ||
build: | ||
name: Build Docusaurus | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
working-directory: dbml-homepage | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
working-directory: dbml-docs | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Build docs page | ||
run: yarn build | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: yarn | ||
cache-dependency-path: ./dbml-docs/yarn.lock | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build source code | ||
run: yarn build |
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,54 @@ | ||
name: Deploy DBML docs to Github Pages | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
build: | ||
name: Build Docusaurus | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
working-directory: dbml-docs | ||
|
||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: yarn | ||
cache-dependency-path: ./dbml-docs/yarn.lock | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build source code | ||
run: yarn build | ||
|
||
- name: Upload build artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: dbml-docs/build | ||
|
||
deploy: | ||
name: Deploy to GitHub Pages | ||
needs: build | ||
|
||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
|
||
# Deploy to the github-pages environment | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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
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,22 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
.vercel |
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,6 @@ | ||
.docusaurus | ||
node_modules/ | ||
static/ | ||
*.json | ||
*.md | ||
.prettierrc |
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,25 @@ | ||
{ | ||
"arrowParens": "always", | ||
"printWidth": 120, | ||
"semi": true, | ||
"singleAttributePerLine": false, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"overrides": [ | ||
{ | ||
"files": "*.css", | ||
"options": { | ||
"parser": "css" | ||
} | ||
}, | ||
{ | ||
"files": "*.scss", | ||
"options": { | ||
"parser": "scss" | ||
} | ||
} | ||
], | ||
"endOfLine": "lf" | ||
} |
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,55 @@ | ||
# DBML Docs | ||
|
||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
```bash | ||
yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
```bash | ||
yarn dev | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Commit | ||
|
||
Before commit your code, please run this command to make the code prettier. | ||
|
||
```bash | ||
yarn format | ||
``` | ||
|
||
### Build | ||
|
||
```bash | ||
yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Preview local build | ||
|
||
Please ensure you run the build command before running the following command | ||
|
||
```bash | ||
yarn serve | ||
``` | ||
|
||
### Deployment | ||
|
||
This page is deployed to Github Pages. | ||
|
||
To deploy this site, please manually trigger ***Deploy DBML docs to Github Pages*** action. | ||
|
||
For more details, please read [Manually running a workflow](https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow). | ||
|
||
### Document searching function | ||
|
||
We are currently using [docusaurus-lunr-search](https://www.npmjs.com/package/docusaurus-lunr-search) package. | ||
|
||
This package only works on production environment, so if you want to test this feature, please serve the application on your local machine. Refer to the ***Preview local build*** section. |
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 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
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,46 @@ | ||
import { Navbar } from '@docusaurus/theme-common'; | ||
|
||
const NavbarConfigs: Navbar = { | ||
title: 'DBML', | ||
hideOnScroll: false, | ||
logo: { | ||
alt: 'DBML logo', | ||
src: 'img/dbml-logo.png', | ||
}, | ||
items: [ | ||
{ | ||
type: 'docSidebar', | ||
sidebarId: 'docs', | ||
position: 'left', | ||
label: 'Docs', | ||
}, | ||
{ | ||
type: 'dropdown', | ||
label: 'dbx', | ||
position: 'right', | ||
className: 'dbx-dropdown', | ||
items: [ | ||
{ | ||
label: 'dbdiagram - Database Diagram As Code', | ||
href: 'https://dbdiagram.io/?utm_source=dbml', | ||
}, | ||
{ | ||
label: 'dbdocs - Database Docs As Code', | ||
href: 'https://dbdocs.io/?utm_source=dbml', | ||
}, | ||
{ | ||
label: 'Holistics.io - BI Reporting As Code', | ||
href: 'https://www.holistics.io/?utm_source=dbml&utm_medium=topnav&utm_campaign=landing', | ||
}, | ||
], | ||
}, | ||
{ | ||
href: 'https://github.com/holistics/dbml', | ||
position: 'right', | ||
className: 'header-github-link', | ||
'aria-label': 'GitHub repository', | ||
}, | ||
], | ||
}; | ||
|
||
export default NavbarConfigs; |
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,18 @@ | ||
// https://docusaurus.io/docs/sidebar | ||
import { SidebarsConfig } from '@docusaurus/plugin-content-docs'; | ||
|
||
/** | ||
* Creating a sidebar enables you to: | ||
- create an ordered group of docs | ||
- render a sidebar for each doc of that group | ||
- provide next/previous navigation | ||
The sidebars can be generated from the filesystem, or explicitly defined here. | ||
Create as many sidebars as you want. | ||
*/ | ||
const SidebarConfigs: SidebarsConfig = { | ||
docs: ['home', 'syntax', 'cli', 'js-module'], | ||
}; | ||
|
||
export default SidebarConfigs; |
Oops, something went wrong.