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

Replace Makefile with turborepo #1194

Merged
merged 36 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e7d612d
Replace Makefile with turborepo
timostamm Aug 29, 2024
ae2aa32
npx turbo run format
timostamm Aug 29, 2024
ea21176
Add protoc-gen-es to @connectrpc/connect-conformance dev deps
timostamm Aug 29, 2024
0532f59
Rename workflows
timostamm Aug 29, 2024
7f6169b
Test w/o safari
timostamm Aug 29, 2024
ef7ba4a
Re-add safari
timostamm Aug 29, 2024
cfd210f
Merge test.yaml into ci.yaml
timostamm Aug 29, 2024
e3a1ed2
Don't fail fast in matrix
timostamm Aug 29, 2024
9bf1dc1
Run safari on macos
timostamm Aug 29, 2024
532aed3
Set job timeouts
timostamm Aug 29, 2024
013b92d
Update lockfile
timostamm Aug 29, 2024
c3614ad
Add runner.os to all cache keys
timostamm Aug 29, 2024
71086e0
Fix ci.yaml test job names
timostamm Aug 29, 2024
436c2cd
Don't group turbo logs for long-running tasks
timostamm Aug 29, 2024
8048a53
Fix more ci.yaml test job names
timostamm Aug 29, 2024
8b527fa
Try node server closeAllConnections
timostamm Aug 29, 2024
29b3f69
Test node server
timostamm Aug 30, 2024
7ebb4ea
Test node server
timostamm Aug 30, 2024
ca48a12
Test node server
timostamm Aug 30, 2024
5c6d118
Test node server
timostamm Aug 30, 2024
cc4cd33
Test node server
timostamm Aug 30, 2024
7ed0063
Test node server
timostamm Aug 30, 2024
167723a
Update other servers
timostamm Aug 30, 2024
462c356
Directly call client / servers under test with tsx
timostamm Aug 30, 2024
c6bdfb2
Remove workflow step names
timostamm Aug 30, 2024
fe5cf1f
Shorter task names
timostamm Aug 30, 2024
eed003b
Shorter task names v2
timostamm Aug 30, 2024
bde21ef
Shorter task names v3
timostamm Aug 30, 2024
f71883e
Use actions/setup-node npm cache
timostamm Aug 30, 2024
bb82b5c
Checkout before actions/setup-node
timostamm Aug 30, 2024
9f4fb8f
turbo run format
timostamm Aug 30, 2024
8a950a7
words
timostamm Aug 30, 2024
d725a6c
Only run conformance tests for @connectrpc/connect-web on Node.js wit…
timostamm Aug 30, 2024
6a3b001
Only run conformance tests for @connectrpc/connect-web on Node.js wit…
timostamm Aug 30, 2024
225881e
matrix ci.yaml
timostamm Sep 2, 2024
3093ff6
Merge remote-tracking branch 'origin/main' into tstamm/replace-make-w…
timostamm Sep 2, 2024
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
102 changes: 39 additions & 63 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,77 +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",
// TS 4.5 adds type modifiers on import names, but we want to support lower versions
"import/consistent-type-specifier-style": [
"error",
"prefer-top-level",
],
{
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 @@ -106,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 and the linters pass:

```bash
npx turbo run test lint
```

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]
tags: ['v*']
branches: [main, "v*"]
tags: ["v*"]
pull_request:
branches: [main]
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