Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Add JS workspaces information #8

Closed
JGAntunes opened this issue Mar 1, 2021 · 3 comments
Closed

Add JS workspaces information #8

JGAntunes opened this issue Mar 1, 2021 · 3 comments
Assignees
Labels
init/monorepo-support proj/yarn-workspaces-caching theme/js-dependency-mgmt theme/monorepos type: feature code contributing to the implementation of a feature and/or user facing functionality

Comments

@JGAntunes
Copy link
Contributor

As a follow up for the discussion started in - netlify/build-image#526 - with netlify/build-image#526 (comment) CC @verythorough. Just wanted to capture it so that it doesn't get lost in the GitHub void 😄

Which problem is this feature request solving?
JS workspaces have become the de facto way to manage JS monorepo projects. For reference see:

As per @verythorough's comment, It could be instersting for our framework-info to pickup this information and convey it to our remaining systems.

Describe the solution you'd like

npm 7 makes use of the same worksapces field in the package.json as yarn did so far. This makes the package.json as the source of truth for this case, and I believe it makes sense for us to use that directly instead of relying in any cli to do so.

However, this isn't a trivial problem to solve. To illustrate it, consider the following project tree:

root-project/
├─ packages/
│  ├─ project-2/
│  │  ├─ package.json/
│  │  ├─ netlify.toml
│  ├─ project-1/
│  │  ├─ package.json/
│  │  ├─ netlify.toml
├─ package.json       // Root package.json, containing the `workspaces` entry

Usually framework-info is called with a project directory, for the case above it would be either project-1 or project-2. For us to have access to the workspace info, we would also need to provide the root directory of the project (if there's one or if it's different from the base directory) in order to access the root package.json and extract the required information. This would require framework-info to be able to receive that information and also to make tools such as the cli and buildbot to send the root directory of the project (something I believe netlify/config is already providing?)

Describe alternatives you've considered

Relying on cli's such as yarn to extract such data (e.g. https://github.com/netlify/build-image/pull/526/files#diff-6ad81dc23c4c92a6e6193db3b05e306293aa75ee25d48ae952c6259c601e8b23R115)

@ehmicky
Copy link
Contributor

ehmicky commented Mar 9, 2021

@JGAntunes
Copy link
Contributor Author

Potentially useful - https://github.com/npm/map-workspaces

@JGAntunes JGAntunes self-assigned this Mar 15, 2021
@erezrokah erezrokah transferred this issue from netlify/framework-info Mar 29, 2021
@erezrokah erezrokah added type: feature code contributing to the implementation of a feature and/or user facing functionality init/monorepo-support labels Mar 29, 2021
@JGAntunes
Copy link
Contributor Author

Addressed via #3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
init/monorepo-support proj/yarn-workspaces-caching theme/js-dependency-mgmt theme/monorepos type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

No branches or pull requests

3 participants