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

feat(unstable): Workspaces support #20410

Merged
merged 39 commits into from Nov 17, 2023

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Sep 8, 2023

This commit adds unstable workspace support. This is extremely bare-bones and
minimal first-pass at this.

With this change deno.json supports specifying workspaces key, that
accepts a list of subdirectories. Each workspace can have its own import map.
It's required to specify a "name" and "version" properties in the configuration
file for the workspace:

// deno.json
{
  "workspaces": [
     "a",
     "b"
  },
  "imports": {
    "express": "npm:express@5"
   }
}
// a/deno.json
{
  "name": "a",
  "version": "1.0.2",
  "imports": {
    "kleur": "npm:kleur"
  }
}
// b/deno.json
{
  "name": "b",
  "version": "0.51.0",
  "imports": {
    "chalk": "npm:chalk"
  }
}

--unstable-workspaces flag is required to use this feature:

$ deno run --unstable-workspaces mod.ts

@mindreframer
Copy link

mindreframer commented Oct 1, 2023

This PR looks very promising! I'm currently fighting mono-repo issues and the thing that kinda messes with it is the missing support for multiple deno.json config files.

Are there bigger blockers preventing this PR from a merge to the main branch? Would love to try it out in the near future.

@mdluo
Copy link

mdluo commented Nov 1, 2023

Nice work @bartlomieju! Is it still WIP?

@dsherret dsherret marked this pull request as draft November 10, 2023 20:24
@bartlomieju
Copy link
Member Author

Nice work @bartlomieju! Is it still WIP?

Yes, it's still a WIP, but we aim to land it before EOY.

@bartlomieju bartlomieju marked this pull request as ready for review November 16, 2023 01:17
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

It's looking good, but let's add some tests for some more error cases.

cli/args/mod.rs Outdated Show resolved Hide resolved
cli/graph_util.rs Outdated Show resolved Hide resolved
cli/graph_util.rs Show resolved Hide resolved
cli/graph_util.rs Show resolved Hide resolved
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

LGTM. Exciting!

@bartlomieju bartlomieju enabled auto-merge (squash) November 17, 2023 00:42
@bartlomieju bartlomieju merged commit 9534e6e into denoland:main Nov 17, 2023
13 checks passed
@bartlomieju bartlomieju deleted the workspace_support branch November 17, 2023 01:29
kt3k pushed a commit that referenced this pull request Nov 17, 2023
This commit adds unstable workspace support. This is extremely
bare-bones and
minimal first-pass at this.

With this change `deno.json` supports specifying `workspaces` key, that
accepts a list of subdirectories. Each workspace can have its own import
map. It's required to specify a `"name"` and `"version"` properties in the
configuration file for the workspace:

```jsonc
// deno.json
{
  "workspaces": [
     "a",
     "b"
  },
  "imports": {
    "express": "npm:express@5"
   }
}
```
``` jsonc
// a/deno.json
{
  "name": "a",
  "version": "1.0.2",
  "imports": {
    "kleur": "npm:kleur"
  }
}
```
```jsonc
// b/deno.json
{
  "name": "b",
  "version": "0.51.0",
  "imports": {
    "chalk": "npm:chalk"
  }
}
```

`--unstable-workspaces` flag is required to use this feature:
```
$ deno run --unstable-workspaces mod.ts
```

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
zifeo pushed a commit to metatypedev/deno that referenced this pull request Nov 22, 2023
This commit adds unstable workspace support. This is extremely
bare-bones and
minimal first-pass at this.

With this change `deno.json` supports specifying `workspaces` key, that
accepts a list of subdirectories. Each workspace can have its own import
map. It's required to specify a `"name"` and `"version"` properties in the
configuration file for the workspace:

```jsonc
// deno.json
{
  "workspaces": [
     "a",
     "b"
  },
  "imports": {
    "express": "npm:express@5"
   }
}
```
``` jsonc
// a/deno.json
{
  "name": "a",
  "version": "1.0.2",
  "imports": {
    "kleur": "npm:kleur"
  }
}
```
```jsonc
// b/deno.json
{
  "name": "b",
  "version": "0.51.0",
  "imports": {
    "chalk": "npm:chalk"
  }
}
```

`--unstable-workspaces` flag is required to use this feature:
```
$ deno run --unstable-workspaces mod.ts
```

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
@igl
Copy link

igl commented Jan 3, 2024

Nice @bartlomieju! I Just tested this and it's exactly what i want for a Monorepo.

But the LSP does not seem to understand how to resolve the imports correctly yet and I have squiggly lines under my imports from the import_maps in vs-code. Is this something being worked on?

@bartlomieju
Copy link
Member Author

@igl could you open a new issue with some reproduction code for your use case? I think this is an outright bug that needs to be squashed.

@igl
Copy link

igl commented Jan 3, 2024

@igl could you open a new issue with some reproduction code for your use case? I think this is an outright bug that needs to be squashed.

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.

None yet

5 participants