Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"error",
{
"mustMatch": "Copyright [0-9]{0,4} Adobe. All rights reserved.",
"templateFile": "config/license.js"
"templateFile": "config/HEADER.js"
}
]
}
Expand All @@ -102,7 +102,7 @@
"error",
{
"mustMatch": "Copyright [0-9]{0,4} Adobe. All rights reserved.",
"templateFile": "../../../config/license.js"
"templateFile": "config/HEADER.js"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that this is passing in CI, but locally, I'm still getting a lint error:

Image

If I change this to:

Suggested change
"templateFile": "config/HEADER.js"
"templateFile": "../config/HEADER.js"

I can get it to run and it finds lint errors:

Image

Should we address these?

Copy link
Contributor Author

@rubencarvalho rubencarvalho Nov 4, 2025

Choose a reason for hiding this comment

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

I addressed this for now and pushed a commit with the --fixed files.
The more comprehensive linting fix will happen in: #5847
LMK if you still find something quirky!

}
]
}
Expand Down
183 changes: 91 additions & 92 deletions .github/workflows/browser-tests.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,98 @@
name: Browser Performance Tests

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch: # Only run manually, not on pull requests

permissions:
contents: read
pull-requests: write
contents: read
pull-requests: write

jobs:
test-changed-packages:
strategy:
matrix:
browser: [firefox, chrome]
name: Compare performance to latest release on ${{ matrix.browser }}

# The job will only run if the pull request is from the same repository.
# Benchmarks can't run on PRs from forked repos due to comment posting restrictions without a GitHub token.
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-22.04
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main

- name: Checkout PR branch
uses: actions/checkout@v4
with:
fetch-depth: 0 # Get full history

- name: Fetch main branch
run: |
git fetch origin main:main

- name: Setup Job and Install Dependencies
uses: ./.github/actions/setup-job

- name: Check ChromeDriver Version
if: matrix.browser == 'chrome'
run: |
echo "Checking ChromeDriver version..."
npx chromedriver --version
echo "Checking Chrome version..."
google-chrome --version
echo "Checking tachometer chromedriver version..."
cd 1st-gen && yarn tachometer --version

- name: Tachometer the changed packages
run: cd 1st-gen && yarn test:changed --browser=${{ matrix.browser }}

- name: Create a dummy file to ensure at least one results file exists
run: touch 1st-gen/tachometer.${{ matrix.browser }}-ran.txt

- name: Archive ${{ matrix.browser }} tachometer results
id: upload-artifact
uses: actions/upload-artifact@v4
with:
name: tachometer-results-${{ matrix.browser }}
path: |
1st-gen/tach-results.${{ matrix.browser }}.*.json
1st-gen/tachometer.${{ matrix.browser }}-ran.txt

comment-performance:
name: Comment tachometer performance results
needs: [test-changed-packages]

# The job will only run if the pull request is from the same repository.
# Benchmarks can't run on PRs from forked repos due to comment posting restrictions without a GitHub token.
if: ${{ github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main

- name: Checkout PR branch
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Job and Install Dependencies
uses: ./.github/actions/setup-job

- uses: actions/download-artifact@v4
with:
pattern: tachometer-results-*
merge-multiple: true

- name: Post Tachometer Performance Comment
uses: actions/github-script@v7
with:
script: |
const { buildTachometerComment } = await import('${{ github.workspace }}/.github/scripts/build-tachometer-comment.js');
const { commentOrUpdate } = await import('${{ github.workspace }}/.github/scripts/comment-or-update.js');
const body = buildTachometerComment();
commentOrUpdate(github, context, '## Tachometer results', body);
test-changed-packages:
strategy:
matrix:
browser: [firefox, chrome]
name: Compare performance to latest release on ${{ matrix.browser }}

# The job will only run if the pull request is from the same repository.
# Benchmarks can't run on PRs from forked repos due to comment posting restrictions without a GitHub token.
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-22.04
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main

- name: Checkout PR branch
uses: actions/checkout@v4
with:
fetch-depth: 0 # Get full history

- name: Fetch main branch
run: |
git fetch origin main:main

- name: Setup Job and Install Dependencies
uses: ./.github/actions/setup-job

- name: Check ChromeDriver Version
if: matrix.browser == 'chrome'
run: |
echo "Checking ChromeDriver version..."
npx chromedriver --version
echo "Checking Chrome version..."
google-chrome --version
echo "Checking tachometer chromedriver version..."
cd 1st-gen && yarn tachometer --version

- name: Tachometer the changed packages
run: cd 1st-gen && yarn test:changed --browser=${{ matrix.browser }}

- name: Create a dummy file to ensure at least one results file exists
run: touch 1st-gen/tachometer.${{ matrix.browser }}-ran.txt

- name: Archive ${{ matrix.browser }} tachometer results
id: upload-artifact
uses: actions/upload-artifact@v4
with:
name: tachometer-results-${{ matrix.browser }}
path: |
1st-gen/tach-results.${{ matrix.browser }}.*.json
1st-gen/tachometer.${{ matrix.browser }}-ran.txt

comment-performance:
name: Comment tachometer performance results
needs: [test-changed-packages]

# The job will only run if the pull request is from the same repository.
# Benchmarks can't run on PRs from forked repos due to comment posting restrictions without a GitHub token.
if: ${{ github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main

- name: Checkout PR branch
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Job and Install Dependencies
uses: ./.github/actions/setup-job

- uses: actions/download-artifact@v4
with:
pattern: tachometer-results-*
merge-multiple: true

- name: Post Tachometer Performance Comment
uses: actions/github-script@v7
with:
script: |
const { buildTachometerComment } = await import('${{ github.workspace }}/.github/scripts/build-tachometer-comment.js');
const { commentOrUpdate } = await import('${{ github.workspace }}/.github/scripts/comment-or-update.js');
const body = buildTachometerComment();
commentOrUpdate(github, context, '## Tachometer results', body);
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ jobs:
level: error
reporter: github-pr-review
filter_mode: diff_context
eslint_flags: '--config .eslintrc.json ${{ needs.changed_files.outputs.eslint_added_files }} ${{ needs.changed_files.outputs.eslint_modified_files }}'
eslint_flags: '${{ needs.changed_files.outputs.eslint_added_files }} ${{ needs.changed_files.outputs.eslint_modified_files }}'
2 changes: 1 addition & 1 deletion 1st-gen/packages/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"error",
{
"mustMatch": "Copyright [0-9]{0,4} Adobe. All rights reserved.",
"templateFile": "config/license.js"
"templateFile": "config/HEADER.js"
}
],
"sort-imports": [
Expand Down
6 changes: 3 additions & 3 deletions 1st-gen/scripts/css-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ const wrapCSSResult = (content) => {
`;
};

const licensePath = path.resolve(__dirname, '..', 'config', 'license.js');
const headerPath = path.resolve(__dirname, '..', 'config', 'HEADER.js');
let header = '';
if (fs.existsSync(licensePath)) {
header = fs.readFileSync(licensePath, 'utf8');
if (fs.existsSync(headerPath)) {
header = fs.readFileSync(headerPath, 'utf8');
header = header.replace('<%= YEAR %>', new Date().getFullYear());
}

Expand Down
2 changes: 1 addition & 1 deletion 1st-gen/scripts/test-changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const { browser = 'chrome' } = yargs(hideBin(process.argv)).argv;
*/
export const getChangedPackages = () => {
let changedPackages = [];
const changesetDir = '.changeset';
const changesetDir = '../.changeset';

try {
// Check if .changeset directory exists
Expand Down
2 changes: 1 addition & 1 deletion 1st-gen/test/benchmark/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ $ node test/benchmark/cli -n 20
for (const packageName of packages) {
const runCommands: string[] = [];
const config: Partial<ConfigFile> = {
root: '../..',
root: '../../..',
$schema:
'https://raw.githubusercontent.com/Polymer/tachometer/master/config.schema.json',
timeout: parseFloat(opts.timeout) || 0,
Expand Down
2 changes: 1 addition & 1 deletion 1st-gen/test/tsconfig-node.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"outDir": ".",
"rootDir": ".",
"types": ["node"],
"typeRoots": ["../node_modules/@types"]
"typeRoots": ["../../node_modules/@types"]
},
"include": ["benchmark/cli.ts"],
"exclude": []
Expand Down
2 changes: 1 addition & 1 deletion 1st-gen/tools/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
"error",
{
"mustMatch": "Copyright [0-9]{0,4} Adobe. All rights reserved.",
"templateFile": "config/license.js"
"templateFile": "config/HEADER.js"
}
],
"sort-imports": [
Expand Down
38 changes: 32 additions & 6 deletions 2nd-gen/packages/swc/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { resolve, dirname } from 'path';
import { mergeConfig } from 'vite';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));
Expand Down Expand Up @@ -28,13 +29,38 @@ const config = {
'@storybook/addon-vitest',
],
viteFinal: async (config) => {
config.resolve = config.resolve || {};
config.resolve.alias = {
...config.resolve.alias,
'@spectrum-web-components/core': resolve(__dirname, '../../core'),
};
return mergeConfig(config, {
plugins: [
{
name: 'css-hmr',
handleHotUpdate({ file, modules, server }) {
if (!file.endsWith('.css') || file.includes('tokens'))
return;

return config;
const affected = new Set(modules);

for (const mod of modules) {
for (const importer of mod.importers)
affected.add(importer);
}

for (const mod of affected)
server.moduleGraph.invalidateModule(mod);

return [...affected];
},
},
],
resolve: {
alias: {
'@spectrum-web-components/core': resolve(
__dirname,
'../../core'
),
'@adobe/swc': resolve(__dirname, '../components'),
},
},
});
},
typescript: {
check: true,
Expand Down
12 changes: 6 additions & 6 deletions 2nd-gen/packages/swc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@
"devDependencies": {
"@axe-core/playwright": "4.10.2",
"@custom-elements-manifest/analyzer": "0.10.8",
"@storybook/addon-a11y": "10.0.1",
"@storybook/addon-a11y": "10.0.3",
"@storybook/addon-designs": "11.0.1",
"@storybook/addon-docs": "10.0.1",
"@storybook/addon-vitest": "10.0.1",
"@storybook/addon-docs": "10.0.3",
"@storybook/addon-vitest": "10.0.3",
"@storybook/test-runner": "0.23.0",
"@storybook/web-components-vite": "10.0.1",
"@storybook/web-components-vite": "10.0.3",
"@types/react": "19.1.16",
"@types/react-dom": "19.1.9",
"@vitest/browser": "3.2.4",
"@vitest/coverage-v8": "3.2.4",
"@vitest/ui": "3.2.4",
"@wc-toolkit/storybook-helpers": "9.0.1",
"@wc-toolkit/storybook-helpers": "10.0.0",
"autoprefixer": "10.4.21",
"glob": "11.0.3",
"playwright": "1.53.1",
Expand All @@ -76,7 +76,7 @@
"react": "19.1.1",
"react-dom": "19.1.1",
"rimraf": "6.0.1",
"storybook": "10.0.1",
"storybook": "10.0.3",
"typescript": "5.9.2",
"vite": "7.1.7",
"vite-plugin-dts": "4.5.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Should any behavior fall short of these expectations, please report it to <Grp-o

## Developing locally

Read the steps outlined in the [README.md](../README.md) to get your environment set up.
Read the steps outlined in [Working in the SWC repo](./03_working-in-the-swc-repo.md) to get your environment set up.

If you encounter hurdles, feel free to ask for help in your pull request or in the community forum.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Reflecting the side-by-side strategy, the repository is organized into two top-l

- The 2nd-gen SWC library (`packages/swc/`).

During this transition, depending on what you're trying to accomplish, you may end up working in `1st-gen`, `2nd-gen`, or both. If you have any questions, [please ask](./01_getting-involved.md#community--support)—we're happy to help.
During this transition, depending on what you're trying to accomplish, you may end up working in `[1st-gen](/1st-gen/README.md)`, `[2nd-gen](/2nd-gen/README.md)`, or both. If you have any questions, [please ask](./01_getting-involved.md#community--support)—we're happy to help.

## Development workflow

Expand Down
Loading
Loading