Skip to content

Conversation

@rubencarvalho
Copy link
Contributor

Description

This PR streamlines and fixes the publishing workflow for Spectrum Web Components after the monorepo restructure.

Most relevant changes

Unified publish script (scripts/publish.js)

  • Handles both 1st-gen and 2nd-gen packages in a single workflow.
  • Cleans and rebuilds everything from scratch to prevent stale artifact issues.
  • Publishes React wrappers directly via npm.
  • Properly handles snapshot vs regular releases.

Fixed global changelog generator

  • Corrected regex to detect @spectrum-web-components/core changes (previously looked for @swc/core).
  • Now only runs for regular releases (not snapshots).
  • Runs before changeset version to access changeset files before deletion.

Updated build configuration aliases

  • Fixed alias @swc/core → @spectrum-web-components/core in:
    • 1st-gen/web-test-runner.config.js
    • 1st-gen/test/visual/rollup.config.js
    • 1st-gen/projects/documentation/rollup.config.js

Fixed Yarn constraints for new monorepo structure

  • Updated glob patterns:

    - {packages,tools}/*
    + {1st-gen/{packages,tools},2nd-gen/packages}/*
  • Fixed folder name extraction for component name resolution.

  • Added generation-specific rules:

    • 1st-gen: main/module → ./src/index.js
    • 2nd-gen: main/module → ./dist/index.js
  • Ensured both generations set publishConfig.access: "public".

Cleaned up obsolete scripts from 1st-gen/package.json

Removed:

  • changeset-publish
  • changeset-snapshot-publish
  • prepublishOnly, postpublish
  • prepublish:react, postpublish:react, publish:react
  • push-to-remote

Updated release documentation

  • Simplified workflow steps in
    CONTRIBUTOR-DOCS/01_contributor-guides/06_releasing-swc.md
  • Documented that the script automatically handles all cleaning and building.
  • Added custom tag usage examples (nightly, beta, etc.).

Motivation and context

After reorganizing the repository into 1st-gen/ and 2nd-gen/ subdirectories, the publishing workflow needed to be updated.

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

To be tested under the barebones testing and validation steps.

…ucture

Refactors the publishing and release management workflow to support the
dual-generation monorepo architecture:

- Update Changesets configuration to recognize both 1st-gen and 2nd-gen
  workspaces, enabling independent versioning strategies

- Refactor release scripts to delegate to generation-specific publishing
  workflows rather than operating on a flat package structure

- Update CI/CD publishing jobs to build, test, and publish both generations
  with appropriate dependency handling for the shared Core library

- Preserve existing 1st-gen package publishing behavior to avoid disruption
  to current consumers

This workflow enables continuous delivery of improvements to 1st-gen customers
while supporting independent 2nd-gen package releases.
@changeset-bot
Copy link

changeset-bot bot commented Nov 2, 2025

⚠️ No Changeset found

Latest commit: 87ff985

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rubencarvalho rubencarvalho marked this pull request as ready for review November 2, 2025 21:47
@rubencarvalho rubencarvalho requested a review from a team as a code owner November 2, 2025 21:47
@rubencarvalho rubencarvalho added Status: Ready for review PR ready for review or re-review. 2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. High priority PR review PR is a high priority and should be reviewed ASAP labels Nov 2, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2025

📚 Branch Preview

🔍 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-5851

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2025

Tachometer results

Currently, no packages are changed by this PR...

@@ -1 +1 @@
20.13.1 No newline at end of file
20.19.0 No newline at end of file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bumping minimum version for Storybook 10 compatibility.

"build": "wireit",
"prebuild": "wireit",
"build:clear-cache": "rimraf packages/*/tsconfig.tsbuildinfo && rimraf tools/*/tsconfig.tsbuildinfo",
"build:clear-cache": "rimraf .wireit && rimraf packages/*/tsconfig.tsbuildinfo && rimraf tools/*/tsconfig.tsbuildinfo",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cleaning .wireit cache too.

"postpack": "pinst --enable",
"postpublish": "yarn prepublish:react && yarn publish:react && yarn postpublish:react",
"postpublish:react": "git reset --hard HEAD^ && git prune && rimraf react",
"prebuild": "wireit",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not new, just got re-ordered.

"chromatic": "chromatic --build-script-name storybook:build # note that --project-token must be set in your env variables",
"create-git-tag": "node --no-warnings ./scripts/create-git-tag.js",
"custom-element-json": "node ./scripts/custom-element-json.js",
"dev:core": "yarn workspace @spectrum-web-components/core dev",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not new, just got re-ordered.

"@changesets/cli": "2.29.7",
"@commitlint/cli": "19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"@commitlint/config-conventional": "19.8.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pinning versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to stay!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplify documentation which will eventually live under Contributing Docs, but this clean version can be useful if you are navigating the GitHub UI and open this folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated commands to consistently run with npm-run-all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simple Readme to be shown either in GitHub or npm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update documentation around releasing to be in sync with new publish script

Comment on lines -219 to -222
"engines": {
"node": ">=20",
"yarn": ">=4.6.0"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to remove this?

Comment on lines -1 to -2
// Generated by genversion.
export const version = '1.9.0';
Copy link
Contributor

Choose a reason for hiding this comment

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

Many consumers still uses this path to version check their packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Re-added it

import { SpectrumElement } from '@spectrum-web-components/base';
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
import { version } from '@spectrum-web-components/base/src/version.js';
import { version } from '@spectrum-web-components/core/shared/base/version.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

note: Downstream customers needs to update to the new path. Should surface this information up as a breaking change?

Copy link
Contributor Author

@rubencarvalho rubencarvalho Nov 3, 2025

Choose a reason for hiding this comment

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

Updated to re-export the 2nd-gen one!

@rubencarvalho rubencarvalho merged commit 3ff495e into barebones Nov 3, 2025
22 checks passed
@rubencarvalho rubencarvalho deleted the ruben/barbeones-publish-updates branch November 3, 2025 14:39
rubencarvalho added a commit that referenced this pull request Nov 3, 2025
…5851)

* chore: update and streamline publishing workflow for new monorepo structure

Refactors the publishing and release management workflow to support the
dual-generation monorepo architecture:

- Update Changesets configuration to recognize both 1st-gen and 2nd-gen
  workspaces, enabling independent versioning strategies

- Refactor release scripts to delegate to generation-specific publishing
  workflows rather than operating on a flat package structure

- Update CI/CD publishing jobs to build, test, and publish both generations
  with appropriate dependency handling for the shared Core library

- Preserve existing 1st-gen package publishing behavior to avoid disruption
  to current consumers

This workflow enables continuous delivery of improvements to 1st-gen customers
while supporting independent 2nd-gen package releases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. High priority PR review PR is a high priority and should be reviewed ASAP Status: Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants