Skip to content

Commit

Permalink
fix: wip everything builds properly
Browse files Browse the repository at this point in the history
  • Loading branch information
zcstarr committed Dec 20, 2024
1 parent a15c77e commit 10f56e4
Show file tree
Hide file tree
Showing 30 changed files with 388 additions and 52 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ LLMLOG.md
.turbo/
**/*/.turbo
tsconfig.tsbuildinfo
dist/
55 changes: 35 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "jest.config.js",
"scripts": {
"build": "turbo run build",
"build:package": "turbo run build:package --filter=@open-rpc/logs-react^... --filter=@open-rpc/inspector^...",
"build:package": "turbo run build:package --filter=@open-rpc/monaco-editor-react --filter=@open-rpc/docs-react --filter=@open-rpc/logs-react --filter=@open-rpc/inspector --filter=@open-rpc/playground",
"test": "turbo run test",
"lint": "turbo run lint",
"watch": "turbo run build test --watch",
Expand Down
1 change: 1 addition & 0 deletions packages/docs-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"scripts": {
"lint": "eslint 'src/**/*.{ts,tsx}'",
"build": "tsc --project tsconfig.json && cp src/ContentDescriptor/ContentDescriptor.css build/ContentDescriptor/",
"build:package": "tsc --build tsconfig.json && cp src/ContentDescriptor/ContentDescriptor.css build/ContentDescriptor/",
"test": "jest",
"start": "react-scripts start",
"clean": "rm -rf build coverage",
Expand Down
4 changes: 2 additions & 2 deletions packages/inspector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"build": "rescripts build",
"lint": "eslint 'src/**/*.{ts,tsx}'",
"test": "jest",
"build:package": "tsc --build tsconfig.json",
"build:package": "tsc --build tsconfig.json && cp -r src/*.css build/",
"clean": "rm -rf build coverage",
"format": "prettier --write 'src/**/*.{ts,tsx,js,jsx,json,md}'"
},
Expand Down Expand Up @@ -57,7 +57,7 @@
"@material-ui/lab": "4.0.0-alpha.47",
"@monaco-editor/react": "^4.0.0",
"@open-rpc/client-js": "^1.6.3",
"@open-rpc/logs-react": "workspace:*",
"@open-rpc/logs-react": "*",
"@open-rpc/meta-schema": "^1.14.9",
"@open-rpc/schema-utils-js": "^1.14.3",
"@rehooks/window-size": "^1.0.2",
Expand Down
7 changes: 6 additions & 1 deletion packages/inspector/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ import App from "./containers/App";
import "./App.css";
import "./splitpane.css";

ReactDOM.render(<App />, document.getElementById("root"));
import {default as Inspector} from "./containers/Inspector";
export default Inspector;

if (typeof document !== 'undefined') {
ReactDOM.render(<App />, document.getElementById("root"));
}
3 changes: 2 additions & 1 deletion packages/inspector/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"include": ["src"],
"references": [
{ "path": "../logs-react" }
]
],
"include": ["src/**/*", "src/**/*.css"]
}
12 changes: 7 additions & 5 deletions packages/logs-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
"version": "0.0.0-development",
"description": "",
"main": "build/index.js",
"module": "build/index.js",
"types": "build/index.d.ts",
"module": "build/exports.js",
"types": "build/exports.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"import": "./build/index.js"
"types": "./build/exports.d.ts",
"import": "./build/exports.js",
"default": "./build/exports.js",
"require": "./build/exports.js"
}
},
"homepage": "https://open-rpc.github.io/logs-react/",
Expand All @@ -21,7 +23,7 @@
"scripts": {
"start": "vite",
"build": "vite build",
"build:package": "tsc --build tsconfig.json && cp -r src/**/*.css build/",
"build:package": "tsc --build tsconfig.json && cd src && find . -name '*.css' -exec cp -v --parents -t ../build {} +",
"lint": "eslint 'src/**/*.{ts,tsx}'",
"test": "jest",
"clean": "rm -rf build coverage",
Expand Down
5 changes: 3 additions & 2 deletions packages/logs-react/src/exports.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import JSONRPCLogger, {IJSONRPCLog} from "./components/logsReact/logsReact";
export type JSONRPCLog = IJSONRPCLog;
import JSONRPCLogger from "./components/logsReact/logsReact";
export type { IJSONRPCLog as JSONRPCLog } from "./components/logsReact/logsReact";
export { JSONRPCLogger };
export default JSONRPCLogger;
17 changes: 16 additions & 1 deletion packages/logs-react/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import ReactDOM from "react-dom";
import React from "react";
import MyApp from "./containers/MyApp";
import JSONRPCLogger from "./components/logsReact/logsReact";

ReactDOM.render(<MyApp />, document.getElementById("root"));
// NOTE: This isn't what we want to do here, but it allows us to cross package build
//TODO: ReactDOM.render(<MyApp />, document.getElementById("root"));

import type { IJSONRPCLog } from "./components/logsReact/logsReact";

export type { IJSONRPCLog as JSONRPCLog };
export { JSONRPCLogger };
export default JSONRPCLogger;

// Keep the app rendering for development
if (typeof document !== 'undefined') {
const MyApp = require('./containers/MyApp').default;
const ReactDOM = require('react-dom');
ReactDOM.render(<MyApp />, document.getElementById("root"));
}
1 change: 0 additions & 1 deletion packages/logs-react/src/react-app-env.d.ts

This file was deleted.

8 changes: 6 additions & 2 deletions packages/logs-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"compilerOptions": {
"outDir": "./build",
"rootDir": "./src",
"composite": true
"composite": true,
"paths": {
"@/*": ["./src/exports"],
"@exports": ["./src/exports"]
}
},
"include": ["src"]
"include": ["src/**/*", "src/**/*.css"]
}
14 changes: 14 additions & 0 deletions packages/monaco-editor-react/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
4 changes: 4 additions & 0 deletions packages/monaco-editor-react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
build
coverage
*.tgz
1 change: 1 addition & 0 deletions packages/monaco-editor-react/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.20.5
3 changes: 3 additions & 0 deletions packages/monaco-editor-react/.releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tagFormat": "${version}"
}
63 changes: 63 additions & 0 deletions packages/monaco-editor-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# docs-react
OpenRPC documentation as a react component

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

**Screenshot**:

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


#### How do I use this?

##### Installation:
```
npm install --save @open-rpc/docs-react
```
##### Usage:
```
import Documentation from "@open-rpc/docs-react";
```
and then use it somewhere:

```
<Documentation schema={schema} />
```

##### Example in a new project:

###### create a new typescript project with `create-react-app`

```
npx create-react-app <appname> --typescript
```

```
cd <appname>
npm install .
npm install @open-rpc/docs-react @open-rpc/meta-schema --save
```

###### index.ts
```
import React from 'react';
import ReactDOM from 'react-dom';
import Documentation from "@open-rpc/docs-react";
import { OpenrpcDocument } from '@open-rpc/meta-schema';
const schema: OpenrpcDocument = {
openrpc: "1.2.4",
info: {
"version": "0.0.0-development",
"title": "My New API"
},
methods: []
};
ReactDOM.render(<Documentation schema={schema} />, document.getElementById("root"));
```

###### screenshot
![image](https://user-images.githubusercontent.com/364566/54797953-920e2180-4c13-11e9-9ff8-723a836d0e2c.png)
9 changes: 9 additions & 0 deletions packages/monaco-editor-react/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
clearMocks: true,
coverageDirectory: '../coverage',
resetMocks: true,
restoreMocks: true,
rootDir: './src',
testEnvironment: 'jsdom',
preset: 'ts-jest'
};
Loading

0 comments on commit 10f56e4

Please sign in to comment.