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

Conversation

timostamm
Copy link
Member

@timostamm timostamm commented Aug 29, 2024

turborepo gives us more control over running tasks in a monorepo, and it caches quite nicely.

For example, when a task is run from a package directory, all its prerequisites run automatically:

cd packages/connect-web
npx turbo run test

Closes #798.

Signed-off-by: Timo Stamm <ts@timostamm.de>
And task name in fix ci.yaml

And fix Node version in workflows

Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
Signed-off-by: Timo Stamm <ts@timostamm.de>
…h the task "conformance"

Signed-off-by: Timo Stamm <ts@timostamm.de>
…h the task "conformance"

Signed-off-by: Timo Stamm <ts@timostamm.de>
@@ -32,7 +32,7 @@ export function replaceDependencies(
): PackageJson | null {
const modifiedPackageNames = new Set<string>();
const replacedPackageNames = new Map<string, string>();
const copy = structuredClone(pkg) as PackageJson;
const copy = clonePackageJson(pkg);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed when running tests in a matrix:

structuredClone is not available in Node.js 16, but the package advertises compatibility. This fixes the issue.

Comment on lines 13 to 18
"conformance": {
"dependsOn": [
"conformance:node:promise",
"conformance:node:callback"
]
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the task "conformance", we run tests for @connectrpc/connect-web only on Node.js. Since browsers may not be available on the developer's machine, it seems more friendly to make this an opt in.

In effect, npm run all will run everything but tests on browsers, browserstack, and cloudflare.

@timostamm timostamm requested a review from smaye81 August 30, 2024 13:07
@timostamm timostamm marked this pull request as ready for review August 30, 2024 13:07
Comment on lines +147 to +156
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "npm"
- uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}/test/${{ github.sha }}
restore-keys: ${{ runner.os }}/test
- run: npm ci
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block seems to be repeated, we can use a composite action instead an use that as a single step.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but a composite action is only 20 lines shorter overall. Switched to a matrix instead in 225881e.

Signed-off-by: Timo Stamm <ts@timostamm.de>
@timostamm timostamm merged commit 56f07b6 into main Sep 3, 2024
41 checks passed
@timostamm timostamm deleted the tstamm/replace-make-with-turbo branch September 3, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Makefile with turborepo
2 participants