docus 1.0.6 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -22
- package/app/router.options.ts +18 -0
- package/assets/css/fonts.css +84 -0
- package/assets/css/main.css +11 -0
- package/assets/css/tailwind.css +282 -0
- package/components/app/Container.vue +23 -0
- package/components/app/Footer.vue +38 -0
- package/components/app/Navbar.vue +26 -0
- package/components/app/NavbarLogo.vue +31 -0
- package/components/app/Page.vue +7 -0
- package/components/app/PoweredByDocus.vue +11 -0
- package/components/content/Alert.vue +124 -0
- package/components/content/BlockHero.vue +54 -0
- package/components/content/ButtonLink.vue +44 -0
- package/components/content/Card.vue +46 -0
- package/components/content/CardGrid.vue +23 -0
- package/components/content/CodeBlock.vue +47 -0
- package/components/content/CodeGroup.vue +134 -0
- package/components/content/CopyButton.vue +48 -0
- package/components/content/List.vue +5 -0
- package/components/content/NeedContribution.vue +23 -0
- package/components/content/ReadMore.vue +24 -0
- package/components/content/Sandbox.vue +100 -0
- package/components/content/TabsHeader.vue +44 -0
- package/components/content/Terminal.vue +70 -0
- package/components/content/VideoPlayer.vue +113 -0
- package/components/docs/DocsAside.vue +19 -0
- package/components/docs/DocsAsideTree.vue +101 -0
- package/components/docs/DocsHero.vue +39 -0
- package/components/docs/DocsPage.vue +22 -0
- package/components/docs/DocsPageContent.vue +29 -0
- package/components/docs/DocsToc.vue +72 -0
- package/components/globals/Icon.vue +24 -0
- package/components/globals/Logo.vue +3 -0
- package/components/globals/NuxtImg.vue +43 -0
- package/components/globals/SocialIcons.vue +43 -0
- package/components/globals/ThemeSelect.vue +35 -0
- package/components/icons/IconAlgolia.vue +8 -0
- package/components/icons/IconArrowLeft.vue +10 -0
- package/components/icons/IconArrowRight.vue +10 -0
- package/components/icons/IconBadgeCheck.vue +14 -0
- package/components/icons/IconCheck.vue +10 -0
- package/components/icons/IconCheckCircle.vue +10 -0
- package/components/icons/IconChevronRight.vue +12 -0
- package/components/icons/IconClipboardCheck.vue +14 -0
- package/components/icons/IconClipboardCopy.vue +14 -0
- package/components/icons/IconCodeSandbox.vue +8 -0
- package/components/icons/IconCopy.vue +17 -0
- package/components/icons/IconDots.vue +10 -0
- package/components/icons/IconEdit.vue +18 -0
- package/components/icons/IconExclamationCircle.vue +12 -0
- package/components/icons/IconExclamationTriangle.vue +10 -0
- package/components/icons/IconExternalLink.vue +12 -0
- package/components/icons/IconGit.vue +7 -0
- package/components/icons/IconGitHub.vue +10 -0
- package/components/icons/IconHeart.vue +9 -0
- package/components/icons/IconInformationCircle.vue +10 -0
- package/components/icons/IconLighthouse.vue +83 -0
- package/components/icons/IconLine.vue +10 -0
- package/components/icons/IconMarkdown.vue +13 -0
- package/components/icons/IconMenu.vue +12 -0
- package/components/icons/IconMenuAlt.vue +10 -0
- package/components/icons/IconMinus.vue +10 -0
- package/components/icons/IconMoon.vue +10 -0
- package/components/icons/IconNuxt.vue +14 -0
- package/components/icons/IconNuxtContent.vue +20 -0
- package/components/icons/IconNuxtLabs.vue +21 -0
- package/components/icons/IconPlus.vue +10 -0
- package/components/icons/IconPuzzle.vue +8 -0
- package/components/icons/IconSSG.vue +7 -0
- package/components/icons/IconSearch.vue +12 -0
- package/components/icons/IconSun.vue +10 -0
- package/components/icons/IconTocBack.vue +21 -0
- package/components/icons/IconTocCurrent.vue +21 -0
- package/components/icons/IconTocNext.vue +8 -0
- package/components/icons/IconTranslate.vue +14 -0
- package/components/icons/IconTwitter.vue +8 -0
- package/components/icons/IconVite.vue +30 -0
- package/components/icons/IconVue.vue +6 -0
- package/components/icons/IconVueTelescope.vue +11 -0
- package/components/icons/IconWindi.vue +17 -0
- package/components/icons/IconX.vue +12 -0
- package/components/icons/IconXCircle.vue +10 -0
- package/components/icons/IconZap.vue +8 -0
- package/components/prose/ProseA.vue +66 -0
- package/components/prose/ProseBlockquote.vue +21 -0
- package/components/prose/ProseCode.vue +68 -0
- package/components/prose/ProseCodeInline.vue +38 -0
- package/components/prose/ProseEm.vue +11 -0
- package/components/prose/ProseH1.vue +22 -0
- package/components/prose/ProseH2.vue +22 -0
- package/components/prose/ProseH3.vue +24 -0
- package/components/prose/ProseH4.vue +24 -0
- package/components/prose/ProseHr.vue +13 -0
- package/components/prose/ProseImg.vue +32 -0
- package/components/prose/ProseLi.vue +31 -0
- package/components/prose/ProseOl.vue +16 -0
- package/components/prose/ProseP.vue +14 -0
- package/components/prose/ProseStrong.vue +14 -0
- package/components/prose/ProseTable.vue +13 -0
- package/components/prose/ProseTbody.vue +5 -0
- package/components/prose/ProseTd.vue +11 -0
- package/components/prose/ProseTh.vue +11 -0
- package/components/prose/ProseThead.vue +11 -0
- package/components/prose/ProseTr.vue +11 -0
- package/components/prose/ProseUl.vue +15 -0
- package/composables/useContent.ts +155 -0
- package/composables/useMenu.ts +20 -0
- package/composables/useScrollToHeading.ts +35 -0
- package/composables/useScrollspy.ts +45 -0
- package/composables/useTheme.ts +10 -0
- package/layouts/default.vue +27 -0
- package/layouts/page.vue +11 -0
- package/nuxt.config.ts +151 -0
- package/package.json +45 -63
- package/pages/[...slug].vue +24 -0
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/site.webmanifest +1 -0
- package/dist/create-docus/create-docus.js +0 -7
- package/dist/create-docus/index.js +0 -122
- package/dist/helpers.js +0 -154
- package/dist/index.js +0 -10
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const useMenu = () => {
|
|
2
|
+
// Menu visible reference
|
|
3
|
+
const visible = useState('menu-visible', () => false)
|
|
4
|
+
|
|
5
|
+
// Open the menu
|
|
6
|
+
const open = () => (visible.value = true)
|
|
7
|
+
|
|
8
|
+
// Close the menu
|
|
9
|
+
const close = () => (visible.value = false)
|
|
10
|
+
|
|
11
|
+
// Toggle the menu (useful for one-off buttons)
|
|
12
|
+
const toggle = () => (visible.value = !visible.value)
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
open,
|
|
16
|
+
close,
|
|
17
|
+
toggle,
|
|
18
|
+
visible,
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const useConvertPropToPixels = (prop: string): number => {
|
|
2
|
+
const tempDiv = document.createElement('div')
|
|
3
|
+
|
|
4
|
+
tempDiv.style.position = 'absolute'
|
|
5
|
+
tempDiv.style.opacity = '0'
|
|
6
|
+
tempDiv.style.height = getComputedStyle(document.documentElement).getPropertyValue(prop)
|
|
7
|
+
|
|
8
|
+
document.body.appendChild(tempDiv)
|
|
9
|
+
|
|
10
|
+
const pixels = parseInt(getComputedStyle(tempDiv).height)
|
|
11
|
+
|
|
12
|
+
document.body.removeChild(tempDiv)
|
|
13
|
+
|
|
14
|
+
return pixels
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const useScrollToHeading = (id: string, scrollMarginCssVar: string) => {
|
|
18
|
+
// Use replaceState to prevent page jump when adding hash
|
|
19
|
+
history.replaceState({}, '', `#${id}`)
|
|
20
|
+
|
|
21
|
+
// Do not remove setTimeout (does not work in Safari)
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
const escapedId = id.replace(/\./g, '\\.')
|
|
24
|
+
|
|
25
|
+
const heading = document.querySelector(`#${escapedId}`) as any
|
|
26
|
+
|
|
27
|
+
const offset = heading.offsetTop - useConvertPropToPixels(scrollMarginCssVar)
|
|
28
|
+
|
|
29
|
+
window.scrollTo({
|
|
30
|
+
top: offset,
|
|
31
|
+
left: 0,
|
|
32
|
+
behavior: 'smooth',
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Scrollspy allows you to watch visible headings in a specific page.
|
|
5
|
+
* Useful for table of contents live style updates.
|
|
6
|
+
*/
|
|
7
|
+
export const useScrollspy = () => {
|
|
8
|
+
const observer = ref() as Ref<IntersectionObserver>
|
|
9
|
+
const visibleHeadings = ref([]) as Ref<string[]>
|
|
10
|
+
const activeHeadings = ref([]) as Ref<string[]>
|
|
11
|
+
|
|
12
|
+
const observerCallback = (entries: IntersectionObserverEntry[]) =>
|
|
13
|
+
entries.forEach((entry) => {
|
|
14
|
+
const id = entry.target.id
|
|
15
|
+
|
|
16
|
+
if (entry.isIntersecting)
|
|
17
|
+
visibleHeadings.value.push(id)
|
|
18
|
+
else
|
|
19
|
+
visibleHeadings.value = visibleHeadings.value.filter(t => t !== id)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const updateHeadings = (headings: Element[]) =>
|
|
23
|
+
headings.forEach((heading) => {
|
|
24
|
+
observer.value.observe(heading)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
watch(visibleHeadings, (val, oldVal) => {
|
|
28
|
+
if (val.length === 0)
|
|
29
|
+
activeHeadings.value = oldVal
|
|
30
|
+
else
|
|
31
|
+
activeHeadings.value = val
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
// Create intersection observer
|
|
35
|
+
onBeforeMount(() => (observer.value = new IntersectionObserver(observerCallback)))
|
|
36
|
+
|
|
37
|
+
// Destroy it
|
|
38
|
+
onBeforeUnmount(() => observer.value?.disconnect())
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
visibleHeadings,
|
|
42
|
+
activeHeadings,
|
|
43
|
+
updateHeadings,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const { page, fetchNavigation } = useContent()
|
|
3
|
+
|
|
4
|
+
await fetchNavigation()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="w-full flex min-h-screen flex-col">
|
|
9
|
+
<Navbar />
|
|
10
|
+
|
|
11
|
+
<div class="min-h-[calc(100vh-12rem)] sm:min-h-[calc(100vh-8rem)] flex flex-col">
|
|
12
|
+
<DocsPage>
|
|
13
|
+
<template #aside>
|
|
14
|
+
<DocsAside v-if="page?.value?.aside || typeof page?.value?.aside === 'undefined'" />
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<DocsPageContent>
|
|
18
|
+
<div class="max-w-none">
|
|
19
|
+
<NuxtPage />
|
|
20
|
+
</div>
|
|
21
|
+
</DocsPageContent>
|
|
22
|
+
</DocsPage>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<Footer />
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
package/layouts/page.vue
ADDED
package/nuxt.config.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url'
|
|
2
|
+
import { defineNuxtConfig } from 'nuxt'
|
|
3
|
+
import colors from 'tailwindcss/colors.js'
|
|
4
|
+
import { resolve } from 'pathe'
|
|
5
|
+
|
|
6
|
+
const themeDir = fileURLToPath(new URL('./', import.meta.url))
|
|
7
|
+
const resolveThemeDir = (path: string) => resolve(themeDir, path)
|
|
8
|
+
|
|
9
|
+
export default defineNuxtConfig({
|
|
10
|
+
runtimeConfig: {
|
|
11
|
+
public: {
|
|
12
|
+
plausible: {
|
|
13
|
+
domain: process.env.PLAUSIBLE_DOMAIN,
|
|
14
|
+
},
|
|
15
|
+
theme: {
|
|
16
|
+
title: 'Docus',
|
|
17
|
+
twitter: '@docus_',
|
|
18
|
+
github: 'nuxtlabs/docus',
|
|
19
|
+
header: {
|
|
20
|
+
title: false,
|
|
21
|
+
logo: true,
|
|
22
|
+
},
|
|
23
|
+
footer: {
|
|
24
|
+
credits: {
|
|
25
|
+
icon: 'IconNuxtLabs',
|
|
26
|
+
text: 'Made by Nuxt Labs',
|
|
27
|
+
},
|
|
28
|
+
icons: [
|
|
29
|
+
{
|
|
30
|
+
label: 'NuxtJS',
|
|
31
|
+
href: 'https://nuxtjs.org',
|
|
32
|
+
component: 'IconNuxt',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: 'Vue Telescope',
|
|
36
|
+
href: 'https://vuetelescope.com',
|
|
37
|
+
component: 'IconVueTelescope',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
head: {
|
|
45
|
+
title: 'Docus',
|
|
46
|
+
link: [
|
|
47
|
+
{
|
|
48
|
+
rel: 'stylesheet',
|
|
49
|
+
href: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap',
|
|
50
|
+
},
|
|
51
|
+
{ rel: 'preconnect', href: 'https://fonts.gstatic.com' },
|
|
52
|
+
],
|
|
53
|
+
meta: [
|
|
54
|
+
{ hid: 'og:site_name', property: 'og:site_name', content: 'Nuxt 3' },
|
|
55
|
+
{ hid: 'og:type', property: 'og:type', content: 'website' },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
loading: {
|
|
59
|
+
color: '#00DC82',
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Components
|
|
63
|
+
*/
|
|
64
|
+
components: [
|
|
65
|
+
{
|
|
66
|
+
prefix: '',
|
|
67
|
+
path: './components/app',
|
|
68
|
+
global: true,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
prefix: '',
|
|
72
|
+
path: './components/docs',
|
|
73
|
+
global: true,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
prefix: '',
|
|
77
|
+
path: './components/prose',
|
|
78
|
+
global: true,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
prefix: '',
|
|
82
|
+
path: './components/globals',
|
|
83
|
+
global: true,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
prefix: '',
|
|
87
|
+
path: './components/content',
|
|
88
|
+
global: true,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
prefix: '',
|
|
92
|
+
path: './components/icons',
|
|
93
|
+
global: true,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
css: [
|
|
97
|
+
resolveThemeDir('assets/css/main.css'),
|
|
98
|
+
resolveThemeDir('assets/css/fonts.css'),
|
|
99
|
+
resolveThemeDir('assets/css/tailwind.css'),
|
|
100
|
+
],
|
|
101
|
+
tailwindcss: {
|
|
102
|
+
viewer: false,
|
|
103
|
+
|
|
104
|
+
config: {
|
|
105
|
+
darkMode: 'class',
|
|
106
|
+
theme: {
|
|
107
|
+
extend: {
|
|
108
|
+
colors: {
|
|
109
|
+
gray: colors.gray,
|
|
110
|
+
primary: colors.indigo,
|
|
111
|
+
},
|
|
112
|
+
fontFamily: {
|
|
113
|
+
sans: 'Inter, sans-serif',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
plugins: [
|
|
118
|
+
require('@tailwindcss/typography'),
|
|
119
|
+
require('@tailwindcss/forms'),
|
|
120
|
+
require('@tailwindcss/line-clamp'),
|
|
121
|
+
require('@tailwindcss/aspect-ratio'),
|
|
122
|
+
],
|
|
123
|
+
content: [
|
|
124
|
+
resolveThemeDir('components/**/*.{mjs,vue,js,ts}'),
|
|
125
|
+
resolveThemeDir('layouts/**/*.{mjs,vue,js,ts}'),
|
|
126
|
+
resolveThemeDir('pages/**/*.{mjs,vue,js,ts}'),
|
|
127
|
+
],
|
|
128
|
+
safelist: [24, 36, 48, 60, 72, 84, 96, 108, 120].map(number => `pl-[${number}px]`),
|
|
129
|
+
cssPath: resolveThemeDir('assets/css/tailwind.css'),
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
content: {
|
|
133
|
+
highlight: {
|
|
134
|
+
theme: 'one-dark-pro',
|
|
135
|
+
preload: ['json', 'js', 'ts', 'html', 'css', 'vue', 'diff', 'shell', 'markdown', 'yaml', 'bash'],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
colorMode: {
|
|
139
|
+
classSuffix: '',
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* Modules
|
|
143
|
+
*/
|
|
144
|
+
modules: [
|
|
145
|
+
'@nuxt/content',
|
|
146
|
+
'@nuxtjs/tailwindcss',
|
|
147
|
+
'@nuxtjs/color-mode',
|
|
148
|
+
'@nuxthq/admin',
|
|
149
|
+
'vue-plausible',
|
|
150
|
+
],
|
|
151
|
+
})
|
package/package.json
CHANGED
|
@@ -1,72 +1,54 @@
|
|
|
1
1
|
{
|
|
2
|
+
"version": "3.0.0-beta.1",
|
|
2
3
|
"name": "docus",
|
|
3
|
-
"version": "1.0.6",
|
|
4
|
-
"description": "The Docus CLI.",
|
|
5
|
-
"repository": "https://github.com/docusgen/cli",
|
|
6
|
-
"bugs": {
|
|
7
|
-
"url": "https://github.com/docusgen/cli/issues"
|
|
8
|
-
},
|
|
9
|
-
"homepage": "https://github.com/docusgen/cli#readme",
|
|
10
|
-
"author": "Yaël GUILLOUX <yael.guilloux@gmail.com>",
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"typescript",
|
|
14
|
-
"starter"
|
|
15
|
-
],
|
|
16
|
-
"main": "dist/index.js",
|
|
17
|
-
"module": "dist/index.mjs",
|
|
18
|
-
"types": "dist/src/index.d.ts",
|
|
19
4
|
"scripts": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"lint
|
|
24
|
-
"test:types": "tsc --build tsconfig.json",
|
|
25
|
-
"test:unit": "jest",
|
|
26
|
-
"test": "yarn run test:types && yarn run test:unit"
|
|
27
|
-
},
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=14.0.0"
|
|
5
|
+
"build": "nuxi build",
|
|
6
|
+
"dev": "nuxi dev",
|
|
7
|
+
"preview": "nuxi preview",
|
|
8
|
+
"lint": "eslint --ext .ts,.js,.vue,.css ."
|
|
30
9
|
},
|
|
31
|
-
"
|
|
32
|
-
"
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@antfu/eslint-config": "^0.20.6",
|
|
12
|
+
"@nuxtjs/eslint-config-typescript": "^9.0.0",
|
|
13
|
+
"eslint": "^8.13.0",
|
|
14
|
+
"nuxt": "^3.0.0-rc.1",
|
|
15
|
+
"parse-entities": "^4.0.0",
|
|
16
|
+
"typescript": "^4.6.3"
|
|
33
17
|
},
|
|
34
|
-
"files": [
|
|
35
|
-
"dist/**/*",
|
|
36
|
-
"LICENSE",
|
|
37
|
-
"README.md"
|
|
38
|
-
],
|
|
39
18
|
"dependencies": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
19
|
+
"@iconify/vue": "^3.2.1",
|
|
20
|
+
"@nuxt/content": "npm:@nuxt/content-edge@latest",
|
|
21
|
+
"@nuxthq/admin": "npm:@nuxthq/admin-edge@latest",
|
|
22
|
+
"@nuxtjs/color-mode": "^3.0.2",
|
|
23
|
+
"@nuxtjs/tailwindcss": "^5.0.3",
|
|
24
|
+
"@tailwindcss/aspect-ratio": "^0.4.0",
|
|
25
|
+
"@tailwindcss/forms": "^0.5.0",
|
|
26
|
+
"@tailwindcss/line-clamp": "^0.3.1",
|
|
27
|
+
"@tailwindcss/typography": "^0.5.2",
|
|
28
|
+
"@vueuse/core": "^8.3.0",
|
|
29
|
+
"@vueuse/motion": "2.0.0-beta.12",
|
|
30
|
+
"clipboard": "^2.0.10",
|
|
31
|
+
"defu": "^6.0.0",
|
|
32
|
+
"lodash-es": "^4.17.21",
|
|
33
|
+
"tailwindcss": "^3.0.24",
|
|
34
|
+
"vue-plausible": "^1.3.1"
|
|
45
35
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"jest": "^27.0.6",
|
|
53
|
-
"jiti": "^1.11.0",
|
|
54
|
-
"lint-staged": "^11.1.2",
|
|
55
|
-
"pascalcase": "^1.0.0",
|
|
56
|
-
"prettier": "^2.3.2",
|
|
57
|
-
"ts-jest": "^27.0.5",
|
|
58
|
-
"typescript": "^4.3.5",
|
|
59
|
-
"unbuild": "^0.4.2"
|
|
60
|
-
},
|
|
61
|
-
"gitHooks": {
|
|
62
|
-
"pre-commit": "lint-staged"
|
|
36
|
+
"main": "./nuxt.config.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"require": "./nuxt.config.ts",
|
|
40
|
+
"import": "./nuxt.config.ts"
|
|
41
|
+
}
|
|
63
42
|
},
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
43
|
+
"files": [
|
|
44
|
+
"README.md",
|
|
45
|
+
"app",
|
|
46
|
+
"assets",
|
|
47
|
+
"components",
|
|
48
|
+
"composables",
|
|
49
|
+
"layouts",
|
|
50
|
+
"pages",
|
|
51
|
+
"public",
|
|
52
|
+
"nuxt.config.ts"
|
|
53
|
+
]
|
|
72
54
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const router = useRouter()
|
|
3
|
+
|
|
4
|
+
const { page, fetchPage } = useContent()
|
|
5
|
+
|
|
6
|
+
await fetchPage()
|
|
7
|
+
|
|
8
|
+
if (page.value && page.value.layout)
|
|
9
|
+
router.currentRoute.value.meta.layout = page.value.layout
|
|
10
|
+
else
|
|
11
|
+
router.currentRoute.value.meta.layout = 'default'
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<Content v-if="page" class="content" :document="page" />
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<style scoped>
|
|
19
|
+
.content {
|
|
20
|
+
& > :first-child {
|
|
21
|
+
margin-top: 0 !important;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createDocus = createDocus;
|
|
7
|
-
|
|
8
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
-
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
|
-
var _minimist = _interopRequireDefault(require("minimist"));
|
|
13
|
-
|
|
14
|
-
var _prompts = _interopRequireDefault(require("prompts"));
|
|
15
|
-
|
|
16
|
-
var _execa = _interopRequireDefault(require("execa"));
|
|
17
|
-
|
|
18
|
-
var _helpers = require("../helpers");
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
|
-
const argv = (0, _minimist.default)(process.argv.slice(2));
|
|
23
|
-
const {
|
|
24
|
-
motd,
|
|
25
|
-
primary,
|
|
26
|
-
secondary,
|
|
27
|
-
bold,
|
|
28
|
-
space,
|
|
29
|
-
broadcast
|
|
30
|
-
} = (0, _helpers.log)();
|
|
31
|
-
const cwd = process.cwd();
|
|
32
|
-
|
|
33
|
-
async function createDocus() {
|
|
34
|
-
motd();
|
|
35
|
-
let targetDir = argv._[0];
|
|
36
|
-
|
|
37
|
-
if (!targetDir) {
|
|
38
|
-
const {
|
|
39
|
-
projectName
|
|
40
|
-
} = await (0, _prompts.default)({
|
|
41
|
-
type: "text",
|
|
42
|
-
name: "projectName",
|
|
43
|
-
message: "Project name:",
|
|
44
|
-
initial: "my-website"
|
|
45
|
-
});
|
|
46
|
-
targetDir = projectName.trim();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const packageName = await (0, _helpers.getValidPackageName)(targetDir);
|
|
50
|
-
|
|
51
|
-
const root = _path.default.join(cwd, targetDir);
|
|
52
|
-
|
|
53
|
-
await (0, _helpers.overwriteDir)(root);
|
|
54
|
-
space();
|
|
55
|
-
broadcast(secondary("Scaffolding project in ") + targetDir + secondary("..."));
|
|
56
|
-
const {
|
|
57
|
-
templateDir
|
|
58
|
-
} = await (0, _helpers.getTemplate)();
|
|
59
|
-
|
|
60
|
-
const write = (file, content = void 0) => {
|
|
61
|
-
const targetPath = _path.default.join(root, file);
|
|
62
|
-
|
|
63
|
-
if (content) _fs.default.writeFileSync(targetPath, content);else (0, _helpers.copy)(_path.default.join(templateDir, file), targetPath);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const files = _fs.default.readdirSync(templateDir);
|
|
67
|
-
|
|
68
|
-
for (const file of files.filter(f => f !== "package.json")) write(file);
|
|
69
|
-
|
|
70
|
-
const pkg = require(_path.default.join(templateDir, "package.json"));
|
|
71
|
-
|
|
72
|
-
pkg.name = packageName;
|
|
73
|
-
write("package.json", JSON.stringify(pkg, null, 2));
|
|
74
|
-
const pkgManager = /pnpm/.test(process.env.npm_execpath || "") || /pnpm/.test(process.env.npm_config_user_agent || "") ? "pnpm" : /yarn/.test(process.env.npm_execpath || "") ? "yarn" : "npm";
|
|
75
|
-
|
|
76
|
-
const related = _path.default.relative(cwd, root);
|
|
77
|
-
|
|
78
|
-
broadcast(primary("Done."));
|
|
79
|
-
space();
|
|
80
|
-
const {
|
|
81
|
-
yes
|
|
82
|
-
} = await (0, _prompts.default)({
|
|
83
|
-
type: "confirm",
|
|
84
|
-
name: "yes",
|
|
85
|
-
initial: "Y",
|
|
86
|
-
message: "Install and start it now?"
|
|
87
|
-
});
|
|
88
|
-
if (yes) await startProject(root);else startItLater(pkgManager, root, related);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async function startProject(projectPath) {
|
|
92
|
-
space();
|
|
93
|
-
const {
|
|
94
|
-
agent
|
|
95
|
-
} = await (0, _prompts.default)({
|
|
96
|
-
name: "agent",
|
|
97
|
-
type: "select",
|
|
98
|
-
message: "Choose the agent",
|
|
99
|
-
choices: ["yarn", "npm", "pnpm"].map(i => ({
|
|
100
|
-
value: i,
|
|
101
|
-
title: i
|
|
102
|
-
}))
|
|
103
|
-
});
|
|
104
|
-
if (!agent) return;
|
|
105
|
-
await (0, _execa.default)(agent, ["install"], {
|
|
106
|
-
stdio: "inherit",
|
|
107
|
-
cwd: projectPath
|
|
108
|
-
});
|
|
109
|
-
await (0, _execa.default)(agent, ["run", "dev"], {
|
|
110
|
-
stdio: "inherit",
|
|
111
|
-
cwd: projectPath
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function startItLater(pkgManager, root, dir) {
|
|
116
|
-
space();
|
|
117
|
-
broadcast(secondary("Start it later with:"));
|
|
118
|
-
space();
|
|
119
|
-
if (root !== cwd) broadcast(primary(`cd ${bold(dir)}`));
|
|
120
|
-
broadcast(primary(`${pkgManager === "yarn" ? "yarn" : `${pkgManager} install`}`));
|
|
121
|
-
broadcast(primary(`${pkgManager === "yarn" ? "yarn dev" : `${pkgManager} run dev`}`));
|
|
122
|
-
}
|