@mui/internal-bundle-size-checker 1.0.9-canary.73 → 1.0.9-canary.74
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/build/syncPrComment.d.ts +1 -2
- package/package.json +2 -2
- package/src/cli.js +1 -50
- package/src/syncPrComment.js +2 -3
package/build/syncPrComment.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export type SyncPrCommentResult = {
|
|
|
8
8
|
/**
|
|
9
9
|
* Syncs a PR comment via the dashboard API.
|
|
10
10
|
* @param {string} repo - Repository in owner/repo format
|
|
11
|
-
* @param {Record<string, object>} sections - Section-specific parameters
|
|
12
11
|
* @returns {Promise<SyncPrCommentResult>}
|
|
13
12
|
*/
|
|
14
|
-
export declare function syncPrComment(repo: string
|
|
13
|
+
export declare function syncPrComment(repo: string): Promise<SyncPrCommentResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-bundle-size-checker",
|
|
3
|
-
"version": "1.0.9-canary.
|
|
3
|
+
"version": "1.0.9-canary.74",
|
|
4
4
|
"description": "Bundle size checker for MUI packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/micromatch": "4.0.10",
|
|
45
45
|
"@types/yargs": "17.0.35"
|
|
46
46
|
},
|
|
47
|
-
"gitSha": "
|
|
47
|
+
"gitSha": "fcc57442eeb92486028b70bb43a2b7d09eaa7e52",
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsgo -p tsconfig.build.json",
|
|
50
50
|
"test": "pnpm -w test --project @mui/internal-bundle-size-checker",
|
package/src/cli.js
CHANGED
|
@@ -93,45 +93,6 @@ async function getBundleSizes(args, config) {
|
|
|
93
93
|
return sizeArrays.flat();
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
/**
|
|
97
|
-
* Posts initial "in progress" PR comment via dashboard API.
|
|
98
|
-
* Called for all CI builds — the server resolves the associated PR from
|
|
99
|
-
* OIDC claims. If no PR exists yet (branch pushed before PR created),
|
|
100
|
-
* the server returns a no-op response.
|
|
101
|
-
* @param {NormalizedBundleSizeCheckerConfig} config - The loaded configuration
|
|
102
|
-
* @returns {Promise<void>}
|
|
103
|
-
*/
|
|
104
|
-
async function postInitialPrComment(config) {
|
|
105
|
-
const ciInfo = getCiInfo();
|
|
106
|
-
|
|
107
|
-
if (!ciInfo) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!ciInfo.slug) {
|
|
112
|
-
throw new Error('PR commenting enabled but repository information missing in CI build');
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (!config.upload) {
|
|
116
|
-
throw new Error('PR commenting requires upload configuration to determine the API URL');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
try {
|
|
120
|
-
// eslint-disable-next-line no-console
|
|
121
|
-
console.log('Posting initial PR comment via dashboard API...');
|
|
122
|
-
|
|
123
|
-
const result = await syncPrComment(ciInfo.slug, { bundleSize: { status: 'pending' } });
|
|
124
|
-
|
|
125
|
-
// eslint-disable-next-line no-console
|
|
126
|
-
console.log(
|
|
127
|
-
result.skipped ? 'No open PR found for this branch, skipping.' : 'Initial PR comment posted.',
|
|
128
|
-
);
|
|
129
|
-
} catch (/** @type {any} */ error) {
|
|
130
|
-
console.error('Failed to post initial PR comment:', error.message);
|
|
131
|
-
// Don't fail the build for comment failures
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
96
|
/**
|
|
136
97
|
* Main runner function
|
|
137
98
|
* @param {CommandLineArgs} argv - Command line arguments
|
|
@@ -143,11 +104,6 @@ async function run(argv) {
|
|
|
143
104
|
|
|
144
105
|
const config = await loadConfig(rootDir);
|
|
145
106
|
|
|
146
|
-
// Post initial PR comment if enabled and in CI environment
|
|
147
|
-
if (config && config.comment) {
|
|
148
|
-
await postInitialPrComment(config);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
107
|
// eslint-disable-next-line no-console
|
|
152
108
|
console.log(`Starting bundle size snapshot creation with ${concurrency} workers...`);
|
|
153
109
|
|
|
@@ -217,12 +173,7 @@ async function run(argv) {
|
|
|
217
173
|
// eslint-disable-next-line no-console
|
|
218
174
|
console.log('Syncing PR comment via dashboard API...');
|
|
219
175
|
|
|
220
|
-
const result = await syncPrComment(ciInfo.slug
|
|
221
|
-
bundleSize: {
|
|
222
|
-
status: 'complete',
|
|
223
|
-
trackedBundles: trackedBundles.length > 0 ? trackedBundles : undefined,
|
|
224
|
-
},
|
|
225
|
-
});
|
|
176
|
+
const result = await syncPrComment(ciInfo.slug);
|
|
226
177
|
|
|
227
178
|
// eslint-disable-next-line no-console
|
|
228
179
|
console.log(
|
package/src/syncPrComment.js
CHANGED
|
@@ -9,10 +9,9 @@ const DEFAULT_API_URL = 'https://code-infra-dashboard.onrender.com';
|
|
|
9
9
|
/**
|
|
10
10
|
* Syncs a PR comment via the dashboard API.
|
|
11
11
|
* @param {string} repo - Repository in owner/repo format
|
|
12
|
-
* @param {Record<string, object>} sections - Section-specific parameters
|
|
13
12
|
* @returns {Promise<SyncPrCommentResult>}
|
|
14
13
|
*/
|
|
15
|
-
export async function syncPrComment(repo
|
|
14
|
+
export async function syncPrComment(repo) {
|
|
16
15
|
const oidcToken = process.env.CIRCLE_OIDC_TOKEN_V2;
|
|
17
16
|
if (!oidcToken) {
|
|
18
17
|
throw new Error('CIRCLE_OIDC_TOKEN_V2 environment variable is required for PR comment sync');
|
|
@@ -24,7 +23,7 @@ export async function syncPrComment(repo, sections) {
|
|
|
24
23
|
const response = await fetch(url, {
|
|
25
24
|
method: 'POST',
|
|
26
25
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${oidcToken}` },
|
|
27
|
-
body: JSON.stringify({ repo
|
|
26
|
+
body: JSON.stringify({ repo }),
|
|
28
27
|
});
|
|
29
28
|
|
|
30
29
|
if (!response.ok) {
|