From cc0d9718f7ac461a3455fcd3cd5049a37fee1bf6 Mon Sep 17 00:00:00 2001 From: Arno V Date: Wed, 18 Sep 2024 13:27:42 -0400 Subject: [PATCH] fix(ui-styles): missing CSS in all new independent packages in prod (#680) --- .../plugins/__tests__/tailwindPlugin.test.ts | 56 +++++++++++++++---- .../src/plugins/tailwindcss/tailwindPlugin.ts | 23 +++++++- 2 files changed, 67 insertions(+), 12 deletions(-) diff --git a/packages/ui-styles/src/plugins/__tests__/tailwindPlugin.test.ts b/packages/ui-styles/src/plugins/__tests__/tailwindPlugin.test.ts index e1a2589f..7d3ef7a1 100644 --- a/packages/ui-styles/src/plugins/__tests__/tailwindPlugin.test.ts +++ b/packages/ui-styles/src/plugins/__tests__/tailwindPlugin.test.ts @@ -5,12 +5,12 @@ import { customContentPath } from "../tailwindcss/tailwindPlugin"; describe("Non-DOM tests", () => { it("should return an array with ui-system and ui-components", () => { - expect(customContentPath[0]).toContain( - "node_modules/@versini/ui-components", - ); - expect(customContentPath[1]).toContain("node_modules/@versini/ui-form"); - expect(customContentPath[2]).toContain("node_modules/@versini/ui-icons"); - expect(customContentPath[3]).toContain("node_modules/@versini/ui-system"); + expect( + customContentPath.some((path) => path.includes("ui-system")), + ).toBeTruthy(); + expect( + customContentPath.some((path) => path.includes("ui-components")), + ).toBeTruthy(); }); it("should return a default configuration", () => { @@ -20,10 +20,28 @@ describe("Non-DOM tests", () => { const content = (mergedConfig.content as string[]).join(" "); expect(content).not.toContain("./src/*.{js,ts,jsx,tsx}"); - expect(content).toContain("node_modules/@versini/ui-components"); - expect(content).toContain("node_modules/@versini/ui-form"); + + expect(content).toContain("node_modules/@versini/ui-anchor"); + expect(content).toContain("node_modules/@versini/ui-bubble"); + expect(content).toContain("node_modules/@versini/ui-button"); + expect(content).toContain("node_modules/@versini/ui-card"); + expect(content).toContain("node_modules/@versini/ui-footer"); + expect(content).toContain("node_modules/@versini/ui-header"); + expect(content).toContain("node_modules/@versini/ui-hooks"); expect(content).toContain("node_modules/@versini/ui-icons"); + expect(content).toContain("node_modules/@versini/ui-main"); + expect(content).toContain("node_modules/@versini/ui-menu"); + expect(content).toContain("node_modules/@versini/ui-panel"); + expect(content).toContain("node_modules/@versini/ui-pill"); + expect(content).toContain("node_modules/@versini/ui-private"); + expect(content).toContain("node_modules/@versini/ui-spinner"); expect(content).toContain("node_modules/@versini/ui-system"); + expect(content).toContain("node_modules/@versini/ui-table"); + expect(content).toContain("node_modules/@versini/ui-textarea"); + expect(content).toContain("node_modules/@versini/ui-textinput"); + expect(content).toContain("node_modules/@versini/ui-toggle"); + expect(content).toContain("node_modules/@versini/ui-components"); + expect(content).toContain("node_modules/@versini/ui-form"); expect(mergedConfig.safelist).toContain("mt-0"); expect(mergedConfig.safelist).toContain("mt-52"); @@ -45,10 +63,28 @@ describe("Non-DOM tests", () => { const content = (mergedConfig.content as string[]).join(" "); expect(content).toContain("./src/*.{js,ts,jsx,tsx}"); - expect(content).toContain("node_modules/@versini/ui-components"); - expect(content).toContain("node_modules/@versini/ui-form"); + + expect(content).toContain("node_modules/@versini/ui-anchor"); + expect(content).toContain("node_modules/@versini/ui-bubble"); + expect(content).toContain("node_modules/@versini/ui-button"); + expect(content).toContain("node_modules/@versini/ui-card"); + expect(content).toContain("node_modules/@versini/ui-footer"); + expect(content).toContain("node_modules/@versini/ui-header"); + expect(content).toContain("node_modules/@versini/ui-hooks"); expect(content).toContain("node_modules/@versini/ui-icons"); + expect(content).toContain("node_modules/@versini/ui-main"); + expect(content).toContain("node_modules/@versini/ui-menu"); + expect(content).toContain("node_modules/@versini/ui-panel"); + expect(content).toContain("node_modules/@versini/ui-pill"); + expect(content).toContain("node_modules/@versini/ui-private"); + expect(content).toContain("node_modules/@versini/ui-spinner"); expect(content).toContain("node_modules/@versini/ui-system"); + expect(content).toContain("node_modules/@versini/ui-table"); + expect(content).toContain("node_modules/@versini/ui-textarea"); + expect(content).toContain("node_modules/@versini/ui-textinput"); + expect(content).toContain("node_modules/@versini/ui-toggle"); + expect(content).toContain("node_modules/@versini/ui-components"); + expect(content).toContain("node_modules/@versini/ui-form"); expect(mergedConfig.safelist).toContain("mt-0"); expect(mergedConfig.safelist).toContain("mt-52"); diff --git a/packages/ui-styles/src/plugins/tailwindcss/tailwindPlugin.ts b/packages/ui-styles/src/plugins/tailwindcss/tailwindPlugin.ts index 81fc4769..160fb277 100644 --- a/packages/ui-styles/src/plugins/tailwindcss/tailwindPlugin.ts +++ b/packages/ui-styles/src/plugins/tailwindcss/tailwindPlugin.ts @@ -21,10 +21,29 @@ export type TailwindConfig = { * added here. */ export const customContentPath = [ - "@versini/ui-components", - "@versini/ui-form", + "@versini/ui-anchor", + "@versini/ui-bubble", + "@versini/ui-button", + "@versini/ui-card", + "@versini/ui-footer", + "@versini/ui-header", + "@versini/ui-hooks", "@versini/ui-icons", + "@versini/ui-main", + "@versini/ui-menu", + "@versini/ui-panel", + "@versini/ui-pill", + "@versini/ui-private", + "@versini/ui-spinner", "@versini/ui-system", + "@versini/ui-table", + "@versini/ui-textarea", + "@versini/ui-textinput", + "@versini/ui-toggle", + + // the following are legacy packages and should eventually be removed + "@versini/ui-components", + "@versini/ui-form", ].map( (pkg) => `${process.cwd()}/node_modules/${pkg}/dist/**/*.{js,ts,jsx,tsx}`, );