Skip to content

Commit

Permalink
Merge pull request #46 from Gateway-DAO/feat/improved-docs
Browse files Browse the repository at this point in the history
Feat/improved docs
  • Loading branch information
R11manish authored Mar 14, 2024
2 parents 871be32 + 83a703b commit 4290f57
Show file tree
Hide file tree
Showing 12 changed files with 3,752 additions and 1,328 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
jest.config.js
test/*
.mesh/*
__mocks__/*
dist/*
coverage/*
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules/
.mesh/
.vscode/
.env
dist/
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# pnpm lint-staged
pnpm lint-staged


6 changes: 3 additions & 3 deletions CODE_BASE_OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ This section will give you an overview of the SDK codebase. We will also discuss

- If you want to contribute to the SDK make sure you read this document and the [Contributing Guildelines](https://github.com/Gateway-DAO/javascript-sdk/blob/main/CONTRIBUTING.md) before proceeding.

### Graphql Mesh
### Custom Script to generate sdk from graphql end point

- We are using graphql mesh which generates a complete type-safe SDK using our graphql Schema.
- Using this tool we are able to auto generate all of queries and mutations and also providing autocomplete feature for developing applications.
- We don't use graphql mesh anymore instead we have a [custom in-house script](https://github.com/Gateway-DAO/gateway-js-sdk/blob/develop/scripts/generateSDK/generate.js)(heavily inspired from graphql mesh team) which generates a complete type-safe SDK using our graphql Schema.
- Using this script we are able to auto generate all of queries and mutations and also providing autocomplete feature for developing applications.

### Top Level Folder Structure

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

### Contributing Guildeline

- You have Node.js installed at LTS with version 16+ and using pnpm as package manager.
- You have Node.js installed at LTS with version 18+ and using pnpm as package manager.
- You have knowldge of git.
- Read the [code base overview](https://github.com/Gateway-DAO/javascript-sdk/blob/main/CODE_BASE_OVERVIEW.md) to have a short introduction about how we manage/write code.

Expand All @@ -56,10 +56,10 @@
pnpm i
```

3. Create the sdk using graphql mesh(it should give .mesh folder with sdk in it)
3. Create the sdk using our custom script(it should give .gatewaySdk folder with sdk in it)

```sh
pnpm mesh build
pnpm generate:sdk
```

4. Run test command to test sdk using jest
Expand Down
6 changes: 2 additions & 4 deletions FRONTEND_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

This section will give you an overview of using SDK in frontend environment like Next.js.

- **Before starting it is not recommended to use SDK in a frontend environment because the dependencies which we use mainly graphql mesh generally have bundling problems with webpack**. So you might face unexpected problems while using it. Although we have some potential solutions which will discuss as well in the docs.
- **Please upgrade to latest version of sdk to avoid adding any extra configuration for frontend environments.If you are already using latest version of the sdk or upgraded to latest one there is no need to read this doc**. We have some potential solutions(if you are using v1) which will discuss as well in the docs.

- **It is still highly recommend to use SDK in a backend environments as there are no bundling problems and will work smoothly.**

### Bypassing graphql mesh using next.config.js
### Bypassing graphql mesh using next.config.js (Deperacted in v2 of sdk)

- You need to modify the next.config file in your nextjs application below is the code you paste to make sure you dont get any dependencies errors.

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

A TypeScript SDK for the Gateway API. This library is built with TypeScript developers in mind, but it also works with JavaScript.

**Note: Make sure to [read our frontend docs](https://github.com/Gateway-DAO/gateway-js-sdk/blob/main/FRONTEND_DOCS.md) incase you are going to use SDK for frontend environemnts like Next.js**
**Note: Our latest version of sdk works without adding any extra configuration for frontend environments.**

### Features

- Full type information for methods and responses.
- Bearer Token Support
- Supports Node.js 18+.
- Works in frontend environments without adding any extra configuration.

## Installation

Expand Down
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

| Version | Supported |
| ------- | ------------------ |
| 2.x.x | :white_check_mark: |
| 1.x.x | :white_check_mark: |

## Reporting a Vulnerability
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [2, 'always', 200],
'footer-max-line-length': [2, 'always', 100],
'footer-max-line-length': [2, 'always', 1000],
},
};
Loading

0 comments on commit 4290f57

Please sign in to comment.