Skip to content

Commit 6f0fbdf

Browse files
committed
chore: wip
1 parent 25ba5cf commit 6f0fbdf

File tree

6 files changed

+62
-109
lines changed

6 files changed

+62
-109
lines changed

.stacks/core/config/src/config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { StacksOptions } from '@stacksjs/types'
22
import defaults from './defaults'
33
import overrides from './overrides'
4-
import { defu } from 'defu'
54

6-
export const config: StacksOptions = defu(overrides, defaults)
5+
export const config = {
6+
...defaults,
7+
...overrides
8+
}
79

810
export const {
911
app,
@@ -25,7 +27,7 @@ export const {
2527
services,
2628
storage,
2729
ui
28-
} = config
30+
}: StacksOptions = config
2931

3032
export { defaults, overrides }
3133

.stacks/core/config/src/defaults.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,6 @@ import type { StacksOptions } from '@stacksjs/types'
22
import { path as p } from '@stacksjs/path'
33
// import { userConfig as overrides } from './overrides'
44

5-
const nav = [
6-
{ text: 'Config', link: '/config', activeMatch: '/config' },
7-
{
8-
text: 'Changelog',
9-
link: 'https://github.com/stacksjs/stacks/blob/main/CHANGELOG.md',
10-
},
11-
{ text: 'Blog', link: 'https://updates.ow3.org' },
12-
]
13-
14-
const sidebar = {
15-
'/guide/': [
16-
{
17-
text: 'Introduction',
18-
collapsible: true,
19-
items: [
20-
{ text: 'What is Stacks?', link: '/guide/what-is-stacks' },
21-
{ text: 'Getting Started', link: '/guide/getting-started' },
22-
{ text: 'Configuration', link: '/guide/config' },
23-
],
24-
},
25-
26-
{
27-
text: 'Digging Deeper',
28-
collapsible: true,
29-
items: [
30-
{ text: 'APIs', link: '/guide/apis' },
31-
{ text: 'Apps', link: '/guide/apps' },
32-
{ text: 'Buddy', link: '/guide/buddy' },
33-
{ text: 'CI / CD', link: '/guide/ci' },
34-
{ text: 'Composability', link: '/guide/composability' },
35-
{ text: 'Cloud', link: '/guide/cloud' },
36-
{ text: 'Libraries', link: '/guide/libraries' },
37-
{ text: 'Testing', link: '/guide/testing' },
38-
],
39-
},
40-
],
41-
}
42-
435
export default {
446
app: {
457
name: 'Stacks',
@@ -163,9 +125,6 @@ export default {
163125
lastUpdated: true,
164126

165127
themeConfig: {
166-
nav,
167-
sidebar,
168-
169128
editLink: {
170129
pattern: 'https://github.com/stacksjs/stacks/edit/main/docs/docs/:path',
171130
text: 'Edit this page on GitHub',

.stacks/core/docs/src/index.ts

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,44 @@ import pkg from '../../../../package.json'
99

1010
const { version } = pkg
1111

12+
export const nav = [
13+
{ text: 'Config', link: '/config', activeMatch: '/config' },
14+
{
15+
text: 'Changelog',
16+
link: 'https://github.com/stacksjs/stacks/blob/main/CHANGELOG.md',
17+
},
18+
{ text: 'Blog', link: 'https://updates.ow3.org' },
19+
]
20+
21+
export const sidebar = {
22+
'/guide/': [
23+
{
24+
text: 'Introduction',
25+
collapsible: true,
26+
items: [
27+
{ text: 'What is Stacks?', link: '/guide/what-is-stacks' },
28+
{ text: 'Getting Started', link: '/guide/getting-started' },
29+
{ text: 'Configuration', link: '/guide/config' },
30+
],
31+
},
32+
33+
{
34+
text: 'Digging Deeper',
35+
collapsible: true,
36+
items: [
37+
{ text: 'APIs', link: '/guide/apis' },
38+
{ text: 'Apps', link: '/guide/apps' },
39+
{ text: 'Buddy', link: '/guide/buddy' },
40+
{ text: 'CI / CD', link: '/guide/ci' },
41+
{ text: 'Composability', link: '/guide/composability' },
42+
{ text: 'Cloud', link: '/guide/cloud' },
43+
{ text: 'Libraries', link: '/guide/libraries' },
44+
{ text: 'Testing', link: '/guide/testing' },
45+
],
46+
},
47+
],
48+
}
49+
1250
export function docsUrl() {
1351
const appUrl = app.url || 'stacks.test'
1452
const docsSubdomain = app.subdomains?.docs || 'docs'
@@ -22,7 +60,7 @@ export function docsUrl() {
2260
return `https://${host}`
2361
}
2462

25-
const defaultConfig = {
63+
export const frameworkDefaults = {
2664
title: `${app.name} Documentation`,
2765
srcDir: p.projectPath('docs'),
2866
outDir: p.projectStoragePath('framework/docs'),
@@ -31,6 +69,11 @@ const defaultConfig = {
3169
hostname: docsUrl(),
3270
},
3371

72+
themeConfig: {
73+
nav,
74+
sidebar,
75+
},
76+
3477
vite: {
3578
envDir: p.projectPath(),
3679
envPrefix: 'FRONTEND_',
@@ -61,9 +104,9 @@ const defaultConfig = {
61104
},
62105
} satisfies UserConfig
63106

64-
const config = {
65-
...defaultConfig,
107+
const config: UserConfig = {
108+
...frameworkDefaults,
66109
...docs,
67-
} satisfies UserConfig
110+
}
68111

69112
export default defineConfig(config)

.stacks/core/types/src/docs.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { type UserConfig } from 'vitepress'
22

33
export type DocsConfig = UserConfig
4-
54
export type DocsOptions = DocsConfig

.stacks/docs/.vitepress/config.ts

Lines changed: 8 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,12 @@
1-
import { path as p } from '@stacksjs/path'
2-
import { app } from '@stacksjs/config'
3-
import { server } from '@stacksjs/server'
4-
import { alias } from '@stacksjs/alias'
5-
import { kolorist as c } from '@stacksjs/cli'
6-
import { ViteDevServer } from '@stacksjs/vite'
1+
import { config } from '@stacksjs/config'
2+
import { frameworkDefaults } from '@stacksjs/docs'
73
import type { UserConfig } from 'vitepress'
8-
import pkg from '../../package.json'
94

10-
function docsUrl() {
11-
const appUrl = app.url || "stacks.test"
12-
const docsSubdomain = app.subdomains?.docs || "docs"
13-
const protocolPattern = /^https?:\/\//i
14-
const urlForParsing = protocolPattern.test(appUrl) ? appUrl : `http://${docsSubdomain}.${appUrl}:3333`
15-
const urlObj = new URL(urlForParsing)
16-
const domainParts = urlObj.hostname.split(".")
17-
domainParts[domainParts.length - 1] = "localhost"
18-
const host = domainParts.join(".")
19-
return `https://${host}`
20-
}
21-
22-
const { version } = pkg
23-
24-
const docs = {
25-
title: `${app.name} Documentation`,
26-
srcDir: p.projectPath('docs'),
27-
outDir: p.projectStoragePath('framework/docs'),
28-
cacheDir: p.projectStoragePath('framework/cache/docs'),
29-
30-
sitemap: {
31-
hostname: docsUrl(),
32-
},
5+
const userConfig = config.docs
336

34-
vite: {
35-
envDir: p.projectPath(),
36-
envPrefix: 'FRONTEND_',
37-
38-
server: server({
39-
type: 'docs',
40-
}),
41-
42-
resolve: {
43-
alias,
44-
},
45-
46-
plugins: [
47-
{
48-
name: 'stacks-plugin',
49-
configureServer(server: ViteDevServer) {
50-
// const base = server.config.base || '/'
51-
// const _print = server.printUrls
52-
server.printUrls = () => { // eslint-disable-next-line no-console
53-
console.log(` ${c.blue(c.bold('STACKS'))} ${c.blue(version)}`)
54-
// eslint-disable-next-line no-console
55-
console.log(` ${c.green('➜')} ${c.bold('Docs')}: ${c.green(docsUrl())}`)
56-
}
57-
},
58-
},
59-
],
60-
},
61-
} satisfies UserConfig
7+
const resolvedUserConfig: UserConfig = {
8+
...frameworkDefaults,
9+
...userConfig,
10+
}
6211

63-
export default docs
12+
export default resolvedUserConfig

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ hero:
1010
tagline: Rapid application, cloud & library development framework. For the best full-stack teams.
1111
actions:
1212
- theme: brand
13-
text: Get Started
13+
text: Coming Soon
14+
# text: Get Started
1415
link: /guide/getting-started
1516
- theme: alt
1617
text: View on GitHub

0 commit comments

Comments
 (0)