Skip to content

Commit d6555dd

Browse files
docs(website): add top level domain explanation
1 parent bfe8f26 commit d6555dd

File tree

7 files changed

+122
-10
lines changed

7 files changed

+122
-10
lines changed

packages/node_modules/overmind-devtools-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Overmind Devtools VSCode",
44
"description": "Devtools for Overmind",
55
"publisher": "christianalfoni",
6-
"version": "0.0.20",
6+
"version": "0.0.21",
77
"repository": {
88
"type": "git",
99
"url": "https://github.com/cerebral/overmind.git"

packages/overmind-website/api/config.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ h(Example, { name: "api/config_merge" })
1515

1616
Note that merge can be useful to combine a root configuration with namespaced configuration.
1717

18+
```marksy
19+
h(Example, { name: "api/config_merge_namespaced" })
20+
```
21+
1822
## namespaced
1923
Allows you to namespace configurations by a key.
2024

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
export default (ts) =>
2+
ts
3+
? [
4+
{
5+
fileName: 'overmind.ts',
6+
code: `
7+
import { createOvermind, IConfig } from 'overmind'
8+
import { merge, namespaced } from 'overmind/config'
9+
import { state } from './state'
10+
import * as moduleA from './moduleA'
11+
import * as moduleB from './moduleB'
12+
13+
const config = merge(
14+
{
15+
state
16+
},
17+
namespaced({
18+
moduleA,
19+
moduleB
20+
})
21+
)
22+
23+
declare module 'overmind' {
24+
interface Config extends IConfig<typeof config> {}
25+
}
26+
27+
export default createOvermind(config)
28+
`,
29+
},
30+
]
31+
: [
32+
{
33+
fileName: 'overmind/index.js',
34+
code: `
35+
import { createOvermind } from 'overmind'
36+
import { merge, namespaced } from 'overmind/config'
37+
import { state } from './state'
38+
import * as moduleA from './moduleA'
39+
import * as moduleB from './moduleB'
40+
41+
const config = merge(
42+
{
43+
state
44+
},
45+
namespaced({
46+
moduleA,
47+
moduleB
48+
})
49+
)
50+
51+
export default createOvermind(config)
52+
`,
53+
},
54+
]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
export default (ts, view) =>
2+
ts
3+
? [
4+
{
5+
fileName: 'overmind/index.ts',
6+
code: `
7+
import { IConfig } from 'overmind'
8+
import { merge, namespaced } from 'overmind/config'
9+
import { state } from './state'
10+
import * as posts from './posts'
11+
import * as admin from './admin'
12+
13+
export const config = merge(
14+
{
15+
state
16+
},
17+
namespaced({
18+
posts,
19+
admin
20+
})
21+
)
22+
23+
declare module 'overmind' {
24+
interface Config extends IConfig<typeof config> {}
25+
}
26+
`,
27+
},
28+
]
29+
: [
30+
{
31+
fileName: 'overmind/index.js',
32+
code: `
33+
import { merge, namespaced } from 'overmind/config'
34+
import { state } from './state'
35+
import * as posts from './posts'
36+
import * as admin from './admin'
37+
38+
export const config = merge(
39+
{
40+
state
41+
},
42+
namespaced({
43+
posts,
44+
admin
45+
})
46+
)
47+
`,
48+
},
49+
]

packages/overmind-website/examples/guide/structuringtheapp/namespaced.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,19 @@ export {
3232
{
3333
fileName: 'overmind/index.ts',
3434
code: `
35-
import { createOvermind, IConfig } from 'overmind'
35+
import { IConfig } from 'overmind'
3636
import { namespaced } from 'overmind/config'
3737
import * as posts from './posts'
3838
import * as admin from './admin'
3939
40-
const config = namespaced({
40+
export const config = namespaced({
4141
posts,
4242
admin
4343
})
4444
4545
declare module 'overmind' {
4646
interface Config extends IConfig<typeof config> {}
4747
}
48-
49-
const overmind = createOvermind(config)
5048
`,
5149
},
5250
]
@@ -82,17 +80,14 @@ export {
8280
{
8381
fileName: 'overmind/index.js',
8482
code: `
85-
import { createOvermind } from 'overmind'
8683
import { namespaced } from 'overmind/config'
8784
import * as posts from './posts'
8885
import * as admin from './admin'
8986
90-
const config = namespaced({
87+
export const config = namespaced({
9188
posts,
9289
admin
9390
})
94-
95-
const overmind = createOvermind(config)
9691
`,
9792
},
9893
]

packages/overmind-website/guides/beginner/06_structuringtheapp.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ h(Example, { name: "guide/structuringtheapp/namespaced" })
6868

6969
We used the **namespaced** function to put the state, actions and effects from each domain behind a key. In this case the key is the same as the name of the domain itself. This is an effective way to split up your app.
7070

71+
You can also combine this with the **merge** tool to have a top level domain.
72+
73+
```marksy
74+
h(Example, { name: "guide/structuringtheapp/merge_namespaced" })
75+
```
76+
7177
```marksy
7278
h(Notice, null, "Even though you split up into different domains each domain has access to the state of the whole application. This is an important feature of Overmind which allows you to scale up and explore the domains of the application without having to worry about isolation.")
7379
```

packages/overmind-website/src/components/Footer/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ const Footer: SFC = () => {
1919
</a>
2020
<div> Copyright © 2019 Christian Alfoni</div>
2121
</div>
22-
<a href="https://discord.gg/YKw9Kd" target="_new" className={styles.chat}>
22+
<a
23+
href="https://discord.gg/sHWcKF6"
24+
target="_new"
25+
className={styles.chat}
26+
>
2327
<Icon>chat</Icon>
2428
</a>
2529
</div>

0 commit comments

Comments
 (0)