Skip to content

Commit b9895e5

Browse files
authored
ci: add next components to bundle check (#3174)
1 parent 231307f commit b9895e5

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed

packages/core/src/components/RadioButton/RadioButton.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,7 @@ const RadioButton = forwardRef(
8787
text = "",
8888
value = "",
8989
name = "",
90-
/**
91-
* Radio button label class name
92-
*/
9390
labelClassName,
94-
/**
95-
* Radio button marker class name
96-
*/
9791
radioButtonClassName,
9892
disabled = false,
9993
autoFocus,
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export * from "./Modal";
21
export * from "./next/index";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from "./AttentionBox";
22
export * from "./Dropdown";
3+
export * from "../../components/Modal";

scripts/bundle-check/compare-bundles.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require("path");
33
const bytes = require("bytes");
44

55
function extractJson(content) {
6-
const jsonMatch = content.match(/\[[\s\S]*?\]/);
6+
const jsonMatch = content.match(/^\[[\s\S]*\]$/m);
77

88
if (!jsonMatch) {
99
throw new Error("No JSON array found in content");
@@ -46,6 +46,9 @@ Array.from(allComponents)
4646
if (componentName.startsWith("packages/components/")) {
4747
const packageName = componentName.split("/")[2];
4848
displayName = `@vibe/${packageName}`;
49+
} else if (componentName.includes("/next/")) {
50+
const baseName = path.basename(componentName, path.extname(componentName));
51+
displayName = `${baseName} (Next)`;
4952
} else {
5053
displayName = path.basename(componentName, path.extname(componentName));
5154
}

scripts/bundle-check/generate-size-limit-config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const path = require("path");
33

44
const rootPath = process.cwd();
55
const distIndexPath = path.join(rootPath, "packages/core/dist/src/index.js");
6+
const distNextPath = path.join(rootPath, "packages/core/dist/src/components/next.js");
67
const componentsPath = path.join(rootPath, "packages/components");
78
const sizeLimitConfigPath = path.join(rootPath, ".size-limit.js");
89

@@ -27,6 +28,26 @@ function generateSizeLimitConfig() {
2728
console.log(`Core dist index file not found at ${distIndexPath}.`);
2829
}
2930

31+
// Process @next components
32+
if (fs.existsSync(distNextPath)) {
33+
const nextContent = fs.readFileSync(distNextPath, "utf8");
34+
const exportRegex = /export\{.*?\}from"(\.\/[^"]+\.js)";/g;
35+
36+
let match;
37+
let nextComponentsCount = 0;
38+
while ((match = exportRegex.exec(nextContent)) !== null) {
39+
const relativePath = match[1];
40+
const fullPath = path.join("packages/core/dist/src/components/", relativePath).replace(/\\/g, "/");
41+
allComponents.push({
42+
path: fullPath
43+
});
44+
nextComponentsCount++;
45+
}
46+
console.log(`Found ${nextComponentsCount} @next components.`);
47+
} else {
48+
console.log(`@next dist file not found at ${distNextPath}.`);
49+
}
50+
3051
// Process component packages
3152
if (fs.existsSync(componentsPath)) {
3253
const componentPackages = fs

0 commit comments

Comments
 (0)