Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spruce up connectrpc.com #39

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2022-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
root: true,
ignorePatterns: ["build/**"],
extends: ["plugin:@docusaurus/recommended"],
rules: {
"@docusaurus/no-untranslated-text": [
"warn",
{ ignoredStrings: ["·", "—", "×"] },
],
},
};
32 changes: 32 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: ci
on:
pull_request:
branches: [main]
workflow_dispatch:
jobs:
ci:
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v3

- name: Cache
uses: actions/cache@v3
with:
path: |
~/.tmp
.tmp
key: ${{ runner.os }}-connectrpc-ci-${{ hashFiles('turbo.json') }}
restore-keys: |
${{ runner.os }}-connectrpc-ci-

- name: Install dependencies
run: npm ci

- name: Run CI
run: make ci

- name: Check Diff
id: checkdiff
run: |
[[ -z $(git status --porcelain | tee /dev/stderr) ]] || exit 1
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ build:
npm run build

.PHONY: lint
lint: npmlint npmchecktypes npmprose
lint: npmlint npmchecktypes

.PHONY: format
format:
Expand Down Expand Up @@ -35,7 +35,9 @@ npmlint:
npmchecktypes:
npm run check:types

.PHONY: npmprose
npmprose:
npm run prose
.PHONY: licenseheader
licenseheader:
npm run license-header

.PHONY: ci
ci: build fix lint licenseheader
16 changes: 15 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2022-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")]
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ still allowing your code to interoperate with the larger gRPC ecosystem.

### Why are numbers serialized as strings in JSON?

Javascript's `Number` is an IEEE 754 double-precision float: even though it
JavaScript's `Number` is an IEEE 754 double-precision float: even though it
occupies 64 bits of memory, some of the space is reserved for the fractional
portion of the number. There's just not enough space left to represent 64-bit
integers! To make absolutely sure that integers are handled correctly, the
Expand Down
2 changes: 1 addition & 1 deletion docs/go/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ Congratulations — you've built your first Connect service! 🎉
`grpc-go` clients will work with `connect-go` servers and vice versa without
issue - in fact, before `connect-go`'s public release, this is exactly what
the [Buf CLI][buf-cli] was doing.
- The gRPC-Web protocol used by [grpc/grpc-web][grpc-web], allowing
- The gRPC-Web protocol used by [gRPC/gRPC-Web][grpc-web], allowing
`connect-go` servers to interop with `grpc-web` frontends without the need
for an intermediary proxy (such as Envoy).
- The new [Connect protocol](../protocol.md), a simple, HTTP-based protocol that
Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Connect's own protocol.
validate our gRPC compatibility with an [extended version][connect-conformance]
of Google's own interoperability tests.
- Connect also offers direct support for the [gRPC-Web
protocol][grpcweb-protocol] used by [grpc/grpc-web][grpcweb], without relying
protocol][grpcweb-protocol] used by [gRPC/gRPC-Web][grpcweb], without relying
on a translating proxy like Envoy.
- Finally, Connect supports [its own protocol][connect-protocol]: a
straightforward HTTP-based protocol that works over HTTP/1.1 and HTTP/2. It
Expand Down
2 changes: 1 addition & 1 deletion docs/kotlin/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ response.error {
## Cancelation

Generated methods have the `suspend` keyword on the method signature which will cancel the underlying
request when the Kotlin Coroutine context is canceled.
request when the Kotlin coroutine context is canceled.

With the callback unary signature, the result is a canceling handler
to give control to the user to manually cancel a request:
Expand Down
6 changes: 3 additions & 3 deletions docs/kotlin/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
implementation "com.squareup.okhttp3:okhttp:4.10.0"
implementation "build.buf:connect-kotlin-okhttp:0.1.4"
// Javalite specific dependencies.
// JavaLite specific dependencies.
implementation "build.buf:connect-kotlin-google-javalite-ext:0.1.4"
implementation "com.google.protobuf:protobuf-javalite:3.22.0"
}
Expand Down Expand Up @@ -487,7 +487,7 @@ The required parameters are the host, serialization strategy, and protocol:

- `host`: The host of the request (e.g `https://buf.build`).
- `serializationStrategy`: Configures the `ProtocolClient` to use a specified base data type and encoding
(e.g., Google's Java and Google's Javalite).
(e.g., Google's Java and Google's JavaLite).
- `protocol`: The underlying network protocol to use (e.g., Connect, gRPC, or gRPC-Web).

To use alternative serialization strategies or protocols, the `ProtocolClientConfig` can be instantiated with different
Expand Down Expand Up @@ -652,7 +652,7 @@ There are more [detailed examples][more-examples] within
the Connect-Kotlin repository on GitHub. These examples demonstrate:

- Using [streaming APIs][streaming-example-kotlin].
- Integrating with [Google's Java][pgjava-example] and [Javalite Protobuf][pgjavalite-example].
- Integrating with [Google's Java][pgjava-example] and [JavaLite Protobuf][pgjavalite-example].
- Using the [Connect protocol](../protocol.md).
- Using the [gRPC protocol][grpc].
- Using the [gRPC-Web protocol][grpc-web].
Expand Down
8 changes: 4 additions & 4 deletions docs/node/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ or [Fastify](https://www.fastify.io/). We are going to use Fastify here.
Let's install it, along with our plugin for Fastify:

```bash
$ npm install fastify @connectrpc/connect-node @connectrpc/connect-fastify
$ npm install fastify @connectrpc/connect-node @connectrpc/connect-fastify
```

Create a new file `server.ts` with the following contents:
Expand Down Expand Up @@ -265,8 +265,8 @@ void main();
On Node.js, we support three protocols:

- The gRPC protocol that is used throughout the gRPC ecosystem.
- The gRPC-Web protocol used by [grpc/grpc-web](https://github.com/grpc/grpc-web),
allowing servers to interop with `grpc-web` frontends without the need
- The gRPC-Web protocol used by [gRPC/gRPC-Web](https://github.com/grpc/grpc-web),
allowing servers to interop with `gRPC-Web` frontends without the need
for an intermediary proxy (such as Envoy).
- The new [Connect protocol](../protocol.md), a simple, HTTP-based protocol that
works over HTTP/1.1 or HTTP/2. It takes the best portions of gRPC and gRPC-Web,
Expand Down Expand Up @@ -331,7 +331,7 @@ void main();

That's it! After you restarted the server, you can still open
[https://localhost:8443/](https://localhost:8443/) in your browser, but along
with gRPC-web and Connect, any gRPC client can access it too. Here's an example
with gRPC-Web and Connect, any gRPC client can access it too. Here's an example
using `buf curl`:

```shell
Expand Down
6 changes: 3 additions & 3 deletions docs/web/query/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ Your Protobuf files serve as the primary input to the code generators `protoc-ge

## What is `Transport`?

`Transport` is a regular JavaScript object with two methods, `unary` and `serverStream`. See the definition in the Connect-Web codebase [here](https://github.com/connectrpc/connect-es/blob/main/packages/connect-web/src/transport.ts). `Transport` defines the mechanism by which the browser can call a gRPC-web or Connect backend. Read more about Transport on the [connect docs](https://connectrpc.com/docs/web/choosing-a-protocol).
`Transport` is a regular JavaScript object with two methods, `unary` and `serverStream`. See the definition in the Connect-Web codebase [here](https://github.com/connectrpc/connect-es/blob/main/packages/connect-web/src/transport.ts). `Transport` defines the mechanism by which the browser can call a gRPC-Web or Connect backend. Read more about Transport on the [connect docs](https://connectrpc.com/docs/web/choosing-a-protocol).

## What if I already use Connect-Web?

You can use Connect-Web and Connect-Query together if you like!

## What if I use gRPC-web?
## What if I use gRPC-Web?

Connect-Query also supports gRPC-web! All you need to do is make sure you call `createGrpcWebTransport` instead of `createConnectTransport`.
Connect-Query also supports gRPC-Web! All you need to do is make sure you call `createGrpcWebTransport` instead of `createConnectTransport`.

That said, we encourage you to check out the [Connect protocol](https://connectrpc.com/docs/protocol/), a simple, HTTP-based protocol that works over HTTP/1.1 or HTTP/2. It supports server-streaming methods just like gRPC-Web, but is easy to debug in the network inspector.

Expand Down
64 changes: 37 additions & 27 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2022-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// @ts-check
const lightCodeTheme = require("prism-react-renderer").themes.github;
const darkCodeTheme = require("prism-react-renderer").themes.dracula;
Expand All @@ -19,87 +33,83 @@ const config = {
src: "https://cdn.usefathom.com/script.js",
"data-site": "BWSMOXXQ",
"data-spa": "auto",
defer: true
}
defer: true,
},
],
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} **/
({
docs: {
sidebarPath: require.resolve("./sidebars.js")
sidebarPath: require.resolve("./sidebars.js"),
},
blog: {
showReadingTime: true
showReadingTime: true,
},
theme: {
customCss: require.resolve("./src/css/custom.css")
}
})
]
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
],
plugins: [
"@stackql/docusaurus-plugin-hubspot",
gaTrackingID !== ""
? [
"@docusaurus/plugin-google-gtag",
{
trackingID: gaTrackingID,
anonymizeIP: true
}
anonymizeIP: true,
},
]
: null
: null,
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
colorMode: {
// We can re-enable later if/when we have design assets
disableSwitch: true
disableSwitch: true,
},
algolia: {
appId: process.env.ALGOLIA_APP_ID || "none",
apiKey: process.env.ALGOLIA_API_KEY || "none",
indexName: process.env.ALGOLIA_INDEX_NAME || "none"
indexName: process.env.ALGOLIA_INDEX_NAME || "none",
},
navbar: {
title: "Connect",
logo: {
alt: "Connect logo",
src: "img/logos/simple-connect.svg"
src: "img/logos/simple-connect.svg",
},
items: [
{ to: "/docs/introduction", label: "Docs", position: "left" },
{
to: "https://github.com/connectrpc",
label: "GitHub",
position: "left"
position: "left",
},
{
to: "https://buf.build/blog",
label: "Blog",
position: "left"
to: "https://buf.build/links/slack",
label: "Slack",
position: "left",
},
{ to: "/demo", label: "Demo", position: "left" }
]
{ to: "/demo", label: "Demo", position: "left" },
],
},
footer: {
style: "dark",
links: [],
copyright: `Copyright © ${
new Date().getFullYear() != 2022 ? "2022–" : ""
}${new Date().getFullYear()} The Connect Authors`
}${new Date().getFullYear()} The Connect Authors`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ["kotlin", "protobuf", "swift"]
additionalLanguages: ["kotlin", "protobuf", "swift"],
},
hubspot: {
accountId: 8423972
}
})
}),
};

module.exports = config;
Loading
Loading