Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit 8815bdb

Browse files
committed
chore(docs): update metadata and docs/intro,stack
1 parent 0686e17 commit 8815bdb

File tree

6 files changed

+99
-38
lines changed

6 files changed

+99
-38
lines changed

docs/docs/intro.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ console.log('My Peer ID is:', stack.id);
9494
</TabItem>
9595
</Tabs>
9696

97-
98-
99-
10097
### Interact with PubSub
10198

10299
```javascript

docs/docs/stack.md

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,78 @@ title: Stack
33
sidebar_position: 1
44
---
55

6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
9+
Stack is facade that provides provides IPFS and Relay communications for components such as Storage, PubSub and etc...
10+
11+
## Create
12+
13+
<Tabs>
14+
<TabItem value="public-relay" label="Public Relay">
15+
16+
```javascript
17+
import { Stack } from '@dstack-js/lib';
18+
19+
const stack = await Stack.create({
20+
namespace: 'namespace',
21+
});
22+
23+
console.log('My Peer ID is:', stack.id);
24+
```
25+
26+
</TabItem>
27+
<TabItem value="custom-relay" label="Custom Relay">
28+
29+
```javascript
30+
import { Stack } from '@dstack-js/lib';
31+
32+
const stack = await Stack.create({
33+
namespace: 'namespace',
34+
relay: 'https://relay.dstack.dev:443/graphql',
35+
});
36+
37+
console.log('My Peer ID is:', stack.id);
38+
```
39+
40+
</TabItem>
41+
42+
<TabItem value="non-browser" label="Non-browser environment">
43+
44+
```javascript
45+
import { Stack } from '@dstack-js/lib';
46+
import wrtc from '@dstack-js/wrtc';
47+
48+
const stack = await Stack.create({
49+
namespace: 'namespace',
50+
wrtc,
51+
});
52+
53+
console.log('My Peer ID is:', stack.id);
54+
```
55+
56+
</TabItem>
57+
</Tabs>
58+
659
## Identity
760

61+
### Providing private key
62+
63+
```javascript
64+
import { Stack } from '@dstack-js/lib';
65+
66+
const privateKey = '...';
67+
68+
const stack = await Stack.create({
69+
namespace: 'namespace',
70+
privateKey,
71+
});
72+
73+
console.log('My Peer ID is:', stack.id);
74+
```
75+
76+
You can generate a private key using [`peer-id`](https://www.npmjs.com/package/peer-id) module.
77+
878
### Peer object
979

1080
```javascript
@@ -14,7 +84,7 @@ sidebar_position: 1
1484
}
1585
```
1686

17-
### Get my information
87+
### Get my identity
1888

1989
```javascript
2090
const peer = await stack.id();
@@ -85,12 +155,3 @@ console.log(ms, 'ms');
85155
```javascript
86156
await stack.stop();
87157
```
88-
89-
Will terminate pubsub events and store replication
90-
91-
Also you can stop IPFS:
92-
93-
```javascript
94-
await stack.stop();
95-
await stack.ipfs.stop();
96-
```

docs/docusaurus.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/** @type {import('@docusaurus/types').DocusaurusConfig} */
44
module.exports = {
55
title: 'DStack',
6-
tagline:
7-
'Technology stack as a library for developing semi-decentralized web applications',
6+
tagline: 'A library for developing semi-decentralized web applications',
87
url: 'https://dstack.dev',
98
baseUrl: '/',
109
onBrokenLinks: 'throw',

docs/sidebars.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ module.exports = {
1818
},
1919
{
2020
type: 'category',
21-
label: 'Relay',
22-
items: ['relay', 'deploy-relay'],
21+
label: 'Core Library',
22+
items: ['stack', 'pubsub', 'shard', 'store'],
2323
},
24-
2524
{
2625
type: 'category',
27-
label: 'Core Library',
28-
items: ['stack', 'pubsub', 'shard', 'store'],
26+
label: 'Relay',
27+
items: ['relay', 'deploy-relay'],
2928
},
3029
],
3130
};

docs/src/css/custom.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
--ifm-color-primary-lightest: #2a232b;
1515
--ifm-background-color: #fffefa;
1616
--ifm-footer-background-color: var(--ifm-background-color);
17+
--ifm-link-color: #93703a;
18+
--ifm-button-background-color: #fff;
19+
}
20+
21+
.button--secondary:not(.button--outline) {
22+
background-color: #fff;
1723
}
1824

1925
.hero {
@@ -31,6 +37,7 @@
3137
--ifm-color-primary-lightest: #ffffff;
3238
--ifm-background-color: #201b21;
3339
--ifm-footer-link-color: black;
40+
--ifm-link-color: var(--ifm-color-primary-darker);
3441
}
3542

3643
.footer,

docs/src/pages/index.tsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,30 @@ import HomepageFeatures from '@site/src/components/HomepageFeatures';
88
import Logo from '../../static/img/logo.svg';
99

1010
function HomepageHeader() {
11-
const {siteConfig} = useDocusaurusContext();
11+
const { siteConfig } = useDocusaurusContext();
1212
return (
1313
<header className={clsx('hero hero--primary', styles.heroBanner)}>
14-
<div className="container">
15-
<Logo className={clsx('hero--logo', styles.heroLogo)} />
16-
<h1 className="hero__title">{siteConfig.title}</h1>
17-
<p className="hero__subtitle">{siteConfig.tagline}</p>
18-
<div className={styles.buttons}>
19-
<Link
20-
className="button button--secondary button--lg"
21-
to="/docs/intro"
22-
>
23-
Tutorial 🧑‍💻
24-
</Link>
14+
<div className="container">
15+
<Logo className={clsx('hero--logo', styles.heroLogo)} />
16+
<h1 className="hero__title">{siteConfig.title}</h1>
17+
<p className="hero__subtitle">{siteConfig.tagline}</p>
18+
<div className={styles.buttons}>
19+
<Link
20+
className="button button--secondary button--lg"
21+
to="/docs/intro"
22+
>
23+
Get started ⚡️
24+
</Link>
25+
</div>
2526
</div>
26-
</div>
27-
</header>
27+
</header>
2828
);
2929
}
3030

3131
export default function Home(): JSX.Element {
32-
const {siteConfig} = useDocusaurusContext();
32+
const { siteConfig } = useDocusaurusContext();
3333
return (
34-
<Layout
35-
title={`Hello from ${siteConfig.title}`}
36-
description="Description will go into a meta tag in <head />">
34+
<Layout title="Get Started" description={siteConfig.tagline}>
3735
<HomepageHeader />
3836
<main>
3937
<HomepageFeatures />

0 commit comments

Comments
 (0)