Skip to content

Commit

Permalink
chore: upgrade to turbo v2 (#6926)
Browse files Browse the repository at this point in the history
Closes #6636

Most notable change: Can no longer omit package scope for task filters. 

e.g.

`turbo test -F wingc`

must instead be 

`turbo test -F @winglang/wingc`

Docs were updated to reflect this. As part of this update, the docs now emphasize usage of turbo as a global tool and show `pnpm turbo` as an alternative option. imo this is the ideal usage because turbo is smart enough to use the local version instead, so there's no worrying about global version mismatches.

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
MarkMcCulloh authored Jul 22, 2024
1 parent c94661c commit effd698
Show file tree
Hide file tree
Showing 34 changed files with 110 additions and 125 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"inputs": ["lib/**"],
"outputs": [".jsii"]
Expand Down
2 changes: 1 addition & 1 deletion apps/jsii-docgen/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"outputs": ["lib/**"]
},
Expand Down
2 changes: 1 addition & 1 deletion apps/vscode-wing/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"outputs": ["lib/**"]
},
Expand Down
2 changes: 1 addition & 1 deletion apps/wing-api-checker/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"outputs": ["lib/**"]
}
Expand Down
2 changes: 1 addition & 1 deletion apps/wing-console/console/app/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"dev": {
"dependsOn": ["^compile"]
},
Expand Down
2 changes: 1 addition & 1 deletion apps/wing-console/console/design-system/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"outputs": ["dist/**"]
},
Expand Down
2 changes: 1 addition & 1 deletion apps/wing-console/console/server/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"outputs": ["dist/**"]
},
Expand Down
2 changes: 1 addition & 1 deletion apps/wing-console/console/ui/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"outputs": ["dist/**"]
},
Expand Down
2 changes: 1 addition & 1 deletion apps/wing/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"test": {
"dependsOn": ["^compile", "examples-valid#topo"]
},
Expand Down
15 changes: 7 additions & 8 deletions apps/wingcli-v2/turbo.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"compile": {},
"test": {
"dependsOn": ["@winglang/sdk#compile"]
}
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"tasks": {
"compile": {},
"test": {
"dependsOn": ["@winglang/sdk#compile"]
}
}
}
38 changes: 18 additions & 20 deletions docs/contributing/01-start-here/05-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,17 @@ cd wing
pnpm install
```


:::note Turbo Commands
[Turbo] commands in this document are structured as

```sh
pnpm turbo <task>
turbo <task>
# or
pnpm turbo <task> --filter=<project> -- <args>
turbo <task> -F <project> -- <args>
```

- `pnpm` can be omitted if [Turbo] is installed globally
- `--filter=<project>` may be used to filter to a specific project (and it's dependencies)
- `pnpm turbo` can be used instead if [Turbo] is not installed globally
- `-F <project>` may be used to filter to a specific project (and it's dependencies)
- Running `turbo <task>` inside of a project directory will automatically filter to that project
- We use [Turbo caching](https://turbo.build/repo/docs/core-concepts/caching) to speed up builds. If you want to force a rebuild, use `--force`.

Expand Down Expand Up @@ -104,10 +103,9 @@ export RUST_BACKTRACE=full
Or if you just want to compile your changes and run a local version of the Wing CLI:

```sh
pnpm compile --filter=winglang
turbo compile -F winglang
```


Now, you can edit a source file anywhere across the stack and run the compiler with arguments.
For example:

Expand Down Expand Up @@ -149,10 +147,10 @@ wing](#-how-do-i-build-wing).
To run the tests (and update snapshots), run the following command from anywhere in the monorepo:

```sh
pnpm turbo wing:e2e
turbo wing:e2e
```

(This is a helpful shortcut for `pnpm turbo test --filter=hangar`)
(This is a helpful shortcut for `turbo test -F hangar`)

### Test Meta-Comments

Expand All @@ -178,10 +176,10 @@ This is useful if, for example, the test requires docker. In our CI only linux s
Benchmark files are located in `examples/tests/valid/benchmarks`. To run the benchmarks, run the following command from anywhere in the monorepo:

```sh
pnpm turbo wing:bench
turbo wing:bench
```

(This is a helpful shortcut for `pnpm turbo bench --filter=hangar`)
(This is a helpful shortcut for `turbo bench -F hangar`)

In CI, if these benchmarks regress too far from the current `main` branch, the build will fail.

Expand All @@ -192,7 +190,7 @@ The following command runs the rust tests in wingc, including verification that
It will also make sure to update any snapshots.

```sh
pnpm turbo test --filter=wingc
turbo test -F @winglang/wingc
```

The following command runs `wingc` on a file. This performs all the compilation steps. Run from the root.
Expand All @@ -206,7 +204,7 @@ You can find the compilation artifacts in the `apps/wing/target` folder.
To check that your code passes all the lints, run:

```sh
pnpm turbo lint --filter=wingc
turbo lint -F @winglang/wingc
```

### Optional VSCode extensions for working on the compiler
Expand All @@ -227,20 +225,20 @@ Open the `.w` file you wish to debug compilation for (e.g. `${workspaceFolder}/e
After making changes to `grammar.js`, run:

```sh
pnpm turbo compile --filter=tree-sitter-wing
turbo compile -F @winglang/tree-sitter-wing
```

To run the grammar tests (that are located in the `test` folder):

```sh
pnpm turbo test --filter=tree-sitter-wing
turbo test -F @winglang/tree-sitter-wing
```

To use the wasm grammar to run a web-based playground where you can explore the AST and test out
highlight queries, run:

```sh
pnpm turbo playground --filter=tree-sitter-wing
turbo playground -F @winglang/tree-sitter-wing
```

## 🔨 How do I build the VSCode extension?
Expand All @@ -251,13 +249,13 @@ is located in the Wing CLI at `apps/wing/src/commands/lsp.ts`.
To compile the extension (also creates an installable `.vsix` file):

```sh
pnpm turbo compile --filter=vscode-wing
turbo compile -F vscode-wing
```

To run a new isolated VSCode instance with the extension installed:

```sh
pnpm turbo dev --filter=vscode-wing
turbo dev -F vscode-wing
```

To modify the package.json, make sure to edit `.projenrc.ts` and rebuild.
Expand All @@ -269,7 +267,7 @@ Tip: if you want to print debug messages in your code while developing, you shou
To lint Rust code, you can run the `lint` target on the `wingc` or `wingii` projects:

```sh
pnpm turbo lint --filter=wingc
turbo lint -F @winglang/wingc
```

It's also possible to lint by running `cargo clippy` directly.
Expand All @@ -288,4 +286,4 @@ Adding a new template is straightforward!
Each template is represented by a folder located at [project-templates](https://github.com/winglang/wing/tree/main/apps/wing/project-templates), containing all of the files that template should be initialized with.

Create a new folder with the template name, and insert any code files that are needed to run it.
Unit tests ran with `pnpm turbo test` (or in GitHub Actions once you make a pull request) will automatically validate that the template is valid.
Unit tests ran with `turbo test` (or in GitHub Actions once you make a pull request) will automatically validate that the template is valid.
2 changes: 1 addition & 1 deletion docs/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"inputs": [
"**/*.md"
Expand Down
13 changes: 4 additions & 9 deletions examples/jsii-fixture/turbo.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": [
"//"
],
"pipeline": {
"extends": ["//"],
"tasks": {
"compile": {
"outputs": [
".jsii",
"lib/**"
]
"outputs": [".jsii", "lib/**"]
}
}
}
}
2 changes: 1 addition & 1 deletion examples/tests/doc_examples/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"topo": {}
}
}
2 changes: 1 addition & 1 deletion examples/tests/error/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"topo": {}
}
}
2 changes: 1 addition & 1 deletion examples/tests/invalid/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"topo": {}
}
}
2 changes: 1 addition & 1 deletion examples/tests/sdk_tests/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"topo": {}
}
}
2 changes: 1 addition & 1 deletion examples/tests/valid/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"topo": {
"dependsOn": ["^topo", "jsii-fixture#compile"]
}
Expand Down
16 changes: 8 additions & 8 deletions examples/ts-fixture/turbo.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"compile": {
"outputs": ["src/target/**"]
},
"test": {}
}
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"tasks": {
"compile": {
"outputs": ["src/target/**"]
},
"test": {}
}
}
20 changes: 10 additions & 10 deletions examples/wing-fixture/turbo.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"pipeline": {
"compile": {
"dependsOn": ["^compile"],
"inputs": ["**/*.w", "**/*.js", "**/*.ts"],
"outputs": ["target/wing-fixture.wsim/**"]
},
"topo": {}
}
"$schema": "https://turborepo.org/schema.json",
"extends": ["//"],
"tasks": {
"compile": {
"dependsOn": ["^compile"],
"inputs": ["**/*.w", "**/*.js", "**/*.ts"],
"outputs": ["target/wing-fixture.wsim/**"]
},
"topo": {}
}
}
12 changes: 4 additions & 8 deletions libs/@wingcloud/framework/turbo.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": [
"//"
],
"pipeline": {
"extends": ["//"],
"tasks": {
"compile": {
"outputs": [
"dist/**"
]
"outputs": ["dist/**"]
},
"test": {},
"package": {
"outputs": ["../../../dist/wingcloud-framework-*.tgz"]
}
}
}
}
13 changes: 4 additions & 9 deletions libs/awscdk/turbo.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
{
"$schema": "https://turborepo.org/schema.json",
"extends": [
"//"
],
"pipeline": {
"extends": ["//"],
"tasks": {
"compile": {
"outputs": [
"dist/**",
"lib/**"
]
"outputs": ["dist/**", "lib/**"]
},
"test": {
"dependsOn": ["compile"]
Expand All @@ -18,4 +13,4 @@
"outputs": ["../../dist/winglang-platform-awscdk-*.tgz"]
}
}
}
}
Loading

0 comments on commit effd698

Please sign in to comment.