openxiangda 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -73,6 +73,7 @@ export function isWorkspaceTailwindConfigCurrent(content) {
|
|
|
73
73
|
|
|
74
74
|
export function isWorkspaceTailwindCssCurrent(content) {
|
|
75
75
|
return (
|
|
76
|
+
/@import\s+["']openxiangda\/styles\/tokens\.css["'];/.test(content) &&
|
|
76
77
|
/@layer\s+tailwind-base\s*\{\s*@tailwind\s+base\s*;\s*\}/s.test(content) &&
|
|
77
78
|
!/@layer\s+tailwind-base\s*,\s*antd\s*;/.test(content) &&
|
|
78
79
|
tailwindDirectives
|
|
@@ -270,7 +271,7 @@ export function validateWorkspaceTailwindConfig(workspaceRoot) {
|
|
|
270
271
|
: "";
|
|
271
272
|
if (!isWorkspaceTailwindCssCurrent(cssContent)) {
|
|
272
273
|
return [
|
|
273
|
-
"src/index.css must keep Tailwind base in @layer tailwind-base and avoid declaring antd layer",
|
|
274
|
+
"src/index.css must import openxiangda/styles/tokens.css, keep Tailwind base in @layer tailwind-base, and avoid declaring antd layer",
|
|
274
275
|
];
|
|
275
276
|
}
|
|
276
277
|
return [];
|
|
@@ -60,6 +60,7 @@ describe("workspace Tailwind config helpers", () => {
|
|
|
60
60
|
expect(cssContent).toContain("@tailwind utilities;");
|
|
61
61
|
expect(postcssContent).toContain("createOpenXiangdaNamespaceCssPlugin");
|
|
62
62
|
expect(postcssContent).toContain('require("openxiangda/build")');
|
|
63
|
+
expect(cssContent).toContain('@import "openxiangda/styles/tokens.css";');
|
|
63
64
|
expect(validateWorkspaceTailwindConfig(workspaceRoot)).toEqual([]);
|
|
64
65
|
});
|
|
65
66
|
|
|
@@ -128,7 +129,9 @@ module.exports = {
|
|
|
128
129
|
});
|
|
129
130
|
|
|
130
131
|
it("keeps current Tailwind base layer index css unchanged", () => {
|
|
131
|
-
const source = `@
|
|
132
|
+
const source = `@import "openxiangda/styles/tokens.css";
|
|
133
|
+
|
|
134
|
+
@layer tailwind-base {
|
|
132
135
|
@tailwind base;
|
|
133
136
|
}
|
|
134
137
|
|
|
@@ -143,6 +146,20 @@ module.exports = {
|
|
|
143
146
|
expect(patchWorkspaceTailwindCss(source)).toBe(source);
|
|
144
147
|
});
|
|
145
148
|
|
|
149
|
+
it("adds missing OpenXiangda design tokens import to otherwise current index css", () => {
|
|
150
|
+
const nextContent = patchWorkspaceTailwindCss(`@layer tailwind-base {
|
|
151
|
+
@tailwind base;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@tailwind components;
|
|
155
|
+
@tailwind utilities;
|
|
156
|
+
`);
|
|
157
|
+
|
|
158
|
+
expect(nextContent).toContain('@import "openxiangda/styles/tokens.css";');
|
|
159
|
+
expect(nextContent.match(/openxiangda\/styles\/tokens\.css/g)).toHaveLength(1);
|
|
160
|
+
expect(nextContent).toContain("@layer tailwind-base");
|
|
161
|
+
});
|
|
162
|
+
|
|
146
163
|
it("patches standard PostCSS config with openxiangda namespace css plugin", () => {
|
|
147
164
|
const nextContent = patchWorkspacePostcssConfig(`module.exports = {
|
|
148
165
|
plugins: {
|
|
@@ -210,7 +227,7 @@ module.exports = { plugins: [custom()] };
|
|
|
210
227
|
);
|
|
211
228
|
|
|
212
229
|
expect(validateWorkspaceTailwindConfig(workspaceRoot)).toEqual([
|
|
213
|
-
"src/index.css must keep Tailwind base in @layer tailwind-base and avoid declaring antd layer",
|
|
230
|
+
"src/index.css must import openxiangda/styles/tokens.css, keep Tailwind base in @layer tailwind-base, and avoid declaring antd layer",
|
|
214
231
|
]);
|
|
215
232
|
});
|
|
216
233
|
});
|