Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ parameters:
# 3. Commit this change to the PR branch where the changes exist.
current_golden_images_hash:
type: string
default: fe5761e6acafee627d7782f8f8856ca05a69260c
default: 89cb380330cef18d34c0d4cf893790d9c7167b08
wireit_cache_name:
type: string
default: wireit
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.13.1
20.19.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.

Bumping minimum version for Storybook 10 compatibility.

25 changes: 6 additions & 19 deletions 1st-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"scripts": {
"analyze": "lit-analyzer \"{packages,tools}/*/src/**/!(*.css).ts\"",
"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.

"build:confirm": "node ./scripts/confirm-build.js",
"build:css": "wireit",
"build:css:watch": "wireit",
Expand All @@ -30,11 +29,10 @@
"build:types": "wireit",
"build:watch": "wireit",
"changelog:global": "node ./scripts/update-global-changelog.js",
"changeset-publish": "yarn prepublishOnly && yarn changeset version && yarn constraints --fix && yarn install --refresh-lockfile && yarn version:update && yarn changeset publish --no-git-tag && yarn push-to-remote && yarn create-git-tag && yarn postpublish",
"changeset-snapshot-publish": "yarn prepublishOnly && yarn changeset version --snapshot snapshot && yarn constraints --fix && yarn install --refresh-lockfile && yarn version:update && yarn changeset publish --no-git-tag --tag snapshot",
"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.

"docs:analyze": "cem analyze --globs \"packages/**/*.ts\" --exclude \"**/*.d.ts\" --exclude \"**/stories/**\" --exclude \"**/icons/**\" --exclude \"**/elements/**\" --outdir projects/documentation --litelement",
"docs:build": "yarn workspace documentation build",
"docs:ci": "yarn docs:analyze && run-p docs:production storybook:build && cp projects/documentation/custom-elements.json projects/documentation/dist/storybook",
Expand All @@ -50,20 +48,14 @@
"new-package": "yarn workspace swc-templates plop",
"postinstall": "husky || true",
"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.

"preeleventy": "yarn docs:analyze",
"prepack": "pinst --disable",
"prepublish:react": "yarn build:react && sed -i \"\" \"s/react/# react/g\" .gitignore && git commit -am \"Commit React Wrappers\" --no-verify",
"prepublishOnly": "rimraf react && yarn build && yarn custom-element-json && yarn build:confirm && yarn changelog:global",
"prestorybook": "wireit",
"prestorybook:build": "cem analyze --outdir storybook/",
"pretest:bench": "yarn build:tests && test -f test/benchmark/cli.js ||:",
"pretest:visual": "yarn build && yarn build",
"process-icons": "wireit",
"publish:react": "yarn changeset publish --no-git-tag --tag latest --no-push",
"push-to-remote": "git add . && git commit -m \"chore: release new versions #publish\" && git push",
"dev:core": "yarn workspace @spectrum-web-components/core dev",
"start": "run-p dev:core storybook",
"storybook": "wireit",
"storybook:build": "NODE_ENV=production storybook build -o projects/documentation/dist/storybook -c storybook",
Expand All @@ -85,7 +77,6 @@
"test:watch": "yarn test:watch:focus unit",
"test:watch:flags:focus": "yarn build && run-p build:watch \"test:start --watch --group {1} --config web-test-runner.config.ci-chromium-flags.js\" --",
"test:watch:focus": "yarn dev:core & yarn build && run-p build:watch \"test:start --watch --group {1}\" --",
"version:update": "genversion --verbose --semi --esm ./tools/base/src/version.js",
"vrt:preview": "yarn wds --config test/visual/wds-vrt.config.js"
},
"workspaces": [
Expand All @@ -99,7 +90,7 @@
"@changesets/changelog-github": "0.5.1",
"@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.

"@custom-elements-manifest/analyzer": "0.10.6",
"@geometricpanda/storybook-addon-badges": "2.0.5",
"@lit/react": "1.0.8",
Expand Down Expand Up @@ -176,7 +167,7 @@
"jsonc-eslint-parser": "2.4.1",
"latest-version": "9.0.0",
"lightningcss": "1.30.1",
"lint-staged": "^16.1.2",
"lint-staged": "16.2.6",
"lit": "^2.5.0 || ^3.1.3",
"lit-analyzer": "2.0.3",
"lit-html": "^2.4.0 || ^3.1.3",
Expand All @@ -190,7 +181,7 @@
"prettier-plugin-package": "1.4.0",
"pretty-bytes": "7.1.0",
"re-template-tag": "2.0.1",
"replace-in-file": "^8.3.0",
"replace-in-file": "8.3.0",
"rimraf": "6.0.1",
"rollup": "4.52.2",
"sinon": "17.0.2",
Expand All @@ -216,10 +207,6 @@
"lit-element",
"lit-html"
],
"engines": {
"node": ">=20",
"yarn": ">=4.6.0"
},
Comment on lines -219 to -222
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?

"wireit": {
"build": {
"dependencies": [
Expand Down
3 changes: 3 additions & 0 deletions 1st-gen/packages/picker/stories/picker.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,9 @@ custom.args = {
open: true,
};
custom.decorators = [isOverlayOpen];
custom.swc_vrt = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Skipping a known flaky test

skip: true,
};

export const BackgroundClickTest = (): TemplateResult => {
return html`
Expand Down
4 changes: 0 additions & 4 deletions 1st-gen/projects/css-custom-vars-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
"./sp-css-table.js": "./dist/src/sp-css-table.js",
"./custom-vars-viewer.js": "./dist/src/custom-vars-viewer.js"
},
"engines": {
"node": ">=16.14.2",
"yarn": ">=1.16.0"
},
"scripts": {
"analyze": "cem analyze --litelement",
"build": "yarn parse-json && tsc && npm run analyze -- --exclude dist",
Expand Down
2 changes: 1 addition & 1 deletion 1st-gen/projects/documentation/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default async () => {
replacement: '../../packages/',
},
{
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.

Fix regex from old @swc-core -> @spectrum-web-components/core

replacement: path.resolve(
'../../../2nd-gen/packages/core/dist/$1'
),
Expand Down
14 changes: 10 additions & 4 deletions 1st-gen/scripts/cem-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,16 @@ export function getWorkspacePackages(
.filter(
(pkg) =>
!ignoredPackages.includes(pkg.name) &&
pkg.name !== '@spectrum-web-components/1st-gen'
pkg.name !== '@spectrum-web-components/1st-gen' &&
pkg.name !== '@spectrum-web-components/2nd-gen' &&
// Only include packages in 1st-gen packages/ and tools/ directories
(pkg.location.startsWith('1st-gen/packages/') ||
pkg.location.startsWith('1st-gen/tools/'))
)
.map((pkg) => ({
name: pkg.name,
path: pkg.location,
// Remove '1st-gen/' prefix since rootDir is already set to 1st-gen
path: pkg.location.replace(/^1st-gen\//, ''),
}));
}

Expand Down Expand Up @@ -112,14 +117,15 @@ export async function customElementJson(
})
.then(async () => {
const outdir = options.outdir ?? pkg.path;
const packageName = pkg.name || pkg.path || 'unknown';
// Check if the custom-elements.json file exists
if (fs.existsSync(path.join(outdir, 'custom-elements.json'))) {
console.log(
`${'✓'.green} ${pkg.name.cyan} has a custom-elements.json file`
`${'✓'.green} ${packageName.cyan} has a custom-elements.json file`
);
} else {
console.log(
`${'❌'.red} ${pkg.name.cyan} does not have a custom-elements.json file`
`${'❌'.red} ${packageName.cyan} does not have a custom-elements.json file`
);
}
})
Expand Down
55 changes: 38 additions & 17 deletions 1st-gen/scripts/confirm-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@

import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { dirname } from 'path';

import glob from 'fast-glob';
import 'colors';

const __dirname = dirname(fileURLToPath(import.meta.url));
const rootDir = path.join(__dirname, '..');

async function verifyCustomElementsJson() {
// Components that don't need their own custom-elements.json manifest
const customElementsIgnoreList = new Set([
Expand All @@ -27,13 +32,20 @@ async function verifyCustomElementsJson() {
'packages/close-button',
]);

const packages = glob.sync('packages/*/', { onlyDirectories: true });
const packages = glob.sync('packages/*/', {
onlyDirectories: true,
cwd: rootDir,
});
const checks = packages.map(async (pkg) => {
const pkgPath = pkg.replace(/\/$/, '');
if (customElementsIgnoreList.has(pkgPath)) {
return;
}
const customElementsPath = path.join(pkg, 'custom-elements.json');
const customElementsPath = path.join(
rootDir,
pkg,
'custom-elements.json'
);
if (!fs.existsSync(customElementsPath)) {
throw new Error(`Missing custom-elements.json in ${pkg}`);
}
Expand All @@ -42,38 +54,47 @@ async function verifyCustomElementsJson() {
return Promise.all(checks);
}

function verifyVersionJs() {
function verifyVersionTs() {
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 version, it now is in 2nd-gen.

let basePackageJson;
try {
basePackageJson = JSON.parse(
fs.readFileSync('tools/base/package.json', 'utf8')
fs.readFileSync(
path.join(rootDir, 'tools/base/package.json'),
'utf8'
)
);
} catch (error) {
throw new Error('Failed to read tools/base/package.json');
}
const versionJsPath = 'tools/base/src/version.js';
const versionTsPath = path.join(
rootDir,
'../2nd-gen/packages/core/shared/base/version.ts'
);

if (!fs.existsSync(versionJsPath)) {
throw new Error('version.js file is missing');
if (!fs.existsSync(versionTsPath)) {
throw new Error('2nd-gen version.ts file is missing');
}

const versionContent = fs.readFileSync(versionJsPath, 'utf8');
const versionContent = fs.readFileSync(versionTsPath, 'utf8');
const versionMatch = versionContent.match(/version = ['"]([^'"]+)['"]/);

if (!versionMatch) {
throw new Error('Could not find version in version.js');
throw new Error('Could not find version in 2nd-gen version.ts');
}

const versionJs = versionMatch[1];
if (versionJs !== basePackageJson.version) {
const versionTs = versionMatch[1];
if (versionTs !== basePackageJson.version) {
throw new Error(
`Version mismatch: version.js (${versionJs}) does not match tools/base/package.json (${basePackageJson.version})`
`Version mismatch: 2nd-gen version.ts (${versionTs}) does not match 1st-gen tools/base/package.json (${basePackageJson.version})`
);
}
}

async function verifyBuildArtifacts() {
const packages = glob.sync('packages/*/', { onlyDirectories: true });
const packages = glob.sync('packages/*/', {
onlyDirectories: true,
cwd: rootDir,
});
const requiredFilesIgnoreList = new Set([
'packages/clear-button', // extends button
'packages/close-button', // extends button
Expand All @@ -97,7 +118,7 @@ async function verifyBuildArtifacts() {
const checks = packages.map(async (pkg) => {
const pkgPath = pkg.replace(/\/$/, '');

const srcPath = path.join(pkg, 'src');
const srcPath = path.join(rootDir, pkg, 'src');
if (!fs.existsSync(srcPath)) {
throw new Error(`Missing src directory in ${pkg}`);
}
Expand All @@ -114,7 +135,7 @@ async function verifyBuildArtifacts() {

// Verify all required files exist for this package
for (const [filePattern, description] of requiredFiles) {
const pattern = path.join(pkg, filePattern);
const pattern = path.join(rootDir, pkg, filePattern);
const files = glob.sync(pattern);
if (files.length === 0) {
throw new Error(
Expand All @@ -131,8 +152,8 @@ async function main() {
console.log('Verifying custom-elements.json files...'.cyan);
await verifyCustomElementsJson();

console.log('Verifying version.js...'.cyan);
verifyVersionJs();
console.log('Verifying 2nd-gen version.ts synced with 1st-gen...'.cyan);
verifyVersionTs();

console.log('Verifying build artifacts...'.cyan);
await verifyBuildArtifacts();
Expand Down
8 changes: 4 additions & 4 deletions 1st-gen/scripts/update-global-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* into organized changelog entries.
*/

import { version as currentVersion } from '@spectrum-web-components/base/src/version.js';
import { version as currentVersion } from '@spectrum-web-components/core/shared/base/version.js';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing imports for new version path in 2nd-gen.

import { execSync } from 'child_process';
import fs from 'fs';
import { promises as fsPromises } from 'fs';
Expand Down Expand Up @@ -143,7 +143,7 @@ async function processChangesets() {
const coreChanges = extractChanges(
frontmatter,
cleanDescription,
/['"]@swc\/core['"]:\s*(major|minor|patch)/g
/['"]@spectrum-web-components\/core['"]:\s*(major|minor|patch)/g
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix regex from old @swc-core -> @spectrum-web-components/core

);

// Merge results into categorized buckets
Expand Down Expand Up @@ -299,8 +299,8 @@ function updateChangelogFile(
* Reads changeset files, categorizes changes by type (major/minor/patch),
* and updates both the 1st-gen and @spectrum-web-components/core changelogs accordingly.
*
* Should be run during the release process after prepublishOnly but before
* changeset version. Automatically called by `yarn changeset-publish`.
* Should be run during the release process before changeset version.
* Automatically called by the unified publish script for regular releases.
*
* @returns {Promise<void>}
* @throws {Error} If there's an issue with git tags or file operations
Expand Down
2 changes: 1 addition & 1 deletion 1st-gen/test/visual/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default {
alias({
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.

Fix regex from old @swc-core -> @spectrum-web-components/core

replacement: path.resolve(
process.cwd(),
'../2nd-gen/packages/core/dist/$1'
Expand Down
2 changes: 0 additions & 2 deletions 1st-gen/tools/base/src/version.js
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!!

This file was deleted.

2 changes: 1 addition & 1 deletion 1st-gen/tools/base/test/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
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!


class DirElement extends SpectrumElement {}

Expand Down
1 change: 1 addition & 0 deletions 1st-gen/tools/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@
],
"dependencies": {
"@spectrum-web-components/base": "1.9.0",
"@spectrum-web-components/core": "0.0.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.

Theme now depends on core because of

import { version } from '@spectrum-web-components/core/shared/base/version.js';

"@spectrum-web-components/styles": "1.9.0"
},
"types": "./src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion 1st-gen/tools/theme/src/Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import { CSSResult, CSSResultGroup } from '@spectrum-web-components/base';
import { version } from '@spectrum-web-components/base/src/version.js';
import { version } from '@spectrum-web-components/core/shared/base/version.js';
import {
Color,
COLOR_VALUES,
Expand Down
2 changes: 1 addition & 1 deletion 1st-gen/tools/theme/test/theme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
import { Theme } from '@spectrum-web-components/theme';
import { expect } 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';

class DirElement extends Theme {}

Expand Down
2 changes: 1 addition & 1 deletion 1st-gen/web-test-runner.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
alias({
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.

Fix regex

replacement: path.resolve(
__dirname,
'../2nd-gen/packages/core/dist/$1'
Expand Down
Loading
Loading