Skip to content

Commit

Permalink
Merged docs-react into packages/docs-react
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ committed Oct 2, 2024
2 parents 475ebeb + 53e58dc commit 048496b
Show file tree
Hide file tree
Showing 88 changed files with 30,745 additions and 14,015 deletions.
18 changes: 7 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ aliases:
- &save-deps-cache
key: deps-cache-{{ checksum "package.json" }}
paths:
- ~/project/node_modules
- ~/docs-react/node_modules

# -------------------------
# ALIASES: Branch Filters
Expand All @@ -20,16 +20,16 @@ aliases:
only: master
- &filter-only-semantic-pr
branches:
only: /^(pull|fix|feat|dependabot)\/.*$/
only: /^(pull|dependabot|fix|feat)\/.*$/

defaults: &defaults
working_directory: ~/project
working_directory: ~/docs-react

jobs:
test:
<<: *defaults
docker:
- image: circleci/node:14.17.5
- image: circleci/node:10
steps:
- checkout
- restore_cache: *restore-deps-cache
Expand All @@ -42,7 +42,7 @@ jobs:
build:
<<: *defaults
docker:
- image: circleci/node:14.17.5
- image: circleci/node:10
steps:
- checkout
- restore_cache: *restore-deps-cache
Expand All @@ -53,16 +53,13 @@ jobs:
release:
<<: *defaults
docker:
- image: circleci/node:14.17.5
- image: circleci/node:10
steps:
- checkout
- restore_cache: *restore-deps-cache
- run: npm install
- run: npm run build
- run: npm run build:package
- run: npm install semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github @semantic-release/npm @semantic-release/commit-analyzer @semantic-release/release-notes-generator @qiwi/semantic-release-gh-pages-plugin
- run: git checkout .
- run: ./node_modules/.bin/semantic-release
- run: npx semantic-release
- save_cache: *save-deps-cache

workflows:
Expand All @@ -87,7 +84,6 @@ workflows:
- test
- build
- release:
context: open-rpc-deployer
filters: *filter-only-master
requires:
- hold
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ root = true
[*]
indent_style = space
indent_size = 2
tab_width = 4
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
insert_final_newline = true
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
node_modules
coverage
build
docs
.DS_Store
dist
/**/build
package
coverage
*.tgz
34 changes: 1 addition & 33 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
{
"tagFormat": "${version}",
"branch": "master",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/github",
"@semantic-release/git",
"@semantic-release/npm"
],
"verifyConditions": [
"@semantic-release/changelog",
"@semantic-release/git",
"@semantic-release/github",
"@qiwi/semantic-release-gh-pages-plugin",
"@semantic-release/npm"
],
"publish": [
"@semantic-release/github",
{
"path": "@qiwi/semantic-release-gh-pages-plugin",
"msg": "github pages release",
"src": "build/",
"branch": "gh-pages"
},
"@semantic-release/npm"
],
"success": [
"@semantic-release/github"
],
"fail": [
"@semantic-release/github"
]
"tagFormat": "${version}"
}
72 changes: 27 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,29 @@
# Logs-React
# docs-react
OpenRPC documentation as a react component

## What is Logs-React?
#### What is this?
This is a react component that will render documentation for a given OpenRPC document.

This project is a React Component that displays a list of JSON-RPC Requests and Responses.
**Screenshot**:

## Features:
![image](https://user-images.githubusercontent.com/364566/54795109-1b1f5b80-4c08-11e9-9ba9-cc2f2d96c692.png)

* Displays Requests and Responses in a time-series format
* Supports JSON-RPC Notifications

## How do I use this?
#### How do I use this?

##### Installation:
```
npm install --save @open-rpc/logs-react
npm install --save @open-rpc/docs-react
```
##### Usage:
```
import JSONRPCLogger, {JSONRPCLog} from "@open-rpc/logs-react";
// Get these logs how ever you want
const logs: JSONRPCLog[] = [{
type: "request",
method: "test",
timestamp: new Date(),
payload: {
jsonrpc: "2.0",
method: "foo"
}
}];
<JSONRPCLogger logs={logs} />
import Documentation from "@open-rpc/docs-react";
```
and then use it somewhere:

##### Props:

| Name | Type | Function |
|-------------------|-------------------|-----------------------------------------------------------------------------------------------------|
| logs | JSONRPCLog | The list of JSON-RPC calls that logs-react will display |
| openRecentPayload | boolean | Default: false. If true, the payload of the most recent response will be expanded automatically. |
| sidebarAlign | "left" or "right" | Default: "left". Determines which side of the screen that the method filter sidebar will appear on. |
| sidebarOpen | boolean | Default: true. If true, the filter sidebar will be opened by default, if false it will be closed. |
```
<Documentation schema={schema} />
```

##### Example in a new project:

Expand All @@ -53,29 +36,28 @@ npx create-react-app <appname> --typescript
```
cd <appname>
npm install .
npm install @open-rpc/logs-react --save
npm install @open-rpc/docs-react @open-rpc/meta-schema --save
```

###### index.ts
```
import React from 'react';
import ReactDOM from 'react-dom';
import JSONRPCLogger, {JSONRPCLog} from "@open-rpc/logs-react";
import Documentation from "@open-rpc/docs-react";
import { OpenrpcDocument } from '@open-rpc/meta-schema';
const logs: JSONRPCLog[] = [{
type: "request",
method: "test",
timestamp: new Date(),
payload: {
jsonrpc: "2.0",
method: "foo"
}
}];
const schema: OpenrpcDocument = {
openrpc: "1.2.4",
info: {
"version": "0.0.0-development",
"title": "My New API"
},
methods: []
};
ReactDOM.render(<JSONRPCLogger logs={logs} />, document.getElementById("root"));
ReactDOM.render(<Documentation schema={schema} />, document.getElementById("root"));
```

### Contributing

How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.
###### screenshot
![image](https://user-images.githubusercontent.com/364566/54797953-920e2180-4c13-11e9-9ff8-723a836d0e2c.png)
19 changes: 12 additions & 7 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
module.exports = {
clearMocks: true,
coverageDirectory: '../coverage',
resetMocks: true,
restoreMocks: true,
rootDir: './src',
testEnvironment: 'jsdom',
preset: 'ts-jest'
"clearMocks": true,
"coverageDirectory": "../coverage",
"resetMocks": true,
"restoreMocks": true,
"rootDir": "./src",
"testEnvironment": "jsdom",
"testPathIgnorePatterns": ["./build"],
"preset": "ts-jest",
"transformIgnorePatterns": ['^.+\\.js$'],
"moduleNameMapper": {
"\\.(css|less|sass|scss)$": "jest-transform-css",
},
};
Loading

0 comments on commit 048496b

Please sign in to comment.