Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

More consistent grammar and spelling #70

Merged
merged 3 commits into from
Oct 16, 2021
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
10 changes: 5 additions & 5 deletions docs/contribute/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
There are many ways to contribute to nodecg-io: logging bugs, submitting pull requests, reporting issues, and creating suggestions.

First you'll need an installation of nodecg-io. Please refer to the [installation guide](../getting_started/install.md) and create a development installation.
The cli asks you whether you want to clone the documentation. It's highly recommended that you do that and update the documentation as you add new services or features.
To be able to create Pull Requests you should fork the corresponding repositories and add them as a remote (update url for e.g. documentation repository):
The CLI asks you whether you want to clone the documentation. It's highly recommended that you do that and update the documentation as you add new services or features.
To be able to create Pull Requests you should fork the corresponding repositories and add them as a remote (update URL for e.g., documentation repository):

```shell
git remote add fork https://github.com/[YOUR_USERNAME]/nodecg-io.git
Expand All @@ -27,7 +27,7 @@ The watch builder will watch for file changes and compile those changes incremen
It will even stay running in the background if you close VS Code.
You can resume it by starting the build task with
<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>B</kbd> (<kbd>CMD</kbd>+<kbd>Shift</kbd>+<kbd>B</kbd>) again.
ou can kill the build task by pressing <kbd>Ctrl</kbd>+<kbd>D</kbd> in the task terminal (<kbd>CMD</kbd>+<kbd>D</kbd>) on macOS.
You can kill the build task by pressing <kbd>Ctrl</kbd>+<kbd>D</kbd> in the task terminal (<kbd>CMD</kbd>+<kbd>D</kbd>) on macOS.
Errors and warnings will be shown in the status bar at the bottom left of the editor. You can view the error list using `View | Errors and Warnings` or pressing <kbd>Ctrl</kbd>+<kbd>P</kbd> and then <kbd>!</kbd> (<kbd>CMD</kbd>+<kbd>P</kbd> and <kbd>!</kbd> on macOS)

### Terminal
Expand All @@ -49,7 +49,7 @@ npm run watch
```

_Note:_ Watching all packages requires a lot of RAM.
Instead, you can watch just the packages you are actively working on e.g. `npm run watch -- --scope nodecg-io-twitch-chat --scope twitch-chat`.
Instead, you can watch just the packages you are actively working on e.g., `npm run watch -- --scope nodecg-io-twitch-chat --scope twitch-chat`.
This will just spawn a watch process for the twitch-chat sample and service and require way less memory.

## Run
Expand Down Expand Up @@ -82,7 +82,7 @@ You may also occasionally need to merge upstream master in a pull request. To do

### Where to Contribute

After cloning and building the repo, check out the [issues list](https://github.com/codeoverflow-org/nodecg-io/issues). Issues labeled [`help wanted`](https://github.com/codeoverflow-org/nodecg-io/labels/help%20wanted) are good issues to submit a PR for. Issues labeled [`good first issue`](https://github.com/codeoverflow-org/nodecg-io/labels/good%20first%20issue) are great candidates to pick up if you are in the code for the first time. If you are contributing significant changes, please discuss with the assignee of the issue first before starting to work on the issue.
After cloning and building the repo, check out the [issues list](https://github.com/codeoverflow-org/nodecg-io/issues). Issues labelled [`help wanted`](https://github.com/codeoverflow-org/nodecg-io/labels/help%20wanted) are good issues to submit a PR for. Issues labelled [`good first issue`](https://github.com/codeoverflow-org/nodecg-io/labels/good%20first%20issue) are great candidates to pick up if you are in the code for the first time. If you are contributing significant changes, please discuss with the assignee of the issue first before starting to work on the issue.

## Suggestions

Expand Down
19 changes: 12 additions & 7 deletions docs/contribute/create_sample.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Create a folder in `samples` named after the sample and add a `package.json` and
"dependencies": {
"nodecg-io-<the service name>": "^0.2.0",
"nodecg-io-core": "^0.2.0",
"@types/node": "^14.14.13",
"nodecg": "^1.7.4",
"typescript": "^4.1.3"
"@types/node": "^15.0.2",
"nodecg-types": "^1.8.2",
"typescript": "^4.2.4"
}
}
```
Expand All @@ -41,21 +41,26 @@ Create a folder in `samples` named after the sample and add a `package.json` and
Now you can create a file called `extension/index.ts`. Here's a template. Make sure you replace all the comments with your own code.

```typescript
import { NodeCG } from "nodecg/types/server";
import { NodeCG } from "nodecg-types/types/server";
import { requireService } from "nodecg-io-core";
import { TheServicesExportedClient } from "nodecg-io-<the services name>";

module.exports = function (nodecg: NodeCG) {
nodecg.log.info("Sample bundle for <the-service-name> started");

const service = requireService<TheServicesExportedClient>(nodecg, "<the-service-name>");
const service = requireService<TheServicesExportedClient>(
nodecg,
"<the-service-name>"
);
service?.onAvailable((client) => {
nodecg.log.info("Client has been updated.");
nodecg.log.info("<the-service-name> client has been updated.");

// TODO do something with the client to demonstrate the functionality.
});

service?.onUnavailable(() => nodecg.log.info("Client has been unset."));
service?.onUnavailable(() =>
nodecg.log.info("<the-service-name> client has been unset.")
);
};
```

Expand Down
40 changes: 19 additions & 21 deletions docs/contribute/create_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

This guide helps you to create a service integration such as _twitch-chat_ or _discord_

## Find a javascript library
## Find a JavaScript library

Go to [npmjs.com](https://www.npmjs.com/) and look whether there's already a package that wraps around the API of your service. If there's no such package you need to create one yourself. This process is not described here.
Go to [npmjs.com](https://www.npmjs.com/) and look whether there's already a package that wraps around the API of your service. If there's no such package, you need to create one yourself. This process is not described here. You may read the
[“Contributing packages to the registry” from the npm Docs](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry).

## Create a package

From here you will have to replace:

- `YourServiceName` to your service's name in [PascalCase](https://github.com/basarat/typescript-book/blob/master/docs/styleguide/styleguide.md#class).
- `yourServiceName` to your service's name in [carmelCase](https://github.com/basarat/typescript-book/blob/master/docs/styleguide/styleguide.md#variable-and-function).
- `your-service-name` to your service's name with only lowercase and hyphens ( `-` ) for example: ws-server.
- `your-service-name` to your service's name with only lowercase and hyphens (`-`) for example: ws-server.

Now you need to create a package. You should call it `nodecg-io-your-service-name`.

Expand All @@ -35,6 +36,7 @@ Put the following into it:
"url": "https://github.com/codeoverflow-org/nodecg-io.git",
"directory": "nodecg-io-<your-service-name>"
},
"files": ["**/*.js", "**/*.js.map", "**/*.d.ts", "*.json"],
"main": "extension",
"scripts": {
"build": "tsc -b",
Expand All @@ -50,9 +52,9 @@ Put the following into it:
},
"license": "MIT",
"devDependencies": {
"@types/node": "^14.14.33",
"nodecg": "^1.8.1",
"typescript": "^4.2.3"
"@types/node": "^15.0.2",
"nodecg-types": "^1.8.2",
"typescript": "^4.2.4"
},
"dependencies": {
"nodecg-io-core": "^0.2.0",
Expand All @@ -73,19 +75,19 @@ Now run `npm install` and `npm run bootstrap` in the repository root.

## Create a configuration schema

Next create a file called `your-service-name-schame.json`. This is a json schema file that indicates how the configuration for your service should be structured. If you need help here take a look at [this](https://json-schema.org/understanding-json-schema/) online resource and the schema-files of the other service implementations.
Next create a file called `your-service-name-schame.json`. This is a JSON schema file that indicates how the configuration for your service should be structured. If you need help here take a look at [this](https://json-schema.org/understanding-json-schema/) online resource and the schema-files of the other service implementations.

## Create the service

Create a file called `index.ts` in a folder called `extension` inside your services directory. You can then paste the following code and fill in your code instead of the comments.
Create a file called `index.ts` in a folder called `extension` inside your service's directory. You can then paste the following code and fill in your code instead of the comments.

```typescript
// TODO: Rename all occurences of "YourServiceName" in PascalCase
// TODO: Rename all occurences of "yourServiceName" in carmelCase
// TODO: Rename all occurences of "your-service-name" with only lowercase and hyphens ( - )
// TODO: Rename all occurrences of "YourServiceName" in PascalCase
// TODO: Rename all occurrences of "yourServiceName" in carmelCase
// TODO: Rename all occurrences of "your-service-name" with only lowercase and hyphens ( - )

import { NodeCG } from "nodecg/types/server";
import { Result, emptySuccess, success, ServiceBundle, ServiceClient } from "nodecg-io-core";
import { NodeCG } from "nodecg-types/types/server";
import { Result,emptySuccess,success,ServiceBundle } from "nodecg-io-core";
// TODO: Replace the "fake" service class with that found on npm etc.
import { ServiceClass } from "./";

Expand All @@ -106,7 +108,7 @@ module.exports = (nodecg: NodeCG) => {
new YourServiceNameService(nodecg, "your-service-name", __dirname, "../your-service-name-schema.json").register();
};

class YourServiceNameService extends ServiceBundle<YourServiceNameServiceConfig, YourServiceNameServiceClient> {
class YourServiceNameService extends ServiceBundle<YourServiceNameServiceConfig,YourServiceNameServiceClient> {
async validateConfig(config: YourServiceNameServiceConfig): Promise<Result<void>> {
// TODO You can validate your config here. If this gets called, the schema is correct.
// You should for example check whether oauth keys are valid and servers are online here
Expand All @@ -116,17 +118,13 @@ class YourServiceNameService extends ServiceBundle<YourServiceNameServiceConfig,

async createClient(config: YourServiceNameServiceConfig): Promise<Result<YourServiceNameServiceClient>> {
// TODO Here you should return a <Your service name>ServiceClient that is exposed to bundles.
// If everything is good return 'success({
// getNativeClient() {
// return <The raw client from the package from step 1>
// }
// })'
// Or create a instance of your class if you have any simplifications and return that.
// If everything is good return 'success(client)'
// If an error occurs return 'error(<The error message>)'
}

stopClient(client: YourServiceNameServiceClient): void {
// Here you shuld make sure you disconnect everything here (if possible).
// Here you should make sure you disconnect everything here (if possible).
}
}
```
Expand All @@ -150,4 +148,4 @@ No sample bundle for service `<the services name>`.
[You can help us and create one!](https://github.com/codeoverflow-org/nodecg-io/blob/master/docs/docs/contribute.md)
```

Do not remove the marker in the first line until the bundle is implemented and don't forget to add this file to `mkdocs.yml`.
Do not remove the marker in the first line until there is a sample bundle, and it is documented there. Don't forget to add this file to `mkdocs.yml`.
6 changes: 3 additions & 3 deletions docs/contribute/sample_documentation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Add your sample to the docs

To document a sample bundle take a look at the name of the service the sample bundle is for. If it's for example `nodecg-io-example` the documentation must go into `docs/samples/example.md` in the docs repository. There you should include a step-by-step manual how to configure the service and get the bundle running.
To document a sample bundle take a look at the name of the service the sample bundle is for. If it's for example `nodecg-io-example` the documentation must go into `docs/samples/example.md` in the doc's repository. There you should include a step-by-step manual how to configure the service and get the bundle running.

Don't forget to add the newly created MarkDown file to `mkdocs.yml`. When you create your documentation pull request, please include the id of your PR in the main repository in the description, so the documentation is not merged before the actual code.
Don't forget to add the newly created Markdown file to `mkdocs.yml`. When you create your documentation pull request, please include the ID of your PR in the main repository in the description, so the documentation will not be merged before the actual code.

You should make this very detailed so everyone gets it to work because a super-good implementation is worth nothing if there's nobody who can use it. Take a look at the [twitch sample bundle](../samples/twitch-chat.md).
You should make this very detailed, so everyone gets it to work because a super-good implementation is worth nothing if there's nobody who can use it. Take a look at the [twitch sample bundle](../samples/twitch-chat.md).
15 changes: 7 additions & 8 deletions docs/getting_started/configuration.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Configuration

<!-- TODO: introduction sentence -->

The configuration file for nodecg-io is at `cfg/nodecg-io-core.json` inside your nodecg installation. This file does not exist by default, you need to create it yourself.
Since version `0.2.0` nodecg-io has a configuration feature to save some settings without needing to code something or log in. The configuration file for
this feature is at `cfg/nodecg-io-core.json` inside your nodecg installation. This file does not exist by default, you need to create it yourself.

The currently only thing you can configure is automatic login, but there may be more configurable options in the future.

## Automatic login

Automatic login will automatically load nodecg-io when nodecg starts using the provided password.

Therefore nodecg-io will be able to decrypt your configuration for your service instances and provide your bundles with service clients without you logging in to nodecg-io using the dashboard.
This is especially useful if you are running nodecg with nodecg-io on a server which may reboot from time to time to ensure that your bundles are always working without you needing to manually login after each restart.
Therefore, nodecg-io will be able to decrypt your configuration for your service instances and provide your bundles with service clients without you logging in to nodecg-io using the dashboard.
This is especially useful if you are running nodecg with nodecg-io on a server which may reboot from time to time to ensure that your bundles are always working without you needing to manually log in after each restart.

**Security warning:** Having both the encrypted configuration and your used password saved on disk defeats nodecg-ios data-at-rest encryption.
**Security warning:** Having both the encrypted configuration and your used password saved on disk defeats nodecg-io's data-at-rest encryption.
Any program that can read disk contents can access your credentials of any service instance. We discourage using this and if you really want to use it you should be extra cautious about which bundles you install.

Options of automatic login:
Expand All @@ -26,8 +25,8 @@ Options of automatic login:

- `password` (string)

This is the password that will be used to login. It should be the password you use to login to nodecg-io.
If this password is wrong a error will be logged after startup.
This is the password that will be used to log in. It should be the password you use to log in to nodecg-io.
If this password is wrong an error will be logged after startup.

Example config:

Expand Down
10 changes: 5 additions & 5 deletions docs/getting_started/create_new_bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ To actually use nodecg-io you need to create a bundle. Here's a step-by-step gui

Think of what services your bundle needs. Take a look at the [service list](../services.md) if to see what services are available. If you need a service that is not yet available consider [creating it](../contribute/create_service.md).

## Create your bundle using the nodecg-io cli
## Create your bundle using the nodecg-io CLI

Automatically generating a bundle that uses nodecg-io requires that you have the nodecg-io cli installed. A guide on how to do this is inside the [install guide](./install.md). Also note that this currently only works when you have installed a release version, not development versions.
Automatically generating a bundle that uses nodecg-io requires that you have the nodecg-io CLI installed. A guide on how to do this is inside the [installation guide](./install.md). Also note that this currently only works when you have installed a release version, not development versions.

To start run this command while being inside your nodecg installation:

Expand All @@ -17,11 +17,11 @@ nodecg-io generate
This will ask you a couple details about your bundle like name, description and used services.
Most questions have a reasonable default that you can choose if you don't care or are not sure about the asked thing.

After finishing the prompt the cli will generate your bundle, install dependencies and, if you have chosen TypeScript, compile the generated code.
After finishing the prompt the CLI will generate your bundle, install dependencies and, if you have chosen TypeScript, compile the generated code.

## Test it

Start NodeCG and make sure that the bundle gets loaded successfully and it is displayed in the nodecg-io dashboard with all service dependencies.
Start NodeCG and make sure that the bundle gets loaded successfully, and it is displayed in the nodecg-io dashboard with all service dependencies.

## Modify it

Expand All @@ -35,7 +35,7 @@ _Note:_ If you need to access another service inside the callback of a `onAvaila
A couple of steps you may want to do after generating a bundle:

- Create a git repository for you bundle (a `.gitignore` is automatically generated for you) and push it to a git platform of your choice
- Add a [open source license](https://choosealicense.com), don't forget it to also add it to the `package.json` file
- Add an [open source licence](https://choosealicense.com), don't forget it to also add it to the `package.json` file
- Add code formatters and linting tools like [prettier](https://prettier.io/) and [ESLint](https://eslint.org/)
- Add a README that explains what your bundle does and how it can be used

Expand Down
Loading