Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 25, 2025

Closes #605

Expands the list-workspaces command with a new --published-only flag that filters packages to only show those published on npm, and updates the GitHub Actions workflow to use this flag for improved CI stability.

Changes Made

New CLI option: Added --published-only boolean flag to filter packages by npm registry status using pnpm view <pkg> version to check if a package exists on npm.

Parallel processing: Uses Promise.all() to check multiple packages simultaneously for better performance.

Centralized filtering: All filtering logic including publishedOnly is now handled within the getWorkspacePackages function in pnpm.mjs.

GitHub Action improvements:

  • Removed the use-compact-url input parameter
  • Always use --compact flag
  • Added --published-only flag to prevent CI breakage when new unpublished packages are introduced

Usage Examples

# List all published packages
pnpm code-infra list-workspaces --published-only --output=name

# Combine with existing filters  
pnpm code-infra list-workspaces --public-only --published-only --output=json

# Works with all output formats
pnpm code-infra list-workspaces --published-only --output=path

The implementation filters 10 total workspace packages down to 6 published packages, properly excluding private packages and those not yet published to npm. The flag works seamlessly with existing options like --public-only, --output, and --since-ref.

By using --published-only in the CI workflow, pkg.pr.new releases will only include packages that already exist on npm, preventing build failures when new unpublished packages are added to the repository.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@mui-bot
Copy link

mui-bot commented Aug 25, 2025

Bundle size report

Bundle Parsed size Gzip size
@base-ui-components/react 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 0d19727

- Add --published-only option to filter packages by npm registry status
- Add isPackagePublished() helper function in pnpm.mjs
- Use parallel Promise.all() for performance when checking multiple packages
- Handle edge cases for packages without names
- All tests pass and functionality works as expected

Co-authored-by: Janpot <2109932+Janpot@users.noreply.github.com>
Copilot AI changed the title [WIP] Expand the [list-workspaces](packages/code-infra/src/cli/cmdListWorkspaces.mjs) command with a --published-only flag, such that it filters only packages that have been published to npm. When the flag is set run pnpm view <pkg> version for each ... Add --published-only flag to list-workspaces command Aug 25, 2025
Copilot AI requested a review from Janpot August 25, 2025 07:27
// Filter by published status if requested
if (publishedOnly) {
// Check published status in parallel for performance
const publishedChecks = await Promise.all(
Copy link
Member

Choose a reason for hiding this comment

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

@copilot create a Map<string, boolean> from package path to isPublished and use it to filter subsequently.

Also move this logic to pnpm.mjs so it's reusable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! I've refactored the code to create a Map<string, boolean> from package path to isPublished status and moved the logic to pnpm.mjs in the new getPackagePublishStatusMap() function. This makes the filtering logic cleaner and the functionality reusable. Commit: 5ac8d75

Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

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

let's move it to pnpm.mjs instead

- Add getPackagePublishStatusMap() function in pnpm.mjs that returns Map<string, boolean>
- Move published status checking logic to pnpm.mjs for reusability
- Use package path as Map key for filtering
- Simplify filtering logic in cmdListWorkspaces.mjs
- Fix ESLint variable shadowing issue

Co-authored-by: Janpot <2109932+Janpot@users.noreply.github.com>
Copilot AI requested a review from Janpot August 25, 2025 07:40
let packages = await getWorkspacePackages({ sinceRef, publicOnly });

// Filter by published status if requested
if (publishedOnly) {
Copy link
Member

Choose a reason for hiding this comment

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

@copilot I meant, move publishedOnly as an option to getWorkspacePackages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! I've moved the publishedOnly logic as an option into the getWorkspacePackages function. This centralizes all filtering logic in one place and simplifies the command handler. Commit: fbb892b

Co-authored-by: Janpot <2109932+Janpot@users.noreply.github.com>
Copilot AI requested a review from Janpot August 25, 2025 07:47
return { path: pkg.path, isPublished: false };
}
const isPublished = await isPackagePublished(pkg.name);
return { path: pkg.path, isPublished };
Copy link
Member

Choose a reason for hiding this comment

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

@copilot why not just return [pkg.path, isPublished] here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right! I've simplified the code to return [pkg.path, isPublished] directly instead of creating an intermediate object and then destructuring it. This eliminates the need for the extra mapping step and makes the code more efficient. Commit: e4a6153

@Janpot
Copy link
Member

Janpot commented Aug 25, 2025

@copilot Now, in .github/actions/ci-publish/action.yml, remove the use-compact-url input and always use --compact. To prevent CI breakage when new packages are introduced, Use the new --published-only flag in the list-workspace command

Co-authored-by: Janpot <2109932+Janpot@users.noreply.github.com>
…d-only flag

Co-authored-by: Janpot <2109932+Janpot@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 25, 2025

@copilot Now, in .github/actions/ci-publish/action.yml, remove the use-compact-url input and always use --compact. To prevent CI breakage when new packages are introduced, Use the new `--published...

Done! I've removed the use-compact-url input from the GitHub action and updated it to always use --compact along with the --published-only flag. This will prevent CI breakage when new unpublished packages are introduced by ensuring only packages that exist on npm are included in pkg.pr.new releases. Commit: f280ee1

Copilot AI changed the title Add --published-only flag to list-workspaces command Add --published-only flag to list-workspaces and update ci-publish action Aug 25, 2025
Signed-off-by: Jan Potoms <2109932+Janpot@users.noreply.github.com>
@Janpot Janpot marked this pull request as ready for review August 25, 2025 08:33
@Janpot Janpot requested a review from a team August 25, 2025 08:33
@Janpot Janpot changed the title Add --published-only flag to list-workspaces and update ci-publish action [code-infra] Remove use-compact-url input from the preview publishing Aug 25, 2025
@zannager zannager added the scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). label Aug 25, 2025
@Janpot Janpot added the on hold There is a blocker, we need to wait. label Aug 26, 2025
@Janpot
Copy link
Member

Janpot commented Aug 26, 2025

Closing this as we should either

@Janpot Janpot closed this Aug 26, 2025
@Janpot Janpot removed the on hold There is a blocker, we need to wait. label Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[code-infra] Force --compact for codesandbox ci

4 participants