Skip to content

Commit

Permalink
V2: Merge main (#1223)
Browse files Browse the repository at this point in the history
---------
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Sri Krishna Paritala <skrishna@buf.build>
Co-authored-by: Timo Stamm <ts@timostamm.de>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
srikrsna-buf authored Sep 11, 2024
1 parent f8fd18c commit 232bb07
Show file tree
Hide file tree
Showing 113 changed files with 4,448 additions and 6,530 deletions.
97 changes: 39 additions & 58 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,62 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const { readdirSync, existsSync } = require("fs");
const { join } = require("path");

module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
root: true,
ignorePatterns: [
"packages/connect-web-bench/src/gen/grpcweb/**/*",
"packages/connect/src/protocol-grpc/gen/**/*",
"packages/connect-node-test/connect-node-h1-server.mjs", // https://github.com/eslint/eslint/issues/14156
"packages/example/www/webclient.js",
"packages/*/dist/**",
"node_modules/**",
// Our ESLint setup assumes all `.js` files are ESM, however these particular assets are CommonJS.
// Since for these files we cannot use `.cjs`, instead we override here to avoid having to override in each file
"packages/connect/*.js",
//
"packages/connect-web-bench/src/gen/grpcweb/**/*",
],
plugins: ["@typescript-eslint", "n", "import"],
// Rules and settings that do not require a non-default parser
extends: ["eslint:recommended"],
rules: {
"no-console": "error",
"import/no-cycle": "error",
"import/no-duplicates": "error",
},
settings: {},
overrides: [
...readdirSync("packages", { withFileTypes: true })
.filter((entry) => entry.isDirectory())
.map((entry) => join("packages", entry.name))
.filter((dir) => existsSync(join(dir, "tsconfig.json")))
.map((dir) => {
return {
files: [join(dir, "src/**/*.ts"), join(dir, "conformance/**/*.ts")],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: dir,
},
settings: {
"import/resolver": {
typescript: {
project: "packages/*/tsconfig.json",
},
},
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/recommended",
"plugin:import/typescript",
],
rules: {
"@typescript-eslint/strict-boolean-expressions": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
// we use complex typings, where Array is actually more readable than T[]
"@typescript-eslint/array-type": "off",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/no-unnecessary-boolean-literal-compare":
"error",
"@typescript-eslint/no-invalid-void-type": "error",
"@typescript-eslint/no-base-to-string": "error",
"import/no-cycle": "error",
"import/no-duplicates": "error",
{
files: ["**/*.{ts,tsx,cts,mts}"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
settings: {
"import/resolver": {
typescript: {
project: "tsconfig.json",
},
};
}),
},
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/recommended",
"plugin:import/typescript",
],
rules: {
"@typescript-eslint/strict-boolean-expressions": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/array-type": "off", // we use complex typings, where Array is actually more readable than T[]
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/no-invalid-void-type": "error",
"@typescript-eslint/no-base-to-string": "error",
"import/no-cycle": "error",
"import/no-duplicates": "error",
},
},
// For scripts and configurations, use Node.js rules
{
files: ["**/*.{js,mjs,cjs}"],
Expand All @@ -101,14 +91,5 @@ module.exports = {
"n/no-unsupported-features/es-syntax": "error",
},
},
{
// Our ESLint setup assumes all `.js` files are ESM, however these particular assets are CommonJS.
// Since for these files we cannot use `.cjs`, instead we override here to avoid having to override in each file
files: ["packages/connect/*.js"],
globals: {
module: "readonly",
require: "readonly",
},
},
],
};
23 changes: 16 additions & 7 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@ git remote add upstream https://github.com/connectrpc/connect-es.git
git fetch upstream
```

Make sure that the tests and the linters pass (you'll need Node.js in the
version specified in .nvmrc, `make`, `bash` and Docker installed):
Install dependencies (you'll need Node.js in the version specified in `.nvmrc`,
and `npm` in the version specified in `package.json`):

```bash
npm ci
```
make

Make sure that the tests, linters, and other checks pass:

```bash
npm run all
```

We're using `turborepo` to run tasks. If you haven't used it yet, take a look at
[filtering and package scoping](https://turbo.build/repo/docs/crafting-your-repository/running-tasks).

## Making Changes

Start by creating a new branch for your changes:
Expand All @@ -53,16 +62,16 @@ git push origin cool_new_feature

Then use the GitHub UI to open a pull request.

At this point, you're waiting on us to review your changes. We *try* to respond
At this point, you're waiting on us to review your changes. We _try_ to respond
to issues and pull requests within a few business days, and we may suggest some
improvements or alternatives. Once your changes are approved, one of the
project maintainers will merge them.

We're much more likely to approve your changes if you:

* Add tests for new functionality.
* Write a [good commit message][commit-message].
* Maintain backward compatibility.
- Add tests for new functionality.
- Write a [good commit message][commit-message].
- Maintain backward compatibility.

[fork]: https://github.com/connectrpc/connect-es/fork
[open-issue]: https://github.com/connectrpc/connect-es/issues/new
Expand Down
14 changes: 6 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
---
name: Bug report
about: Let us know about a bug
title: ''
title: ""
labels: bug
assignees: ''

assignees: ""
---

**Describe the bug**

As clearly as you can, please tell us what the bug is.


**To Reproduce**

If you encountered an error message, please copy and paste it verbatim.
If the bug is specific to an RPC or payload, please provide a reduced
example.


**Environment (please complete the following information):**

- @connectrpc/connect-web version: (for example, `0.1.0`)
- @connectrpc/connect-node version: (for example, `0.1.0`)
- Frontend framework and version: (for example, `react@18.2.0`)
- Node.js version: (for example, `18.0.0`)
- Browser and version: (for example, `Google Chrome 103.0.5060.134`)

If your problem is specific to bundling, please also provide the following information:
If your problem is specific to bundling, please also provide the following information:

- Bundler and version: (for example, `webpack@5.74.0`)
- Bundler plugins and version: (for example `compression-webpack-plugin@10.0.0`)
- Bundler configuration file:
- Bundler configuration file:

```js

```


**Additional context**
Add any other context about the problem here.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest a new feature or improvement
title: ''
title: ""
labels: enhancement
assignees: ''

assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
26 changes: 13 additions & 13 deletions .github/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
## Prerequisites

- See the setup and tools required in CONTRIBUTING.md
- A granular access token for npmjs.com with read and write permissions, scoped
to the `connectrpc` organization.
- Make sure that the repository is in a good state, without PRs close to merge
- A granular access token for npmjs.com with read and write permissions, scoped
to the `connectrpc` organization.
- Make sure that the repository is in a good state, without PRs close to merge
that would ideally be part of the release.

## Steps

1. Choose a new version (e.g. 1.2.3), making sure to follow semver. Note that all
1. Choose a new version (e.g. 1.2.3), making sure to follow semver. Note that all
packages in this repository use the same version number.
2. Make sure you are on the latest main, and create a new git branch.
3. Set the new version across all packages within the monorepo with the following
command: `make setversion SET_VERSION=1.2.3`
3. Set the new version across all packages within the monorepo with the following
command: `npm run setversion 1.2.3`
4. Commit, push, and open a pull request with the title "Release 1.2.3". The PR title must start with "Release" to trigger the conformance tests in CI. See the conformance tests [README](/packages/connect-conformance/README.md) for more details.
5. Edit the PR description with release notes. See the section below for details.
6. Make sure CI passed on your PR and ask a maintainer for review.
7. After approval, run the following command to publish to npmjs.com: `make release`.
7. After approval, run the following command to publish to npmjs.com: `npm run release`.
8. Merge your PR.
9. Create a new release in the GitHub UI
- Choose "v1.2.3" as a tag and as the release title.
Expand All @@ -27,19 +27,19 @@

## Release notes

- We generate release notes with the GitHub feature, see
- We generate release notes with the GitHub feature, see
https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
- Only changes that impact users should be listed. No need to list things like
- Only changes that impact users should be listed. No need to list things like
doc changes (unless it’s something major), dependency version bumps, or similar.
Remove them from the generated release notes.
- If the release introduces a major new feature or change, add a section at the
- If the release introduces a major new feature or change, add a section at the
top that explains it for users. A good example is https://github.com/connectrpc/connect-es/releases/tag/v0.10.0
It lists a major new feature and a major change with dedicated sections, and
It lists a major new feature and a major change with dedicated sections, and
moves the changelist with PR links to a separate "Enhancement" section below.
- If the release includes a very long list of changes, consider breaking the
- If the release includes a very long list of changes, consider breaking the
changelist up with the sections "Enhancements", "Bugfixes", "Breaking changes".
A good example is https://github.com/connectrpc/connect-es/releases/tag/v0.9.0
- If the release includes changes specific to a npm package, group and explain
- If the release includes changes specific to a npm package, group and explain
the changelist in according separate sections. A good example is https://github.com/connectrpc/connect-es/releases/tag/v0.8.0
Note that we are not using full package names with scope - a more user-friendly
name like "Connect for Node.js" or "Connect for Fastify" is preferable.
42 changes: 25 additions & 17 deletions .github/workflows/browserstack.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
name: browserstack
name: "Browserstack"

on:
push:
branches: [main, v2]
tags: ['v*']
branches: [main, "v*"]
tags: ["v*"]
pull_request:
branches: [main, v2]
branches: [main, "v*"]
workflow_dispatch:

permissions:
contents: read

env:
# https://consoledonottrack.com/
DO_NOT_TRACK: 1

jobs:
browserstack:
name: "Test @connectrpc/connect-web"
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: checkout
uses: actions/checkout@v4
- name: cache
uses: actions/cache@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- uses: actions/cache@v4
with:
path: |
~/.tmp
.tmp
key: ${{ runner.os }}-connect-web-browserstack-${{ hashFiles('Makefile') }}
restore-keys: |
${{ runner.os }}-connect-web-browserstack-
- name: browserstack
path: .turbo
key: ${{ runner.os }}/browserstack/${{ github.sha }}
restore-keys: ${{ runner.os }}/browserstack
- name: NPM Install
run: npm ci
- name: Browserstack
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: make testwebbrowserstack

run: npx turbo run test-browserstack --output-logs new-only --log-order stream
Loading

0 comments on commit 232bb07

Please sign in to comment.