Skip to content

Conversation

@rubencarvalho
Copy link
Contributor

@rubencarvalho rubencarvalho commented Oct 30, 2025

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.

@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2025

⚠️ No Changeset found

Latest commit: 71512d4

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 30, 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-5845

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

Tachometer results

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

@rubencarvalho rubencarvalho changed the title Ruben/streamline release chore(tooling): make publishing workflow work for new monorepo structure Nov 1, 2025
@rubencarvalho rubencarvalho changed the title chore(tooling): make publishing workflow work for new monorepo structure chore(tooling): adapt publishing workflow for new monorepo structure Nov 1, 2025
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 Node requirement to 20.19.0, as per the new Storybook 10 requirement.

"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.

added rimraf .wireit, as this can also be a source of caching problems.

"@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.

Pinned version.

"latest-version": "9.0.0",
"lightningcss": "1.30.1",
"lint-staged": "^16.1.2",
"lint-staged": "16.2.6",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pinned version.

"pretty-bytes": "7.1.0",
"re-template-tag": "2.0.1",
"replace-in-file": "^8.3.0",
"replace-in-file": "8.3.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pinned version.

entries: [
{
find: /^@swc\/core\/(.*)$/,
find: /^@spectrum-web-components\/core\/(.*)$/,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

More old references.

],
'package.json': () => [
'cd 1st-gen && genversion --es6 --semi tools/base/src/version.js',
'genversion --source ./1st-gen/tools/base/package.json --es6 --semi --force ./2nd-gen/packages/core/shared/base/version.ts',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a new path for puting the version 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.

Cleaned up the commands to be more consistent with the use of 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.

Updated constraints to support new 2nd-gen packages and requirements.

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 the meat of this PR, hopefully it's self documenting! :)

@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 1, 2025
@rubencarvalho rubencarvalho marked this pull request as ready for review November 1, 2025 20:56
@rubencarvalho rubencarvalho requested a review from a team as a code owner November 1, 2025 20:56
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.

10 participants