Skip to content

Commit 7b2a00b

Browse files
authored
Merge pull request #4950 from marcduiker/remove-js-submodule
Move JS SDK docs to main docs repo and remove js submodule
2 parents ae61beb + b6d3cd4 commit 7b2a00b

File tree

14 files changed

+2185
-6
lines changed

14 files changed

+2185
-6
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
[submodule "sdkdocs/go"]
99
path = sdkdocs/go
1010
url = https://github.com/dapr/go-sdk.git
11-
[submodule "sdkdocs/js"]
12-
path = sdkdocs/js
13-
url = https://github.com/dapr/js-sdk.git
1411
[submodule "sdkdocs/pluggable-components/go"]
1512
path = sdkdocs/pluggable-components/go
1613
url = https://github.com/dapr-sandbox/components-go-sdk

hugo.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ module:
302302
- source: sdkdocs/java/content/en/java-sdk-contributing
303303
target: content/contributing/sdk-contrib/
304304
lang: en
305-
- source: sdkdocs/js/daprdocs/content/en/js-sdk-docs
305+
- source: sdkdocs/js/content/en/js-sdk-docs
306306
target: content/developing-applications/sdks/js
307307
lang: en
308-
- source: sdkdocs/js/daprdocs/content/en/js-sdk-contributing
308+
- source: sdkdocs/js/content/en/js-sdk-contributing
309309
target: content/contributing/sdk-contrib/
310310
lang: en
311311
- source: sdkdocs/rust/daprdocs/content/en/rust-sdk-docs

sdkdocs/js

Lines changed: 0 additions & 1 deletion
This file was deleted.

sdkdocs/js/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Dapr JavaScript SDK documentation
2+
3+
This page covers how the documentation is structured for the Dapr JavaScript SDK
4+
5+
## Dapr Docs
6+
7+
All Dapr documentation is hosted at [docs.dapr.io](https://docs.dapr.io), including the docs for the [JavaScript SDK](https://docs.dapr.io/developing-applications/sdks/javascript/). Head over there if you want to read the docs.
8+
9+
### JavaScript SDK docs source
10+
11+
Although the docs site code and content is in the [docs repo](https://github.com/dapr/docs), the JavaScript SDK content and images are within the `content` and `static` directories, respectively.
12+
13+
This allows separation of roles and expertise between maintainers, and makes it easy to find the docs files you are looking for.
14+
15+
## Writing JavaScript SDK docs
16+
17+
To get up and running to write JavaScript SDK docs, visit the [docs repo](https://github.com/dapr/docs) to initialize your environment. It will clone both the docs repo and this repo, so you can make changes and see it rendered within the site instantly, as well as commit and PR into this repo.
18+
19+
Make sure to read the [docs contributing guide](https://docs.dapr.io/contributing/contributing-docs/) for information on style/semantics/etc.
20+
21+
## Docs architecture
22+
23+
The docs site is built on [Hugo](https://gohugo.io), which lives in the docs repo. This repo is setup as a git submodule so that when the repo is cloned and initialized, the javascript-sdk repo, along with the docs, are cloned as well.
24+
25+
Then, in the Hugo configuration file, the `daprdocs/content` and `daprdocs/static` directories are redirected to the `daprdocs/developing-applications/sdks/javascript` and `static/javascript` directories, respectively. Thus, all the content within this repo is folded into the main docs site.
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
type: docs
3+
title: "Contributing to the JavaScript SDK"
4+
linkTitle: "JavaScript SDK"
5+
weight: 3000
6+
description: Guidelines for contributing to the Dapr JavaScript SDK
7+
---
8+
9+
When contributing to the [JavaScript SDK](https://github.com/dapr/js-sdk) the following rules and best-practices should be followed.
10+
11+
💡 You can run `npm pretty-fix` to run prettier on all your files
12+
13+
## Commit Guidelines
14+
15+
The Dapr Javascript SDK uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
16+
specification. The automatic changelog tool uses these to automatically generate
17+
a changelog based on the commit messages. Here's a guide to writing a commit message
18+
to allow this:
19+
20+
### Format
21+
22+
```
23+
type(scope)!: subject
24+
```
25+
26+
- `type`: the type of the commit is one of the following:
27+
28+
- `feat`: new features.
29+
- `fix`: bug fixes.
30+
- `docs`: documentation changes.
31+
- `refactor`: refactor of a particular code section without introducing
32+
new features or bug fixes.
33+
- `style`: code style improvements.
34+
- `perf`: performance improvements.
35+
- `test`: changes to the test suite.
36+
- `ci`: changes to the CI system.
37+
- `build`: changes to the build system (we don't yet have one so this shouldn't apply).
38+
- `chore`: for other changes that don't match previous types. This doesn't appear
39+
in the changelog.
40+
41+
- `scope`: section of the codebase that the commit makes changes to. If it makes changes to
42+
many sections, or if no section in particular is modified, leave blank without the parentheses.
43+
Examples:
44+
45+
- Commit that adds a `test`:
46+
47+
```
48+
test(actors): add an actor test
49+
```
50+
51+
- Commit that changes many things at once:
52+
53+
```
54+
style: adopt eslint
55+
```
56+
57+
For changes to examples, the scope should be the example name with the `examples/` prefix:
58+
59+
-`fix(agnoster): commit subject`
60+
-`fix(examples/http/actor): commit subject`
61+
62+
- `!`: this goes after the `scope` (or the `type` if scope is empty), to indicate that the commit
63+
introduces breaking changes.
64+
65+
Optionally, you can specify a message that the changelog tool will display to the user to indicate
66+
what's changed and what they can do to deal with it. You can use multiple lines to type this message;
67+
the changelog parser will keep reading until the end of the commit message or until it finds an empty
68+
line.
69+
70+
Example (made up):
71+
72+
```
73+
style(agnoster)!: change dirty git repo glyph
74+
75+
BREAKING CHANGE: the glyph to indicate when a git repository is dirty has
76+
changed from a Powerline character to a standard UTF-8 emoji.
77+
78+
Fixes #420
79+
80+
Co-authored-by: Username <email>
81+
```
82+
83+
- `subject`: a brief description of the changes. This will be displayed in the changelog. If you need
84+
to specify other details you can use the commit body but it won't be visible.
85+
86+
Formatting tricks: the commit subject may contain:
87+
88+
- Links to related issues or PRs by writing `#issue`. This will be highlighted by the changelog tool:
89+
90+
```
91+
feat(archlinux): add support for aura AUR helper (#9467)
92+
```
93+
94+
- Formatted inline code by using backticks: the text inbetween backticks will also be highlighted by
95+
the changelog tool:
96+
```
97+
feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774)
98+
```
99+
100+
### Style
101+
102+
Try to keep the first commit line short. This is harder to do using this commit style but try to be
103+
concise and if you need more space, you can use the commit body. Try to make sure that the commit
104+
subject is clear and precise enough that users will know what change by just looking at the changelog.
105+
106+
## Github Dapr Bot Commands
107+
108+
Checkout the [daprbot documentation](https://docs.dapr.io/contributing/daprbot/) for Github commands you can run in this repo for common tasks. For example, you can run the `/assign` (as a comment on an issue) to assign issues to a user or group of users.
109+
110+
## Coding Rules
111+
112+
To ensure consistency throughout the source code, keep these rules in mind as you are working:
113+
114+
- All features or bug fixes **must be tested** by one or more specs (unit-tests).
115+
- All public API methods **must be documented**.
116+
- We follow [ESLint RecommendedRules](https://eslint.org/docs/rules/).
117+
118+
## Examples
119+
120+
The `examples` directory contains code samples for users to run to try out specific functionality of the various JavaScript SDK packages and extensions. When writing new and updated samples keep in mind:
121+
122+
- All examples should be runnable on Windows, Linux, and MacOS. While JavaScript code is consistent among operating systems, any pre/post example commands should provide options through [tabpane]({{% ref "contributing-docs.md#tabbed-content" %}}).
123+
- Contain steps to download/install any required pre-requisites. Someone coming in with a fresh OS install should be able to start on the example and complete it without an error. Links to external download pages are fine.
124+
125+
## Docs
126+
127+
The `daprdocs` directory contains the markdown files that are rendered into the [Dapr Docs](https://docs.dapr.io) website. When the documentation website is built, this repo is cloned and configured so that its contents are rendered with the docs content. When writing docs, keep in mind:
128+
129+
- All rules in the [docs guide]({{% ref contributing-docs.md %}}) should be followed in addition to these.
130+
- All files and directories should be prefixed with `js-` to ensure all file/directory names are globally unique across all Dapr documentation.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
type: docs
3+
title: "JavaScript SDK"
4+
linkTitle: "JavaScript"
5+
weight: 1000
6+
description: JavaScript SDK packages for developing Dapr applications
7+
no_list: true
8+
cascade:
9+
github_repo: https://github.com/dapr/js-sdk
10+
github_subdir: daprdocs/content/en/js-sdk-docs
11+
path_base_for_github_subdir: content/en/developing-applications/sdks/js/
12+
github_branch: main
13+
---
14+
15+
A client library for building Dapr apps in JavaScript and TypeScript. This client abstracts the public Dapr APIs like service to service invocation, state management, pub/sub, secrets, and much more, and provides a simple, intuitive API for building applications.
16+
17+
## Installation
18+
19+
To get started with the JavaScript SDK, install the Dapr JavaScript SDK package from [NPM](https://www.npmjs.com/package/@dapr/dapr):
20+
21+
```bash
22+
npm install --save @dapr/dapr
23+
```
24+
25+
## Structure
26+
27+
The Dapr JavaScript SDK contains two major components:
28+
29+
- **DaprServer**: to manage all Dapr sidecar to application communication.
30+
- **DaprClient**: to manage all application to Dapr sidecar communication.
31+
32+
The above communication can be configured to use either of the gRPC or HTTP protocols.
33+
34+
<table>
35+
<tr>
36+
<td bgcolor="white"> <img src="images/dapr-server.jpg" alt="Dapr Server" width="500px"> </td>
37+
<td bgcolor="white"> <img src="images/dapr-client.jpg" alt="Dapr Client" width="500px"> </td>
38+
</tr>
39+
</table>
40+
41+
## Getting Started
42+
43+
To help you get started, check out the resources below:
44+
45+
<div class="card-deck">
46+
<div class="card">
47+
<div class="card-body">
48+
<h5 class="card-title"><b>Client</b></h5>
49+
<p class="card-text">Create a JavaScript client and interact with the Dapr sidecar and other Dapr applications (e.g., publishing events, output binding support, etc.). </p>
50+
<a href="{{% ref js-client %}}" class="stretched-link"></a>
51+
</div>
52+
</div>
53+
<div class="card">
54+
<div class="card-body">
55+
<h5 class="card-title"><b>Server</b></h5>
56+
<p class="card-text">Create a JavaScript server and let the Dapr sidecar interact with your application (e.g., subscribing to events, input binding support, etc.). </p>
57+
<a href="{{% ref js-server %}}" class="stretched-link"></a>
58+
</div>
59+
</div>
60+
<div class="card">
61+
<div class="card-body">
62+
<h5 class="card-title"><b>Actors</b></h5>
63+
<p class="card-text">Create virtual actors with state, reminders/timers, and methods.</p>
64+
<a href="{{% ref js-actors %}}" class="stretched-link"></a>
65+
</div>
66+
</div>
67+
</div>
68+
<br />
69+
<div class="card-deck">
70+
<div class="card">
71+
<div class="card-body">
72+
<h5 class="card-title"><b>Logging</b></h5>
73+
<p class="card-text">Configure and customize the SDK logging.</p>
74+
<a href="{{% ref js-logger %}}" class="stretched-link"></a>
75+
</div>
76+
</div>
77+
<div class="card">
78+
<div class="card-body">
79+
<h5 class="card-title"><b>Examples</b></h5>
80+
<p class="card-text">Clone the JavaScript SDK source code and try out some of the examples to get started quickly.</p>
81+
<a href="{{% ref js-examples %}}" class="stretched-link"></a>
82+
</div>
83+
</div>
84+
</div>
215 KB
Loading
219 KB
Loading

0 commit comments

Comments
 (0)