Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
[submodule "sdkdocs/go"]
path = sdkdocs/go
url = https://github.com/dapr/go-sdk.git
[submodule "sdkdocs/js"]
path = sdkdocs/js
url = https://github.com/dapr/js-sdk.git
[submodule "sdkdocs/pluggable-components/go"]
path = sdkdocs/pluggable-components/go
url = https://github.com/dapr-sandbox/components-go-sdk
Expand Down
4 changes: 2 additions & 2 deletions hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ module:
- source: sdkdocs/java/content/en/java-sdk-contributing
target: content/contributing/sdk-contrib/
lang: en
- source: sdkdocs/js/daprdocs/content/en/js-sdk-docs
- source: sdkdocs/js/content/en/js-sdk-docs
target: content/developing-applications/sdks/js
lang: en
- source: sdkdocs/js/daprdocs/content/en/js-sdk-contributing
- source: sdkdocs/js/content/en/js-sdk-contributing
target: content/contributing/sdk-contrib/
lang: en
- source: sdkdocs/rust/daprdocs/content/en/rust-sdk-docs
Expand Down
1 change: 0 additions & 1 deletion sdkdocs/js
Submodule js deleted from 26e8be
25 changes: 25 additions & 0 deletions sdkdocs/js/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Dapr JavaScript SDK documentation

This page covers how the documentation is structured for the Dapr JavaScript SDK

## Dapr Docs

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.

### JavaScript SDK docs source

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.

This allows separation of roles and expertise between maintainers, and makes it easy to find the docs files you are looking for.

## Writing JavaScript SDK docs

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.

Make sure to read the [docs contributing guide](https://docs.dapr.io/contributing/contributing-docs/) for information on style/semantics/etc.

## Docs architecture

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.

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.
130 changes: 130 additions & 0 deletions sdkdocs/js/content/en/js-sdk-contributing/js-contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
type: docs
title: "Contributing to the JavaScript SDK"
linkTitle: "JavaScript SDK"
weight: 3000
description: Guidelines for contributing to the Dapr JavaScript SDK
---

When contributing to the [JavaScript SDK](https://github.com/dapr/js-sdk) the following rules and best-practices should be followed.

💡 You can run `npm pretty-fix` to run prettier on all your files

## Commit Guidelines

The Dapr Javascript SDK uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
specification. The automatic changelog tool uses these to automatically generate
a changelog based on the commit messages. Here's a guide to writing a commit message
to allow this:

### Format

```
type(scope)!: subject
```

- `type`: the type of the commit is one of the following:

- `feat`: new features.
- `fix`: bug fixes.
- `docs`: documentation changes.
- `refactor`: refactor of a particular code section without introducing
new features or bug fixes.
- `style`: code style improvements.
- `perf`: performance improvements.
- `test`: changes to the test suite.
- `ci`: changes to the CI system.
- `build`: changes to the build system (we don't yet have one so this shouldn't apply).
- `chore`: for other changes that don't match previous types. This doesn't appear
in the changelog.

- `scope`: section of the codebase that the commit makes changes to. If it makes changes to
many sections, or if no section in particular is modified, leave blank without the parentheses.
Examples:

- Commit that adds a `test`:

```
test(actors): add an actor test
```

- Commit that changes many things at once:

```
style: adopt eslint
```

For changes to examples, the scope should be the example name with the `examples/` prefix:

- ❌ `fix(agnoster): commit subject`
- ✅ `fix(examples/http/actor): commit subject`

- `!`: this goes after the `scope` (or the `type` if scope is empty), to indicate that the commit
introduces breaking changes.

Optionally, you can specify a message that the changelog tool will display to the user to indicate
what's changed and what they can do to deal with it. You can use multiple lines to type this message;
the changelog parser will keep reading until the end of the commit message or until it finds an empty
line.

Example (made up):

```
style(agnoster)!: change dirty git repo glyph

BREAKING CHANGE: the glyph to indicate when a git repository is dirty has
changed from a Powerline character to a standard UTF-8 emoji.

Fixes #420

Co-authored-by: Username <email>
```

- `subject`: a brief description of the changes. This will be displayed in the changelog. If you need
to specify other details you can use the commit body but it won't be visible.

Formatting tricks: the commit subject may contain:

- Links to related issues or PRs by writing `#issue`. This will be highlighted by the changelog tool:

```
feat(archlinux): add support for aura AUR helper (#9467)
```

- Formatted inline code by using backticks: the text inbetween backticks will also be highlighted by
the changelog tool:
```
feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774)
```

### Style

Try to keep the first commit line short. This is harder to do using this commit style but try to be
concise and if you need more space, you can use the commit body. Try to make sure that the commit
subject is clear and precise enough that users will know what change by just looking at the changelog.

## Github Dapr Bot Commands

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.

## Coding Rules

To ensure consistency throughout the source code, keep these rules in mind as you are working:

- All features or bug fixes **must be tested** by one or more specs (unit-tests).
- All public API methods **must be documented**.
- We follow [ESLint RecommendedRules](https://eslint.org/docs/rules/).

## Examples

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:

- 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" %}}).
- 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.

## Docs

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:

- All rules in the [docs guide]({{% ref contributing-docs.md %}}) should be followed in addition to these.
- All files and directories should be prefixed with `js-` to ensure all file/directory names are globally unique across all Dapr documentation.
84 changes: 84 additions & 0 deletions sdkdocs/js/content/en/js-sdk-docs/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
type: docs
title: "JavaScript SDK"
linkTitle: "JavaScript"
weight: 1000
description: JavaScript SDK packages for developing Dapr applications
no_list: true
cascade:
github_repo: https://github.com/dapr/js-sdk
github_subdir: daprdocs/content/en/js-sdk-docs
path_base_for_github_subdir: content/en/developing-applications/sdks/js/
github_branch: main
---

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.

## Installation

To get started with the JavaScript SDK, install the Dapr JavaScript SDK package from [NPM](https://www.npmjs.com/package/@dapr/dapr):

```bash
npm install --save @dapr/dapr
```

## Structure

The Dapr JavaScript SDK contains two major components:

- **DaprServer**: to manage all Dapr sidecar to application communication.
- **DaprClient**: to manage all application to Dapr sidecar communication.

The above communication can be configured to use either of the gRPC or HTTP protocols.

<table>
<tr>
<td bgcolor="white"> <img src="images/dapr-server.jpg" alt="Dapr Server" width="500px"> </td>
<td bgcolor="white"> <img src="images/dapr-client.jpg" alt="Dapr Client" width="500px"> </td>
</tr>
</table>

## Getting Started

To help you get started, check out the resources below:

<div class="card-deck">
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Client</b></h5>
<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>
<a href="{{% ref js-client %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Server</b></h5>
<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>
<a href="{{% ref js-server %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Actors</b></h5>
<p class="card-text">Create virtual actors with state, reminders/timers, and methods.</p>
<a href="{{% ref js-actors %}}" class="stretched-link"></a>
</div>
</div>
</div>
<br />
<div class="card-deck">
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Logging</b></h5>
<p class="card-text">Configure and customize the SDK logging.</p>
<a href="{{% ref js-logger %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Examples</b></h5>
<p class="card-text">Clone the JavaScript SDK source code and try out some of the examples to get started quickly.</p>
<a href="{{% ref js-examples %}}" class="stretched-link"></a>
</div>
</div>
</div>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading