Skip to content

Conversation

@TarunAdobe
Copy link
Contributor

@TarunAdobe TarunAdobe commented Oct 7, 2025

Description

  • Added build-, test-, start-, and lint- root scripts so first- and second-gen workspaces can be orchestrated together.
  • Introduced a prebuild wireit target in first-gen/package.json that triggers the second-gen core build before the existing build pipeline.
  • Renamed the second-gen workspace to @adobe/swc and updated yarn.lock to reflect the new package name.

Motivation and context

  • Make the root package the single entry point for common dev workflows that span both generations of Spectrum Web Components.
  • Ensure first-gen builds automatically compile second-gen core artifacts to keep shared output in sync.

Related issue(s)

  • fixes [Issue Number]

Screenshots (if appropriate)


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

  1. Build Pipeline (First-gen and Second-gen)

    • Test: Run yarn build at the repo root.
    • Goal: Ensure both first-gen and second-gen workspaces build successfully and in the correct order.
    • Check: No errors in the build output. Artifacts for both generations are correctly produced.
  2. Test Scripts

    • Test: Run yarn test, yarn test-first-gen, and yarn test-second-gen at the root.
    • Goal: All tests in both generations (unit, integration, etc.) must pass.
    • Check: Look for failures in either workspace.
  3. Linting

    • Test: Run yarn lint, yarn lint-first-gen, and yarn lint-second-gen.
    • Goal: Linting completes without errors for both codebases.
    • Check: Confirm the new shared ESLint config is applied and that there are no unexpected warnings or errors.
  4. Wireit Integration

    • Test: Run yarn workspace @adobe/spectrum-web-components build (or the specific first-gen build command).
    • Goal: The new prebuild Wireit script should reliably trigger the second-gen build as a dependency.
    • Check: No race conditions or missed dependencies; confirm that changes in second-gen core trigger rebuilds as expected.
  5. CI/CD

    • Test: Monitor all automated build and test jobs in your CI (e.g., GitHub Actions, Jenkins).
    • Goal: All jobs pass after merging these changes.
    • Check: Especially watch for any failures in composite builds or jobs that run the changed scripts.

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

@changeset-bot
Copy link

changeset-bot bot commented Oct 7, 2025

⚠️ No Changeset found

Latest commit: 29f4e28

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 7, 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-5791

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 Oct 7, 2025

Tachometer results

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

@TarunAdobe TarunAdobe changed the title chore: hoist dev commands to root packagejson chore: command orchestration Oct 7, 2025
@TarunAdobe TarunAdobe marked this pull request as ready for review October 8, 2025 05:54
@TarunAdobe TarunAdobe requested a review from a team as a code owner October 8, 2025 05:54
@TarunAdobe TarunAdobe self-assigned this Oct 8, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

Would start also require yarn run dev on core?

"scripts": {
"build": "yarn workspaces foreach --from '@swc/*' run build",
"clean": "yarn workspaces foreach --from '@swc/*' run clean",
"build": "yarn workspaces foreach --from '@swc/*' --recursive run build",
Copy link
Contributor

Choose a reason for hiding this comment

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

This will force Yarn to traverse downstream dependents, rebuilding or cleaning even when nothing changed. Is this what we need? We can do caching or parallelisation here too. Let me know your setup

"build": "yarn workspaces foreach --from '@swc/*' run build",
"clean": "yarn workspaces foreach --from '@swc/*' run clean",
"build": "yarn workspaces foreach --from '@swc/*' --recursive run build",
"clean": "yarn workspaces foreach --from '@swc/*' --recursive run clean",
Copy link
Contributor

Choose a reason for hiding this comment

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

If you just want to delete the SWC output you can avoid the cascading clean. You can just run this?

yarn workspaces foreach --from '@swc/*' run clean

package.json Outdated
Comment on lines 18 to 20
"build-first-gen": "yarn workspace @adobe/spectrum-web-components build",
"build-second-gen": "yarn workspace @adobe/swc build",
"build": "yarn build-first-gen && yarn build-second-gen",
Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt Oct 15, 2025

Choose a reason for hiding this comment

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

This is strictly a curiosity I had: can you explain why you chose build-first-gen over something like build:first-gen? I've just seen the colon syntax more often, that's all.

Sort of along these lines, if we went with the colon syntax instead, could we do something like:

"build": "yarn build:*",

Why does the order of building first-gen or second-gen matter? I honestly don't know what order something like yarn build:* would build each project, so maybe this is not even a good idea or feasible! 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the first part, It was an oversight on my end. I feel its better to use build:first-gen and so I switched that up. And about the second one, no the order of building first-gen or second-gen doesn't matter as long as both are being built before starting their respective storybooks.

@marissahuysentruyt
Copy link
Collaborator

Just wanted to leave some notes as I was walking through the validation steps.

For yarn build:
I am getting build errors (for second-gen), but they're not enough for me not to run either project. Were you getting those at all? 🤔 Maybe they're known or acceptable errors for now.

Screenshot 2025-10-15 at 1 38 17 PM

For yarn test:

the new first-gen and second-gen commands work from the root, and yarn test fires off both with no problems. 🥳
Screenshot 2025-10-15 at 1 48 00 PM
Screenshot 2025-10-15 at 1 55 52 PM
Screenshot 2025-10-15 at 1 55 38 PM

WireIt and workspace commands
First-gen and second-gen can be run with their corresponding Storybook start commands. 👍

For yarn lint:
For second-gen, I get the eslint command is not found error. First-gen I think is working- it output where I made changes correctly (to be honest, I don't remember what the output typically looks like for linting on main)

Screenshot 2025-10-15 at 2 33 33 PM Screenshot 2025-10-15 at 2 33 22 PM Screenshot 2025-10-15 at 2 36 04 PM

I don't think this is related to this PR or not, but when I run yarn build from the root (after running nvm use && git clean -dfX && yarn), I do get a message that Vite requires nvm version 20.19+, but our .nvmrc only has nvm at 20.13.1. Is that something we would want to address at some point?
Screenshot 2025-10-15 at 2 13 57 PM

@caseyisonit caseyisonit added 2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. Status: Ready for review PR ready for review or re-review. labels Oct 20, 2025
"prestorybook": "cem analyze",
"storybook": "storybook dev -p 6006",
"storybook:build": "storybook build",
"test": "yarn workspace @swc/core dev & vitest",
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like "test:watch", is that accurate?

@rubencarvalho
Copy link
Contributor

rubencarvalho commented Oct 23, 2025

.eslintrc.json Outdated
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just use "latest" here or is there a reason we need to use "2020" version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no reason. it was 2020 everywhere else so cursor copied the same thing and i didn't look. will update this to latest and see if nothing breaks

"lint:first-gen": "yarn workspace @adobe/spectrum-web-components lint",
"lint:second-gen": "yarn workspace @adobe/swc lint",
"postinstall": "husky || true && patch-package",
"start": "yarn start:first-gen & yarn start:second-gen",
Copy link
Contributor

@caseyisonit caseyisonit Oct 23, 2025

Choose a reason for hiding this comment

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

When running yarn start from the root directory, second-gen fails but first-gen will run. Screenshot of the error:
Screenshot 2025-10-23 at 3 34 19 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for some reason prestorybook hook was not getting called and thus this error.
i chained prestorybook explicitly to run before storybook in second-gen packages and it's working now

Copy link
Contributor

Choose a reason for hiding this comment

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

i was still getting the same error associated with storybook setup not having dirname correctly defined since we are using modules. i have implemented a fix and will push it up with my review.

"lint": "yarn lint:first-gen && yarn lint:second-gen",
"lint:first-gen": "yarn workspace @adobe/spectrum-web-components lint",
"lint:second-gen": "yarn workspace @adobe/swc lint",
"postinstall": "husky || true && patch-package",
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need patch-package? we can patch packages with yarn4 now and have removed patch-package from first gen to my knowledge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great question but this is out of scope for the current PR. will track it on slack maybe?

@TarunAdobe TarunAdobe force-pushed the ttomar/command-orchestration branch from abce0f2 to 1b9f9d0 Compare October 24, 2025 09:07
"prestorybook": "cem analyze",
"storybook": "storybook dev -p 6006",
"storybook:build": "storybook build",
"storybook": "yarn analyze && storybook dev -p 6006",
Copy link
Contributor

Choose a reason for hiding this comment

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

yarn cem:watch && storybook dev -p 6006?

"scripts": {
"analyze": "cem analyze --config cem.config.js",
"build": "vite build",
"cem:watch": "cem analyze --watch",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, for consistency, could we do analyze:watch?

@rubencarvalho
Copy link
Contributor

rubencarvalho commented Oct 24, 2025

There’s a small issue: if Storybook for the first-generation package hasn’t been built yet, it won’t start successfully.
It’s possible that a dependency on the story decorators is missing.

Running yarn start:first-gen in that case shows this:

ERROR in ./storybook/preview.js 13:0-90
Module not found: Error: Can't resolve '@spectrum-web-components/story-decorator/decorator.js' in '/Users/ruben/Documents/Work/swc/first-gen/storybook'
 @ ./storybook-config-entry.js 10:1309-1382 40:2-43:4 40:1280-43:3

ERROR in ./storybook/preview.js 14:0-82
Module not found: Error: Can't resolve '@spectrum-web-components/story-decorator/src/locales.js' in '/Users/ruben/Documents/Work/swc/first-gen/storybook'
 @ ./storybook-config-entry.js 10:1309-1382 40:2-43:4 40:1280-43:3

ERROR in ./storybook/preview.js 17:0-72
Module not found: Error: Can't resolve '@spectrum-web-components/story-decorator/sp-story-decorator.js' in '/Users/ruben/Documents/Work/swc/first-gen/storybook'
 @ ./storybook-config-entry.js 10:1309-1382 40:2-43:4 40:1280-43:3

preview compiled with 3 errors
=> Failed to build the preview
<s> [webpack.Progress] 99% end closing watch compilation
<s> [webpack.Progress] 99% end closing watch compilation
WARN Force closed preview build
SB_BUILDER-WEBPACK5_0003 (WebpackCompilationError): There were problems when compiling your code with Webpack.
Run Storybook with --debug-webpack for more information.
    at starter (/Users/ruben/Documents/Work/swc/node_modules/@storybook/builder-webpack5/dist/index.js:1:24163)
    at starter.next (<anonymous>)
    at Module.start (/Users/ruben/Documents/Work/swc/node_modules/@storybook/builder-webpack5/dist/index.js:1:26142)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async storybookDevServer (/Users/ruben/Documents/Work/swc/node_modules/@storybook/core/dist/core-server/index.cjs:36423:79)
    at async buildOrThrow (/Users/ruben/Documents/Work/swc/node_modules/@storybook/core/dist/core-server/index.cjs:35049:12)
    at async buildDevStandalone (/Users/ruben/Documents/Work/swc/node_modules/@storybook/core/dist/core-server/index.cjs:37628:78)
    at async withTelemetry (/Users/ruben/Documents/Work/swc/node_modules/@storybook/core/dist/core-server/index.cjs:35788:12)
    at async dev (/Users/ruben/Documents/Work/swc/node_modules/@storybook/core/dist/cli/bin/index.cjs:5874:3)
    at async s.<anonymous> (/Users/ruben/Documents/Work/swc/node_modules/@storybook/core/dist/cli/bin/index.cjs:6052:74)

WARN Broken build, fix the error above.
 You may need to refresh the browser.

"lit-a11y/click-events-have-key-events": [
"error",
{
"allowList": [
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we including this in second gen? this is very much a first-gen pattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not necessarily a part of this pr bt good catch. I shall remove this

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make sure to review the linter settings we want in second-gen to ensure they are patterns we want to continue using or add new ones? This is not blocking for this PR but want to make sure we discuss as a team

cc @rubencarvalho @graynorton

Copy link
Contributor

Choose a reason for hiding this comment

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

What currently is here is just a simple setup to get eslinting up and running. We can and should talk about it :)

}
],
"no-debugger": 2,
"notice/notice": [
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to make sure this is still working in second gen, we should still be prepending a copywright to every file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Does the root level work across the project?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed it cause we don't have a license.js config for second-gen and i don't know if we want to replicate the first-gen or not?

Copy link
Contributor

Choose a reason for hiding this comment

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

We do, yes. License should be project-wide

@caseyisonit caseyisonit added the High priority PR review PR is a high priority and should be reviewed ASAP label Oct 24, 2025
@TarunAdobe TarunAdobe force-pushed the ttomar/command-orchestration branch from 6f57fd4 to 29f4e28 Compare October 27, 2025 11:09
Copy link
Contributor

@rubencarvalho rubencarvalho left a comment

Choose a reason for hiding this comment

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

gut gut!!

Copy link
Contributor

@caseyisonit caseyisonit left a comment

Choose a reason for hiding this comment

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

crushed it

@caseyisonit caseyisonit merged commit 502ffc8 into barebones Oct 27, 2025
22 checks passed
@caseyisonit caseyisonit deleted the ttomar/command-orchestration branch October 27, 2025 20:29
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.

6 participants