Skip to content

Commit 80dec7b

Browse files
Merge pull request #123 from knowledgecode/develop
docs: migrate documentation site from VitePress to Astro Starlight
2 parents ebcd8f6 + f63a74a commit 80dec7b

43 files changed

Lines changed: 7820 additions & 3785 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-docs.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Deploy VitePress site to GitHub Pages
1+
name: Deploy Starlight site to GitHub Pages
22

33
on:
44
push:
55
branches:
66
- master
77
paths:
88
- 'docs/**'
9+
- 'astro.config.mjs'
910
- '.github/workflows/deploy-docs.yml'
1011
workflow_dispatch:
1112

@@ -24,13 +25,11 @@ jobs:
2425
steps:
2526
- name: Checkout
2627
uses: actions/checkout@v4
27-
with:
28-
fetch-depth: 0
2928

3029
- name: Setup Node.js
3130
uses: actions/setup-node@v4
3231
with:
33-
node-version: 18
32+
node-version: 'lts/*'
3433
cache: npm
3534

3635
- name: Setup Pages
@@ -39,20 +38,23 @@ jobs:
3938
- name: Install dependencies
4039
run: npm ci
4140

42-
- name: Build with VitePress
41+
- name: Build with Astro
4342
run: npm run docs:build
4443

4544
- name: Upload artifact
4645
uses: actions/upload-pages-artifact@v3
4746
with:
48-
path: docs/.vitepress/dist
47+
path: pages
4948

5049
deploy:
5150
needs: build
5251
runs-on: ubuntu-latest
5352
permissions:
5453
pages: write
5554
id-token: write
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
5658
steps:
5759
- name: Deploy to GitHub Pages
5860
id: deployment

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
cache/
44
coverage/
55
dist/
6+
pages/
67
node_modules/
8+
9+
# Astro
10+
.astro/

astro.config.mjs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import { defineConfig } from 'astro/config';
2+
import starlight from '@astrojs/starlight';
3+
4+
export default defineConfig({
5+
outDir: './pages',
6+
srcDir: './docs',
7+
site: 'https://knowledgecode.github.io',
8+
base: '/date-and-time',
9+
trailingSlash: 'never',
10+
devToolbar: {
11+
enabled: false,
12+
},
13+
markdown: {
14+
shikiConfig: {
15+
themes: {
16+
light: 'github-light',
17+
dark: 'github-dark',
18+
},
19+
},
20+
},
21+
integrations: [
22+
starlight({
23+
customCss: [
24+
'./docs/styles/custom.css',
25+
],
26+
title: 'date-and-time',
27+
description: 'The simplest, most intuitive date and time library',
28+
logo: {
29+
src: './docs/assets/logo.png',
30+
alt: 'date-and-time',
31+
},
32+
social: [
33+
{ icon: 'github', label: 'GitHub', href: 'https://github.com/knowledgecode/date-and-time' },
34+
{ icon: 'npm', label: 'npm', href: 'https://www.npmjs.com/package/date-and-time' },
35+
],
36+
sidebar: [
37+
{
38+
label: 'Getting Started',
39+
items: [
40+
{ label: 'Introduction', link: '/guide' },
41+
{ label: 'Installation', link: '/guide/installation' },
42+
{ label: 'Quick Start', link: '/guide/quick-start' },
43+
],
44+
},
45+
{
46+
label: 'API Reference',
47+
collapsed: true,
48+
items: [
49+
{ label: 'Overview', link: '/api' },
50+
{
51+
label: 'Core Functions',
52+
items: [
53+
{ label: 'format()', link: '/api/format' },
54+
{ label: 'parse()', link: '/api/parse' },
55+
{ label: 'compile()', link: '/api/compile' },
56+
{ label: 'preparse()', link: '/api/preparse' },
57+
{ label: 'isValid()', link: '/api/isvalid' },
58+
{ label: 'transform()', link: '/api/transform' },
59+
{ label: 'addYears()', link: '/api/addyears' },
60+
{ label: 'addMonths()', link: '/api/addmonths' },
61+
{ label: 'addDays()', link: '/api/adddays' },
62+
{ label: 'addHours()', link: '/api/addhours' },
63+
{ label: 'addMinutes()', link: '/api/addminutes' },
64+
{ label: 'addSeconds()', link: '/api/addseconds' },
65+
{ label: 'addMilliseconds()', link: '/api/addmilliseconds' },
66+
{ label: 'subtract()', link: '/api/subtract' },
67+
],
68+
},
69+
{
70+
label: 'Utility Functions',
71+
items: [
72+
{ label: 'isLeapYear()', link: '/api/utils/isleapyear' },
73+
{ label: 'isSameDay()', link: '/api/utils/issameday' },
74+
{ label: 'getDaysInMonth()', link: '/api/utils/getdaysinmonth' },
75+
{ label: 'getISOWeekYear()', link: '/api/utils/getisoweekyear' },
76+
{ label: 'getISOWeek()', link: '/api/utils/getisoweek' },
77+
],
78+
},
79+
],
80+
},
81+
{ label: 'Locales', link: '/locales' },
82+
{ label: 'Timezones', link: '/timezones' },
83+
{ label: 'Plugins', link: '/plugins' },
84+
{ label: 'Migration Guide', link: '/migration' },
85+
],
86+
}),
87+
],
88+
});

docs/.vitepress/config.ts

Lines changed: 0 additions & 98 deletions
This file was deleted.

docs/api/addDays.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# addDays()
1+
---
2+
title: addDays()
3+
---
24

35
Adds or subtracts days from a Date object. Handles month boundaries, leap years, and daylight saving time transitions properly.
46

docs/api/addHours.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# addHours()
1+
---
2+
title: addHours()
3+
---
24

35
Adds or subtracts hours from a Date object.
46

docs/api/addMilliseconds.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# addMilliseconds()
1+
---
2+
title: addMilliseconds()
3+
---
24

35
Adds or subtracts milliseconds from a Date object.
46

docs/api/addMinutes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# addMinutes()
1+
---
2+
title: addMinutes()
3+
---
24

35
Adds or subtracts minutes from a Date object.
46

docs/api/addMonths.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# addMonths()
1+
---
2+
title: addMonths()
3+
---
24

35
Adds or subtracts months from a Date object. Handles month boundaries, leap years, and varying month lengths appropriately.
46

docs/api/addSeconds.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# addSeconds()
1+
---
2+
title: addSeconds()
3+
---
24

35
Adds or subtracts seconds from a Date object.
46

0 commit comments

Comments
 (0)