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

feat: detect js workspaces #3

Merged
merged 3 commits into from
Mar 29, 2021
Merged

feat: detect js workspaces #3

merged 3 commits into from
Mar 29, 2021

Conversation

JGAntunes
Copy link
Contributor

This PR adds support to detect js-workspaces:

We're currently detecting 2 scenarios. The first one is if your project is actually building from a root workspaces project (not making use of the base property config). The second scenario is if you're pointing to a project that is a workspace itself, with the root package.json present in the root of the repo.

I've opted for using the map-workspaces project from npm, as it provides the paths for the workspaces out of the box and handles the glob expansion. Even though we're not planning to use the paths right away I figured it's a useful bit of info that we're probably going to rely on a near future. Also added a flag to distinguish if a project is pointing to the workspaces root, or is actually a workspace itself.

@JGAntunes JGAntunes changed the title Feat/detect js workspaces feat: detect js workspaces Mar 26, 2021
@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Mar 26, 2021
@JGAntunes JGAntunes self-assigned this Mar 26, 2021
Copy link
Member

@eduardoboucas eduardoboucas left a comment

Choose a reason for hiding this comment

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

LGTM!

return {}
}

const buildInfo = async function (context) {
Copy link
Member

Choose a reason for hiding this comment

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

[sand] Am I right in thinking that this function exists because in the future buildInfo may return more data, which it will collect from functions other than getWorkspaceInfo. If so, would it make sense for getWorkspaceInfo to return just the data (e.g. return { isRoot, packages }) and let buildInfo be in charge of defining the keys it exposes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point 👍 addressed via 27af306

@JGAntunes JGAntunes force-pushed the feat/detect-js-workspaces branch from 4a8a7be to 62ea544 Compare March 29, 2021 10:49
@JGAntunes JGAntunes requested a review from a team as a code owner March 29, 2021 10:49
@JGAntunes JGAntunes force-pushed the feat/detect-js-workspaces branch 2 times, most recently from 9c3cf68 to baa1e00 Compare March 29, 2021 11:34
@JGAntunes JGAntunes enabled auto-merge (squash) March 29, 2021 11:35
@JGAntunes JGAntunes disabled auto-merge March 29, 2021 11:35
@JGAntunes JGAntunes force-pushed the feat/detect-js-workspaces branch from baa1e00 to c46f488 Compare March 29, 2021 12:11
@JGAntunes JGAntunes enabled auto-merge (squash) March 29, 2021 12:13
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

Successfully merging this pull request may close these issues.

2 participants