-
Notifications
You must be signed in to change notification settings - Fork 58
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
V2: Replace Makefile with turborepo #900
Conversation
By default, all files in source control in the Workspace root are included in the global hash. See https://turbo.build/repo/docs/reference/configuration#globaldependencies
"./packages/protobuf-example", | ||
"./packages/upstream-protobuf", | ||
"./packages/typescript-compat/*" | ||
"packages/protobuf", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be necessary, filed vercel/turbo#8599. It's a harmless change though, and works well enough as a workaround.
"format": "prettier --write --ignore-unknown '.' '!src/gen/**' '!.turbo'", | ||
"license-header": "license-header", | ||
"lint": "eslint --max-warnings 0 ." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tools like prettier are better run for each package individually with turborepo so that it can cache properly.
}, | ||
"dependencies": { | ||
"@bufbuild/buf": "^1.29.0", | ||
"@bufbuild/protobuf": "2.0.0-beta.1", | ||
"@bufbuild/protoplugin": "2.0.0-beta.1", | ||
"@bufbuild/protoc-gen-es": "2.0.0-beta.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependencies replace make prerequisites along with the task dependencies in turbo.json.
md += `|-----------------|----------|------------------------:|-----------------------:|-------------------:|\n`; | ||
for (const row of rows) { | ||
md += `| ${row.name} | ${row.files} | ${formatBytes(row.size)} | ${formatBytes(row.minified)} | ${formatBytes(row.compressed)} |\n`; | ||
export function generateMarkdownTable(rows: Row[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since prettier now runs on markdown, I've updated this code to generate formatted markdown, so that we don't get flip-flopping state.
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"extends": ["//"], | ||
"tasks": { | ||
"bundle-size": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For tasks specific to a package, it seems most understandable to let it extend turbo.json.
import { | ||
create, | ||
isFieldSet, | ||
isMessage, | ||
protoInt64, | ||
type MessageInitShape, | ||
type DescMessage, | ||
} from "@bufbuild/protobuf"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new linter config does not allow importing twice from the same source.
import { execSync } from "node:child_process"; | ||
import { stdout, stderr, exit } from "node:process"; | ||
|
||
const typescriptCompatDir = new URL(".", import.meta.url).pathname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script is replaced with the command turbo run test -F './packages/typescript-compat/*'
.
* Publish protobuf-es | ||
* | ||
* Recommended procedure: | ||
* 1. Set a new version with `npm run setversion 1.2.3` | ||
* 2. Commit and push all changes to a PR, wait for approval. | ||
* 3. Login with `npm login` | ||
* 4. Publish to npmjs.com with `npm run release` | ||
* 5. Merge PR and create a release on GitHub | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm run release
replaces make release
.
npm run setversion 1.2.3
replaces make setversion SET_VERSION=1.2.3
We never have to specify --declarationDir, declarations are already written to the expected location. We can move --declaration to tsconfig.base.json.
e60d635
to
e70447b
Compare
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:
Large parts of the setup were taken from connect-playwright-es and adjusted where necessary. CI was split into several jobs and should run in 2 minutes or less.