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