@mui/internal-code-infra 0.0.2-canary.33 โ 0.0.2-canary.34
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/README.md +1 -1
- package/package.json +4 -4
- package/src/cli/cmdPublish.mjs +32 -26
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.0.2-canary.
|
|
3
|
+
"version": "0.0.2-canary.34",
|
|
4
4
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"typescript-eslint": "^8.35.1",
|
|
59
59
|
"yargs": "^17.7.2",
|
|
60
60
|
"@mui/internal-babel-plugin-display-name": "1.0.4-canary.3",
|
|
61
|
-
"@mui/internal-babel-plugin-
|
|
62
|
-
"@mui/internal-babel-plugin-
|
|
61
|
+
"@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.4",
|
|
62
|
+
"@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.13"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"eslint": "^9.0.0",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitSha": "
|
|
92
|
+
"gitSha": "5ed847881c8cf90a3f943edfa9161b7c74d4c98a",
|
|
93
93
|
"scripts": {
|
|
94
94
|
"typescript": "tsc -p tsconfig.json",
|
|
95
95
|
"test": "pnpm -w test --project @mui/internal-code-infra",
|
package/src/cli/cmdPublish.mjs
CHANGED
|
@@ -22,19 +22,12 @@ import { getWorkspacePackages, publishPackages } from './pnpm.mjs';
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Get the version to release from the root package.json
|
|
25
|
-
* @returns {Promise<string>} Version string
|
|
25
|
+
* @returns {Promise<string | null>} Version string
|
|
26
26
|
*/
|
|
27
27
|
async function getReleaseVersion() {
|
|
28
28
|
const result = await $`pnpm pkg get version`;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const validVersion = semver.valid(version);
|
|
33
|
-
if (!validVersion) {
|
|
34
|
-
throw new Error(`Invalid version in root package.json: ${version}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return validVersion;
|
|
29
|
+
const version = JSON.parse(result.stdout.trim());
|
|
30
|
+
return semver.valid(version);
|
|
38
31
|
}
|
|
39
32
|
|
|
40
33
|
/**
|
|
@@ -171,15 +164,20 @@ async function createGitTag(version, dryRun = false) {
|
|
|
171
164
|
|
|
172
165
|
/**
|
|
173
166
|
* Validate GitHub release requirements
|
|
174
|
-
* @param {string} version - Version to validate
|
|
175
|
-
* @returns {Promise<{changelogContent: string, repoInfo: {owner: string, repo: string}}>}
|
|
167
|
+
* @param {string | null} version - Version to validate
|
|
168
|
+
* @returns {Promise<{changelogContent: string, version: string, repoInfo: {owner: string, repo: string}}>}
|
|
176
169
|
*/
|
|
177
170
|
async function validateGitHubRelease(version) {
|
|
178
171
|
console.log('๐ Validating GitHub release requirements...');
|
|
179
172
|
|
|
173
|
+
const validVersion = semver.valid(version);
|
|
174
|
+
if (!validVersion) {
|
|
175
|
+
throw new Error(`Invalid version in root package.json: ${version}`);
|
|
176
|
+
}
|
|
177
|
+
|
|
180
178
|
// Check if CHANGELOG.md exists and parse it
|
|
181
|
-
console.log(`๐ Parsing CHANGELOG.md for version ${
|
|
182
|
-
const changelogContent = await parseChangelog('CHANGELOG.md',
|
|
179
|
+
console.log(`๐ Parsing CHANGELOG.md for version ${validVersion}...`);
|
|
180
|
+
const changelogContent = await parseChangelog('CHANGELOG.md', validVersion);
|
|
183
181
|
console.log('โ
Found changelog content for version');
|
|
184
182
|
|
|
185
183
|
// Get repository info
|
|
@@ -191,20 +189,20 @@ async function validateGitHubRelease(version) {
|
|
|
191
189
|
auth: process.env.GITHUB_TOKEN,
|
|
192
190
|
});
|
|
193
191
|
|
|
194
|
-
console.log(`๐ Checking if GitHub release v${
|
|
192
|
+
console.log(`๐ Checking if GitHub release v${validVersion} already exists...`);
|
|
195
193
|
const releaseExists = await checkGitHubReleaseExists(
|
|
196
194
|
octokit,
|
|
197
195
|
repoInfo.owner,
|
|
198
196
|
repoInfo.repo,
|
|
199
|
-
|
|
197
|
+
validVersion,
|
|
200
198
|
);
|
|
201
199
|
|
|
202
200
|
if (releaseExists) {
|
|
203
|
-
throw new Error(`GitHub release v${
|
|
201
|
+
throw new Error(`GitHub release v${validVersion} already exists`);
|
|
204
202
|
}
|
|
205
203
|
console.log('โ
GitHub release does not exist yet');
|
|
206
204
|
|
|
207
|
-
return { changelogContent, repoInfo };
|
|
205
|
+
return { changelogContent, repoInfo, version: validVersion };
|
|
208
206
|
}
|
|
209
207
|
|
|
210
208
|
/**
|
|
@@ -261,6 +259,7 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
261
259
|
describe: 'Publish packages to npm',
|
|
262
260
|
builder: (yargs) => {
|
|
263
261
|
return yargs
|
|
262
|
+
.parserConfiguration({ 'boolean-negation': false })
|
|
264
263
|
.option('dry-run', {
|
|
265
264
|
type: 'boolean',
|
|
266
265
|
default: false,
|
|
@@ -273,9 +272,9 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
273
272
|
});
|
|
274
273
|
},
|
|
275
274
|
handler: async (argv) => {
|
|
276
|
-
const { dryRun = false, githubRelease = false } = argv;
|
|
275
|
+
const { dryRun = false, githubRelease = false, noGitChecks = false } = argv;
|
|
277
276
|
|
|
278
|
-
const options = { dryRun };
|
|
277
|
+
const options = { dryRun, noGitChecks };
|
|
279
278
|
|
|
280
279
|
if (dryRun) {
|
|
281
280
|
console.log('๐งช Running in DRY RUN mode - no actual publishing will occur\n');
|
|
@@ -292,11 +291,11 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
292
291
|
|
|
293
292
|
// Get version from root package.json
|
|
294
293
|
const version = await getReleaseVersion();
|
|
295
|
-
console.log(`๐ Release version: ${version}`);
|
|
296
294
|
|
|
297
295
|
// Early validation for GitHub release (before any publishing)
|
|
298
296
|
let githubReleaseData = null;
|
|
299
297
|
if (githubRelease) {
|
|
298
|
+
console.log(`๐ Release version: ${version}`);
|
|
300
299
|
githubReleaseData = await validateGitHubRelease(version);
|
|
301
300
|
}
|
|
302
301
|
|
|
@@ -304,11 +303,18 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
304
303
|
await publishToNpm(allPackages, options);
|
|
305
304
|
|
|
306
305
|
// Create GitHub release or git tag after successful npm publishing
|
|
307
|
-
if (githubRelease && githubReleaseData
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
306
|
+
if (githubRelease && githubReleaseData) {
|
|
307
|
+
if (dryRun) {
|
|
308
|
+
console.log('\n๐ Would create GitHub draft release (dry-run)');
|
|
309
|
+
console.log(githubReleaseData?.changelogContent);
|
|
310
|
+
} else {
|
|
311
|
+
await createRelease(
|
|
312
|
+
githubReleaseData.version,
|
|
313
|
+
githubReleaseData.changelogContent,
|
|
314
|
+
githubReleaseData.repoInfo,
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
} else if (version) {
|
|
312
318
|
// Create git tag when not doing GitHub release
|
|
313
319
|
await createGitTag(version, dryRun);
|
|
314
320
|
}
|