Skip to content

Commit

Permalink
chore: applied review remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
grisha87 committed Jun 24, 2024
1 parent a35f0e2 commit 26f6d97
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 20 deletions.
80 changes: 76 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,81 @@
# Contributing

It is recommended to run unit tests and static code analysis before committing changes.
You want to contribute to `golem-js`? That's great! This guide will help you get started.

## Setup local environment

1. Clone this repository
2. In the root of this project run `npm install` to install all necessary dependencies
3. To build the SDK run `npm run build`
4. Install yagna as described in the [README](./README.md) file - you will need it to test your changes against testnet (no real funds will be required to execute workloads on Golem Network)

### Unit Testing

For unit testing `golem-js` uses `jest` with [ts-mockito](https://www.npmjs.com/package/@johanblumenberg/ts-mockito) to mock code.

You can run tests using:

```bash
yarn lint
# and
yarn format
npm run test:unit
```

The test files are usually co-located with the files that they test in the `src/` folder.

### Pre-commit hooks

We use `husky` to enforce few rules using `prettier`, `eslint` or even commit message format which allows us to use [semantic-release](https://github.com/semantic-release/semantic-release).

## Pull Request Guidelines

Our development revolves around few branches:

- `master` - contains the latest stable production code (production track)
- `beta` - where the SDK team developers next major releases (slow track)
- `alpha` - when a different major release has to take precedence before `beta` (fast track)

The process is as follows:

- Depending on the contribution you're planning to make, create a `feature/`, `bugfix/` branch from the base branch (typically `master`), and merge back against that branch.
- In case of any contribution:
- Make sure you provide proper description for the PR (see template below)
- Add test cases if possible within the same PR

### PR description templates

#### Feature

```markdown
## Why is it needed?

_Explain why the feature is valuable and what problem does it solve._

## What should be changed?

_Explain the general idea behind the code changes - high level description of your solution to the problem stated above._
```

#### Bugfix

```markdown
## Steps to reproduce

1. _Do this_
2. _Then that_
3. _Finally this_

## Expected result

_Describe the desired outcome (how does fixed look like)_

## Actual result

_Describe the actual outcome (what happens now)_
```

## Discord

Feel invited to join our [Discord](http://discord.gg/golem). You can meet other SDK users and developers in the `#sdk-discussion` and `#js-discussion` channels.

## Thanks 💙

Thanks for all your contributions and efforts towards improving `golem-js`!
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<br />

<p align=center>
<img src=https://repository-images.githubusercontent.com/293524572/b8635cf6-9653-416d-ae56-bc9c6a43e503 alt="golem-js SDK logo" width=480 />
</p>

# Golem JavaScript API

![GitHub](https://img.shields.io/github/license/golemfactory/golem-js)
Expand All @@ -23,12 +29,12 @@
- [Getting started with Golem Network](#getting-started-with-golem-network)
- [Obtain an `app-key` to use with SDK](#obtain-an-app-key-to-use-with-sdk)
- [Usage](#usage)
- [Read more](#read-more)
- [Examples](#examples)
- [Documentation](#documentation)
- [Debugging](#debugging)
- [Testing](#testing)
- [Reporting issues](#reporting-issues)
- [Contributing](#contributing)
- [Discord](#discord)
- [See also](#see-also)
<!-- TOC -->

Expand All @@ -37,7 +43,7 @@
Become a **Requestor** in the **Golem Network** and use this SDK to:

- 🌐 Acquire compute resources from Providers using a convenient API
- 🚢 Deploy run your workloads with these resources and get the results back to your machine
- 🚢 Run your workloads with these resources and get the results back to your machine
- 🔐 Build N-tier application deployments and run them within a VPN
- 💰 Settle payments with Providers for the resources you've utilized

Expand Down Expand Up @@ -159,7 +165,7 @@ const order: MarketOrderSpec = {
try {
await glm.connect();
// Rent a machine
const rental = await glm.oneOf(order);
const rental = await glm.oneOf({ order });
await rental
.getExeUnit()
.then((exe) => exe.run("echo Hello, Golem! 👋"))
Expand All @@ -173,11 +179,7 @@ const order: MarketOrderSpec = {
})().catch(console.error);
```

### Read more

- Read about [other available usage patterns](./docs/USAGE.md) to learn more on how you can leverage the SDK.
- Check the [`examples` directory](./examples) for working examples showcasing various features of the SDK. All examples
are continuously E2E tested.
Read about [other available usage patterns](./docs/USAGE.md) to learn more on how you can leverage the SDK.

## Examples

Expand All @@ -202,13 +204,17 @@ the [debug package documentation](https://www.npmjs.com/package/debug).

## Testing

Read the dedicated [testing documentation](./TESTING.md) to learn more about how to run tests of the SDK.
Read the dedicated [testing documentation](./docs/TESTING.md) to learn more about how to run tests of the SDK.

## Reporting issues
## Contributing

In case you find an issue with the examples or the SDK itself, feel free to submit
Read the [Contributing Guide](./CONTRIBUTING.md) for details on how you can get involved. In case you find an issue with the examples or the SDK itself, feel free to submit
an [issue report](https://github.com/golemfactory/golem-js/issues) to the repository.

## Discord

Feel invited to join our [Discord](http://discord.gg/golem). You can meet other SDK users and developers in the `#sdk-discussion` and `#js-discussion` channels.

## See also

- [Golem](https://golem.network), a global, open-source, decentralized supercomputer that anyone can access.
Expand Down
4 changes: 2 additions & 2 deletions docs/CONCEPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This document explains the concepts modelled by the SDK which foster your intera
- [Why is it needed](#why-is-it-needed)
- [What it should do](#what-it-should-do-1)
- [How it was done](#how-it-was-done-1)
<!-- TOC -->
<!-- TOC -->

## Resource Rental Model

Expand Down Expand Up @@ -70,7 +70,7 @@ If you're familiar with containers, you can picture the architecture in the foll
>
> The above comparison is used only for illustrative purposes. Golem GVMIs, ExeUnits and Activities behave differently compared to Docker or Kubernetes.
As a Requestor you're interested in quickly executing your commands within the container that runs youre image. The `ExeUnit` abstraction delivered by the SDK is meant to do enable you to do so.
As a Requestor you're interested in quickly executing your commands within the container that runs your image. The `ExeUnit` abstraction delivered by the SDK is meant to do enable you to do so.

### What it should do

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const order: MarketOrderSpec = {
try {
await glm.connect();
// Rent a machine
const rental = await glm.oneOf(order);
const rental = await glm.oneOf({ order });
await rental
.getExeUnit()
.then((exe) => exe.run("echo Hello, Golem! 👋"))
Expand Down
2 changes: 1 addition & 1 deletion src/golem-network/golem-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export class GolemNetwork {
*
* @example
* ```ts
* const rental = await glm.oneOf(demand);
* const rental = await glm.oneOf({ order });
* await rental
* .getExeUnit()
* .then((exe) => exe.run("echo Hello, Golem! 👋"))
Expand Down

0 comments on commit 26f6d97

Please sign in to comment.