From d230841a9d3ced58194e934afca385e5ae89137f Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 3 Mar 2021 12:02:15 +1300 Subject: [PATCH] Bump to v2.0.0 It's at a state where it's stable release now. --- docs/docs/middleware/custom.md | 2 +- docs/docs/middleware/logger.md | 6 + docs/docs/middleware/typecheck.md | 33 +++- docs/docusaurus.config.js | 254 +++++++++++++++--------------- docs/package.json | 4 +- docs/sidebars.json | 85 +++++----- package.json | 5 +- 7 files changed, 213 insertions(+), 176 deletions(-) create mode 100644 docs/docs/middleware/logger.md diff --git a/docs/docs/middleware/custom.md b/docs/docs/middleware/custom.md index 6459e574..ba5ca629 100644 --- a/docs/docs/middleware/custom.md +++ b/docs/docs/middleware/custom.md @@ -1,6 +1,6 @@ --- id: custom title: Writing custom middleware -sidebar_label: Writing your own Middleware* +sidebar_label: Write your own slug: /middleware/custom --- \ No newline at end of file diff --git a/docs/docs/middleware/logger.md b/docs/docs/middleware/logger.md new file mode 100644 index 00000000..a0540b0a --- /dev/null +++ b/docs/docs/middleware/logger.md @@ -0,0 +1,6 @@ +--- +id: logging +title: Logging +sidebar_label: Logging +slug: /middleware/logging +--- \ No newline at end of file diff --git a/docs/docs/middleware/typecheck.md b/docs/docs/middleware/typecheck.md index e26798bd..46623d83 100644 --- a/docs/docs/middleware/typecheck.md +++ b/docs/docs/middleware/typecheck.md @@ -1,6 +1,35 @@ --- id: typecheck title: Runtime Type Checking -sidebar_label: Runtime Type Checker* +sidebar_label: Enforcing types at runtime slug: /middleware/types ---- \ No newline at end of file +--- +import Code, { DEFAULT_VALUE, GROUP, TABS } from '@site/src/components/Code' +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +It's important when you recieve events or calls from the server that you ensure the types are correct, otherwise unwanted errors may pop up. + +If you want to ensure the types you're recieving from the client _are_ the types you're expecting, you can use the [`Net.Middleware.TypeChecking`](../api/middleware#typechecking) middleware. + +This middleware just takes type checking functions. + +## Using a library like `t` + +The rate limiter middleware is created as such: + + + + +```ts +Net.Middleware.TypeCheck(t.string) +``` + + + +```lua +Net.Middleware.TypeCheck(t.string) +``` + + + \ No newline at end of file diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 8e3d83c4..69f1e6fd 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -1,127 +1,127 @@ -module.exports = { - title: "Roblox Networking", - tagline: "Advanced multi-language networking library for Roblox.", - url: "https://docs.vorlias.com/rbx-net", - baseUrl: "/rbx-net/", - onBrokenLinks: "throw", - onBrokenMarkdownLinks: "warn", - favicon: "img/favicon.ico", - organizationName: "roblox-aurora", // Usually your GitHub org/user name. - projectName: "rbx-net", // Usually your repo name. - themeConfig: { - colorMode: { - // defaultMode: "dark", - // disableSwitch: true, - respectPrefersColorScheme: true, - }, - prism: { - theme: require("prism-react-renderer/themes/vsDark"), - additionalLanguages: ["typescript", "lua", "powershell", "toml"], - }, - navbar: { - title: "Roblox Networking", - logo: { - alt: "RbxNet Logo", - src: "img/net2.svg", - srcDark: "img/net2-light.svg", - }, - items: [ - { - label: "Documentation", - type: "docsVersion", - }, - { - type: "docsVersionDropdown", - position: "right", - - // Add additional dropdown items at the beginning/end of the dropdown. - dropdownItemsBefore: [], - dropdownItemsAfter: [], - - // Do not add the link active class when browsing docs. - dropdownActiveClassDisabled: true, - }, - // { to: "docs/api", label: "API", position: "right" }, - { to: "blog", label: "Updates", position: "right" }, - { - href: "https://github.com/roblox-aurora/rbx-net", - label: "GitHub", - position: "right", - }, - ], - }, - footer: { - style: "dark", - links: [ - // { - // title: 'Docs', - // items: [ - // { - // label: 'Style Guide', - // to: 'docs/', - // }, - // { - // label: 'Second Doc', - // to: 'docs/doc2/', - // }, - // ], - // }, - // { - // title: 'Community', - // items: [ - // { - // label: 'Discord', - // href: 'https://discordapp.com/invite/docusaurus', - // }, - // ], - // }, - // { - // title: 'More', - // items: [ - // { - // label: 'Blog', - // to: 'blog', - // }, - // { - // label: 'GitHub', - // href: 'https://github.com/roblox-aurora/rbx-net', - // }, - // ], - // }, - ], - copyright: `Copyright © ${new Date().getFullYear()} Jonathan Holmes`, - }, - }, - presets: [ - [ - "@docusaurus/preset-classic", - { - docs: { - sidebarPath: require.resolve("./sidebars.json"), - lastVersion: "current", - versions: { - current: { - label: require("../package.json").version, - path: "2.0" - }, - "1.3.0": { - label: "1.3.0-beta.6.2", - path: "1.3.x", - }, - }, - // Please change this to your repo. - editUrl: "https://github.com/roblox-aurora/rbx-net/edit/main/docs/", - }, - blog: { - showReadingTime: true, - // Please change this to your repo. - editUrl: - "https://github.com/roblox-aurora/rbx-net/edit/main/docs/blog/", - }, - theme: { - customCss: require.resolve("./src/css/custom.css"), - }, - }, - ], - ], -}; +module.exports = { + title: "Roblox Networking", + tagline: "Advanced multi-language networking library for Roblox.", + url: "https://docs.vorlias.com/rbx-net", + baseUrl: "/rbx-net/", + onBrokenLinks: "throw", + onBrokenMarkdownLinks: "warn", + favicon: "img/favicon.ico", + organizationName: "roblox-aurora", // Usually your GitHub org/user name. + projectName: "rbx-net", // Usually your repo name. + themeConfig: { + colorMode: { + // defaultMode: "dark", + // disableSwitch: true, + respectPrefersColorScheme: true, + }, + prism: { + theme: require("prism-react-renderer/themes/vsDark"), + additionalLanguages: ["typescript", "lua", "powershell", "toml"], + }, + navbar: { + title: "Roblox Networking", + logo: { + alt: "RbxNet Logo", + src: "img/net2.svg", + srcDark: "img/net2-light.svg", + }, + items: [ + { + label: "Documentation", + type: "docsVersion", + }, + { + type: "docsVersionDropdown", + position: "right", + + // Add additional dropdown items at the beginning/end of the dropdown. + dropdownItemsBefore: [], + dropdownItemsAfter: [], + + // Do not add the link active class when browsing docs. + dropdownActiveClassDisabled: true, + }, + // { to: "docs/api", label: "API", position: "right" }, + { to: "blog", label: "Updates", position: "right" }, + { + href: "https://github.com/roblox-aurora/rbx-net", + label: "GitHub", + position: "right", + }, + ], + }, + footer: { + style: "dark", + links: [ + // { + // title: 'Docs', + // items: [ + // { + // label: 'Style Guide', + // to: 'docs/', + // }, + // { + // label: 'Second Doc', + // to: 'docs/doc2/', + // }, + // ], + // }, + // { + // title: 'Community', + // items: [ + // { + // label: 'Discord', + // href: 'https://discordapp.com/invite/docusaurus', + // }, + // ], + // }, + // { + // title: 'More', + // items: [ + // { + // label: 'Blog', + // to: 'blog', + // }, + // { + // label: 'GitHub', + // href: 'https://github.com/roblox-aurora/rbx-net', + // }, + // ], + // }, + ], + copyright: `Copyright © ${new Date().getFullYear()} Jonathan Holmes`, + }, + }, + presets: [ + [ + "@docusaurus/preset-classic", + { + docs: { + sidebarPath: require.resolve("./sidebars.json"), + lastVersion: "current", + versions: { + current: { + label: require("../package.json").version, + path: "2.0" + }, + "1.3.0": { + label: "1.3.0-beta.6.2", + path: "1.3.x", + }, + }, + // Please change this to your repo. + editUrl: "https://github.com/roblox-aurora/rbx-net/edit/main/docs/", + }, + blog: { + showReadingTime: true, + // Please change this to your repo. + editUrl: + "https://github.com/roblox-aurora/rbx-net/edit/main/docs/blog/", + }, + theme: { + customCss: require.resolve("./src/css/custom.css"), + }, + }, + ], + ], +}; diff --git a/docs/package.json b/docs/package.json index 1ea3e4d2..54a34a23 100644 --- a/docs/package.json +++ b/docs/package.json @@ -14,6 +14,8 @@ "dependencies": { "@docusaurus/core": "2.0.0-alpha.70", "@docusaurus/preset-classic": "2.0.0-alpha.70", + "@mdi/js": "^5.9.55", + "@mdi/react": "^1.4.0", "@mdx-js/react": "^1.6.21", "clsx": "^1.1.1", "react": "^16.8.4", @@ -31,4 +33,4 @@ "last 1 safari version" ] } -} \ No newline at end of file +} diff --git a/docs/sidebars.json b/docs/sidebars.json index 74d67b63..3674531b 100644 --- a/docs/sidebars.json +++ b/docs/sidebars.json @@ -1,43 +1,44 @@ -{ - "docs": [ - "introduction", - { - "type": "category", - "label": "Installation", - "items": [ - "install", - "install-luau" - ] - }, - { - "type": "category", - "label": "Guides", - "items": [ - "guides/basics", - "guides/definitions", - "guides/uuid", - "guides/custom-player-objects" - ] - }, - { - "type": "category", - "label": "Middleware (Advanced)", - "items": [ - "middleware/ratelimit", - "middleware/typecheck", - "middleware/custom" - ] - }, - { - "type": "category", - "label": "API", - "items": [ - "api/api", - "api/net.server", - "api/net.client", - "api/net.definitions", - "api/net.middleware" - ] - } - ] +{ + "docs": [ + "introduction", + { + "type": "category", + "label": "Installation", + "items": [ + "install", + "install-luau" + ] + }, + { + "type": "category", + "label": "Guides", + "items": [ + "guides/basics", + "guides/definitions", + "guides/uuid", + "guides/custom-player-objects" + ] + }, + { + "type": "category", + "label": "Middleware (Advanced)", + "items": [ + "middleware/ratelimit", + "middleware/typecheck", + "middleware/logging", + "middleware/custom" + ] + }, + { + "type": "category", + "label": "API", + "items": [ + "api/api", + "api/net.server", + "api/net.client", + "api/net.definitions", + "api/net.middleware" + ] + } + ] } \ No newline at end of file diff --git a/package.json b/package.json index 3d71ed4f..d429a2b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rbxts/net", - "version": "2.0.0-rc.4", + "version": "2.0.0", "description": "", "main": "out/init.lua", "scripts": { @@ -27,8 +27,7 @@ }, "homepage": "https://github.com/roblox-aurora/rbx-net#readme", "publishConfig": { - "access": "public", - "tag": "beta" + "access": "public" }, "types": "out/index.d.ts", "devDependencies": {