Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(themes): publish the ./theme.css declarations (#10903)

Cindy Zhang11d55a4172a1
diff --git a/.changeset/theme-css-types-published.md b/.changeset/theme-css-types-published.md
new file mode 100644
index 0000000000..ed5130dd32
--- /dev/null
+++ b/.changeset/theme-css-types-published.md
@@ -0,0 +1,13 @@
+---
+'@astryxdesign/theme-butter': patch
+'@astryxdesign/theme-chocolate': patch
+'@astryxdesign/theme-gothic': patch
+'@astryxdesign/theme-matcha': patch
+'@astryxdesign/theme-neutral': patch
+'@astryxdesign/theme-stone': patch
+'@astryxdesign/theme-y2k': patch
+---
+
+[fix] Theme packages publish the declarations of their `./theme.css` export. The export pointed `types` at `theme.css.d.ts`, which the package didn't ship, so TypeScript found no types for `import '@astryxdesign/theme-<name>/theme.css'`. The export is unchanged; the file is now published.
+
+@cixzhang
diff --git a/packages/themes/butter/package.json b/packages/themes/butter/package.json
index 16d19ff2a4..0ad4468098 100644
--- a/packages/themes/butter/package.json
+++ b/packages/themes/butter/package.json
@@ -59,6 +59,7 @@
"palette.config.json",
"fonts.css",
"fonts.css.d.ts",
+ "theme.css.d.ts",
"!**/*.test.*",
"!**/*.spec.js",
"!**/*.spec.jsx",
diff --git a/packages/themes/chocolate/package.json b/packages/themes/chocolate/package.json
index c8bd503e09..41431c6896 100644
--- a/packages/themes/chocolate/package.json
+++ b/packages/themes/chocolate/package.json
@@ -58,6 +58,7 @@
"src",
"fonts.css",
"fonts.css.d.ts",
+ "theme.css.d.ts",
"!**/*.test.*",
"!**/*.spec.js",
"!**/*.spec.jsx",
diff --git a/packages/themes/gothic/package.json b/packages/themes/gothic/package.json
index cff9e13f10..4e19a5698c 100644
--- a/packages/themes/gothic/package.json
+++ b/packages/themes/gothic/package.json
@@ -58,6 +58,7 @@
"src",
"fonts.css",
"fonts.css.d.ts",
+ "theme.css.d.ts",
"palette.config.json",
"!**/*.test.*",
"!**/*.spec.js",
diff --git a/packages/themes/matcha/package.json b/packages/themes/matcha/package.json
index 73802fa38d..c59708b8f2 100644
--- a/packages/themes/matcha/package.json
+++ b/packages/themes/matcha/package.json
@@ -57,6 +57,7 @@
"src",
"fonts.css",
"fonts.css.d.ts",
+ "theme.css.d.ts",
"palette.config.json",
"!**/*.test.*",
"!**/*.spec.js",
diff --git a/packages/themes/neutral/package.json b/packages/themes/neutral/package.json
index 6baa04471e..08ce975f59 100644
--- a/packages/themes/neutral/package.json
+++ b/packages/themes/neutral/package.json
@@ -58,6 +58,7 @@
"src",
"fonts.css",
"fonts.css.d.ts",
+ "theme.css.d.ts",
"palette.config.json",
"!**/*.test.*",
"!**/*.spec.js",
diff --git a/packages/themes/stone/package.json b/packages/themes/stone/package.json
index a4601d3395..d4828890ee 100644
--- a/packages/themes/stone/package.json
+++ b/packages/themes/stone/package.json
@@ -58,6 +58,7 @@
"src",
"fonts.css",
"fonts.css.d.ts",
+ "theme.css.d.ts",
"palette.config.json",
"!**/*.test.*",
"!**/*.spec.js",
diff --git a/packages/themes/y2k/package.json b/packages/themes/y2k/package.json
index 5cd0726abd..4f3768a519 100644
--- a/packages/themes/y2k/package.json
+++ b/packages/themes/y2k/package.json
@@ -59,6 +59,7 @@
"palette.config.json",
"fonts.css",
"fonts.css.d.ts",
+ "theme.css.d.ts",
"!**/*.test.*",
"!**/*.spec.js",
"!**/*.spec.jsx",
diff --git a/scripts/theme-package-module-format.test.mjs b/scripts/theme-package-module-format.test.mjs
index b140be4e7e..25bd1bc0d0 100644
--- a/scripts/theme-package-module-format.test.mjs
+++ b/scripts/theme-package-module-format.test.mjs
@@ -92,6 +92,26 @@ describe('theme package module formats', () => {
}
}
});
+ it('publishes every file its export map points at', () => {
+ // npm ships only what `files` lists, so a path outside it resolves to
+ // nothing for consumers even though it exists in the repository.
+ const included = manifest.files.filter(entry => !entry.startsWith('!'));
+ const published = file => {
+ const relative = file.replace(/^\.\//, '');
+ return included.some(
+ entry => relative === entry || relative.startsWith(`${entry}/`),
+ );
+ };
+ const targets = [];
+ const collect = value => {
+ if (typeof value === 'string') targets.push(value);
+ else if (value && typeof value === 'object') {
+ Object.values(value).forEach(collect);
+ }
+ };
+ collect(manifest.exports);
+ expect(targets.filter(target => !published(target))).toEqual([]);
+ });
});
}
});