Skip to content

Commit

Permalink
Writing #68: guide documents again
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed May 6, 2024
1 parent 9f23125 commit 8c7a10b
Show file tree
Hide file tree
Showing 83 changed files with 3,300 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
},
"[mdx]": {
"editor.wordWrap": "on"
}
}
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"url": "https://github.com/samchon"
},
"scripts": {
"api": "typedoc src --excludeNotDocumented -out ../tgrid.com/docs/api",
"build": "npm run build:main && npm run build:test",
"build:main": "rimraf lib && tsc && rollup -c",
"build:test": "rimraf bin && tsc --project test/tsconfig.json",
Expand Down Expand Up @@ -56,7 +55,6 @@
"ts-node": "^10.9.2",
"ts-patch": "^3.1.2",
"tslib": "^2.6.2",
"typedoc": "^0.25.12",
"typescript": "^5.4.3",
"typescript-transform-paths": "^3.4.7",
"whatwg-fetch": "^3.6.2"
Expand Down
2 changes: 2 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.next
node_modules/
1 change: 1 addition & 0 deletions website/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
27 changes: 27 additions & 0 deletions website/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"editor.tabSize": 2,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
},
"[mdx]": {
"editor.wordWrap": "on"
}
}
18 changes: 18 additions & 0 deletions website/build/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const cp = require("child_process");
const deploy = require("gh-pages");

cp.execSync("npm run build", { stdio: "inherit" });

deploy.publish(
"out",
{
branch: "gh-pages",
dotfiles: true,
},
(err) => {
if (err) {
console.log(err);
process.exit(-1);
} else clear();
},
);
Binary file added website/diagrams/sequences.vsdx
Binary file not shown.
5 changes: 5 additions & 0 deletions website/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
5 changes: 5 additions & 0 deletions website/next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: 'https://typia.io',
generateRobotsTxt: true,
};
20 changes: 20 additions & 0 deletions website/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx",
});

/** @type {import('next').NextConfig} */
const config = {
...withNextra(),
exportTrailingSlash: true,
images: {
unoptimized: true,
},
rewrites: async () => [
{
source: "/api",
destination: "/api/index.html",
},
],
};
module.exports = config;
58 changes: 58 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "typia.io",
"version": "0.1.0",
"description": "Typia Guide Documents",
"private": true,
"scripts": {
"build": "rimraf .next && rimraf out && typedoc && next build && next export && next-sitemap",
"deploy": "node build/deploy",
"dev": "next dev",
"prepare": "typedoc"
},
"repository": {
"type": "git",
"url": "https://github.com/samchon/typia"
},
"author": "Jeongho Nam",
"license": "MIT",
"bugs": {
"url": "https://github.com/samchon/typia/issues"
},
"dependencies": {
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@monaco-editor/react": "^4.5.1",
"@mui/icons-material": "^5.15.4",
"@mui/material": "^5.12.0",
"@rollup/browser": "^4.13.0",
"lz-string": "^1.5.0",
"monaco-editor": "^0.39.0",
"next": "^13.0.6",
"nextra": "latest",
"nextra-theme-docs": "latest",
"path": "^0.12.7",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tgrid": "^0.10.2",
"tstl": "^3.0.0",
"typescript": "^5.4.5",
"typia": "^6.0.3"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/node": "^18.11.10",
"@types/prettier": "^3.0.0",
"@types/react": "^18.0.35",
"gh-pages": "^5.0.0",
"next-sitemap": "^4.0.7",
"process": "^0.11.10",
"rimraf": "^5.0.0",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.1",
"typedoc": "^0.25.13",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4",
"write-file-webpack-plugin": "^4.5.1"
}
}
22 changes: 22 additions & 0 deletions website/pages/_app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Script from "next/script";

export default function Nextra({ Component, pageProps }) {
const getLayout = Component.getLayout || ((page) => page);
return (
<>
<Script
type="text/javascript"
dangerouslySetInnerHTML={{
__html: `
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "gqhymojzmp");
`,
}}
/>
{getLayout(<Component {...pageProps} />)}
</>
);
}
15 changes: 15 additions & 0 deletions website/pages/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"index": {
"title": "Introduction",
"type": "page",
"hidden": true,
"display": "hidden",
"theme": {
"layout": "full"
}
},
"docs": {
"title": "📖 Guide Documents",
"type": "page"
}
}
20 changes: 20 additions & 0 deletions website/pages/docs/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"index": "🙋🏻‍♂️ Introduction",
"setup": "📦 Setup",
"-- tutorial": {
"type": "separator",
"title": "📖 Tutorial"
},
"features": "Features",
"examples": "Learn from Examples",
"projects": "Learn from Projects",
"-- appendix": {
"type": "separator",
"title": "🔗 Appendix"
},
"api": {
"title": "API Documents",
"href": "/api",
"newWindow": true
}
}
6 changes: 6 additions & 0 deletions website/pages/docs/examples/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"remote-function-call": "Remoteb Function Call",
"remote-object-call": "Remote Object Call",
"object-oriented-network": "Object Oriented Network",
"nestjs": "NestJS WebSocket"
}
Empty file.
Empty file.
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions website/pages/docs/features/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"components": "Components",
"worker": "Worker Protocol",
"websocket": "WebSocket Protocol",
"nestjs": "NestJS WebSocket"
}
49 changes: 49 additions & 0 deletions website/pages/docs/features/components.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Tabs, Tab } from 'nextra-theme-docs'
import Alert from '@mui/material/Alert';
import AlertTitle from '@mui/material/AlertTitle';

![Sequence Diagram](/images/diagrams/sequence.png)

## Communicator
Communicates with a remote system.

`Communicator` is a class taking full responsibility to network communication with remote system. You can register a Provider, an object would be provided to the remote system, to the `Communicator`. Also, [Driver](#driver)\<[Listener](#listener)\>, which can access to the remote system's [Provider](#provider), is created by this `Communicator`.

For reference, actual `Communicator` is the top-level abstract class, and all the classes responsible for network communication in `TGrid` are inheriting from this `Communicator` class. Here is the list of every communicator classes in `TGrid`.

- [WebSocketConnector](./websocket#websocketconnector)
- [WebSocketAcceptor](./websocket#websocketacceptor)
- [SharedWorkerAcceptor](./worker#sharedworkeracceptor)
- [SharedWorkerConnector](./worker#sharedworkerconnector)
- [WorkerConnector](./worker#workerconnector)
- [WorkerServer](./worker#workerserver)




## Provider
Object provided for remote system.

`Provider` is an object provided for the remote system.

The remote system can call the `Provider`'s functions through [Driver](#driver)\<[Listener](#listener)\>.




## Listener
Interface of the remote system's [Provider](#provider).

`Listener` is a type definition (interface is recommended) of the remote system's [Provider](#provider). If you wrap the `Listener` type into the [Driver](#driver)\<`Listener`\> through `Communicator.getDriver<Listener>()` method, you can call the functions of the remote system's [Provider](#provider) asynchronously.

For reference, it is possible to using the original [Provider](#provider) type of the remote system, so that composing [Driver](#driver)\<[Provider](#provider)\> type. However, such way is not recommended due to the dependency problem. Instead, consider to defining the [Provider](#provider) class to implement the `Listener` interface type.




## Driver
Driver of Listener for RPC (Remote Procedure Call).

`Driver` is a proxy instance designed to call functions of the remote system. It has a generic argument [Listener](#listener) which means the type of remote system's [Provider](#provider), and you can remotely call the functions of the [Listener](#listener) asynchronously through the `Drive<Listener>` instance.

When you call some function of [Listener](#listener) by the `Driver<Listener>` instance, it hooks the function call expression, and delivers the function name and arguments to the remote system through the [Communicator](#communicator). When the remote system replies the result of the function call, [Communicator](#communicator) `Driver<Listener>` resolves the promise of the function call expression with the result.
Empty file.
5 changes: 5 additions & 0 deletions website/pages/docs/features/websocket.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## WebSocketServer

## WebSocketAcceptor

## WebSocketConnector
Empty file.
Empty file added website/pages/docs/index.mdx
Empty file.
4 changes: 4 additions & 0 deletions website/pages/docs/projects/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"chat": "Chat Application",
"market": "Grid Market"
}
Empty file.
Empty file.
Empty file added website/pages/index.mdx
Empty file.
10 changes: 10 additions & 0 deletions website/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
printWidth: 80,
semi: true,
tabWidth: 2,
trailingComma: "all",
importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
// importOrderParserPlugins: ["decorators-legacy", "typescript", "jsx"],
};
1 change: 1 addition & 0 deletions website/public/api/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
Loading

0 comments on commit 8c7a10b

Please sign in to comment.