-
-
Notifications
You must be signed in to change notification settings - Fork 943
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding documentation with vitepress (#80)
- Loading branch information
1 parent
a590f26
commit 71e9025
Showing
29 changed files
with
3,618 additions
and
364 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 |
---|---|---|
|
@@ -71,6 +71,7 @@ versions.json | |
|
||
# Dist | ||
/dist | ||
/docs/.vitepress/dist | ||
|
||
# Faker | ||
TAGS | ||
|
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,114 @@ | ||
import { defineConfig } from 'vitepress'; | ||
|
||
const nav = [ | ||
{ text: 'Guide', link: '/guide/' }, | ||
// { text: 'Playground', link: '/playground/' }, | ||
]; | ||
|
||
const sidebar = { | ||
'/': [ | ||
{ | ||
text: 'Guide', | ||
children: [ | ||
{ | ||
text: 'Recent Statement and FAQs', | ||
link: '/guide/recent-faqs', | ||
}, | ||
{ | ||
text: 'Getting Started', | ||
link: '/guide/', | ||
}, | ||
], | ||
}, | ||
{ | ||
text: 'API', | ||
children: [ | ||
{ | ||
text: 'Address', | ||
link: '/api/address', | ||
collapsable: false, // optional, defaults to true | ||
}, | ||
{ | ||
text: 'Commerce', | ||
link: '/api/commerce', | ||
}, | ||
{ | ||
text: 'Company', | ||
link: '/api/company', | ||
}, | ||
{ | ||
text: 'Database', | ||
link: '/api/database', | ||
}, | ||
{ | ||
text: 'Datatype', | ||
link: '/api/datatype', | ||
}, | ||
{ | ||
text: 'Date', | ||
link: '/api/date', | ||
}, | ||
{ | ||
text: 'Fake', | ||
link: '/api/fake', | ||
}, | ||
{ | ||
text: 'Finance', | ||
link: '/api/finance', | ||
}, | ||
{ | ||
text: 'Hacker', | ||
link: '/api/hacker', | ||
}, | ||
{ | ||
text: 'Helpers', | ||
link: '/api/helpers', | ||
}, | ||
{ | ||
text: 'Image', | ||
link: '/api/image', | ||
}, | ||
{ | ||
text: 'Internet', | ||
link: '/api/internet', | ||
}, | ||
{ | ||
text: 'Localization', | ||
link: '/api/localization', | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
// grab from process.env once this is building on netlify | ||
const algolia = { | ||
apiKey: '', | ||
indexName: '', | ||
searchParameters: { | ||
facetFilters: [''], | ||
}, | ||
}; | ||
|
||
export default defineConfig({ | ||
// Empty in order to use the faker.js logo instead of a text title. | ||
// If we had a square logo, we could use it here. | ||
title: 'Faker', | ||
description: | ||
'Generate massive amounts of fake data in the browser and node.js', | ||
head: [ | ||
['link', { rel: 'icon', href: '/logo.svg' }], | ||
['meta', { name: 'theme-color', content: '#40af7c' }], | ||
], | ||
themeConfig: { | ||
repo: 'faker-js/faker', | ||
logo: '/logo.svg', | ||
docsDir: 'docs', | ||
docsBranch: 'main', | ||
editLinks: true, | ||
editLinkText: 'Suggest changes to this page', | ||
nav, | ||
sidebar, | ||
algolia, | ||
}, | ||
}); |
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,43 @@ | ||
<script setup> | ||
defineProps({ | ||
text: String, | ||
type: String, | ||
vertical: String, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<span class="badge" :class="type" :style="{ verticalAlign: vertical }"> | ||
{{ text }} | ||
</span> | ||
</template> | ||
|
||
<style scoped> | ||
.badge.tip { | ||
background-color: #40af7c; | ||
} | ||
.badge.danger { | ||
background-color: #cb0300; | ||
} | ||
.badge.warning { | ||
background-color: #e7c000; | ||
} | ||
.badge.info { | ||
background-color: #476482; | ||
} | ||
.badge { | ||
display: inline-block; | ||
font-size: 14px; | ||
height: 18px; | ||
line-height: 18px; | ||
border-radius: 3px; | ||
padding: 0 6px; | ||
color: var(--c-bg); | ||
vertical-align: top; | ||
transition: color var(--t-color), background-color var(--t-color); | ||
} | ||
</style> |
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 @@ | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const faker = ref(); | ||
const ready = ref(false); | ||
import('../../../../dist/faker').then((_faker) => { | ||
window.faker = _faker.default; | ||
faker.value = _faker.default; | ||
ready.value = true; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<h2>🚧 Playground under construction 🚧</h2> | ||
<h3>window.faker</h3> | ||
<pre v-if="ready">{{ Object.keys(faker) }}</pre> | ||
</template> |
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,7 @@ | ||
import Playground from './Playground.vue'; | ||
import Badge from './Badge.vue'; | ||
|
||
export default { | ||
Playground, | ||
Badge, | ||
}; |
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,11 @@ | ||
import GlobalComponents from './components'; | ||
import DefaultTheme from 'vitepress/theme'; | ||
|
||
export default { | ||
...DefaultTheme, | ||
enhanceApp({ app }) { | ||
for (const [name, component] of Object.entries(GlobalComponents)) { | ||
app.component(name, component); | ||
} | ||
}, | ||
}; |
Oops, something went wrong.