@mui/internal-code-infra 0.0.2 ā 0.0.3-canary.0
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 +6 -4
- package/src/cli/cmdBuild.mjs +14 -0
- package/src/cli/cmdPublish.mjs +9 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-canary.0",
|
|
4
4
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@eslint/compat": "^1.3.2",
|
|
32
32
|
"@eslint/js": "^9.34.0",
|
|
33
33
|
"@next/eslint-plugin-next": "^15.5.0",
|
|
34
|
+
"@octokit/auth-action": "^6.0.1",
|
|
34
35
|
"@octokit/rest": "^22.0.0",
|
|
35
36
|
"@pnpm/find-workspace-dir": "^1000.1.2",
|
|
36
37
|
"babel-plugin-optimize-clsx": "^2.6.2",
|
|
@@ -57,9 +58,9 @@
|
|
|
57
58
|
"semver": "^7.7.2",
|
|
58
59
|
"typescript-eslint": "^8.40.0",
|
|
59
60
|
"yargs": "^18.0.0",
|
|
60
|
-
"@mui/internal-babel-plugin-
|
|
61
|
-
"@mui/internal-babel-plugin-minify-errors": "2.0.
|
|
62
|
-
"@mui/internal-babel-plugin-
|
|
61
|
+
"@mui/internal-babel-plugin-display-name": "1.0.4-canary.6",
|
|
62
|
+
"@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.7",
|
|
63
|
+
"@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.19"
|
|
63
64
|
},
|
|
64
65
|
"peerDependencies": {
|
|
65
66
|
"eslint": "^9.0.0",
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
"publishConfig": {
|
|
91
92
|
"access": "public"
|
|
92
93
|
},
|
|
94
|
+
"gitSha": "aecdbc6e8889d668f534cf38cedbb59f91f33589",
|
|
93
95
|
"scripts": {
|
|
94
96
|
"typescript": "tsc -p tsconfig.json",
|
|
95
97
|
"test": "pnpm -w test --project @mui/internal-code-infra",
|
package/src/cli/cmdBuild.mjs
CHANGED
|
@@ -209,6 +209,20 @@ async function writePackageJson({ packageJson, bundles, outputDir, cwd, addTypes
|
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
|
|
212
|
+
// default condition should come last
|
|
213
|
+
Object.keys(newExports).forEach((key) => {
|
|
214
|
+
const exportVal = newExports[key];
|
|
215
|
+
if (exportVal && typeof exportVal === 'object' && (exportVal.import || exportVal.require)) {
|
|
216
|
+
const defaultExport = exportVal.import || exportVal.require;
|
|
217
|
+
if (exportVal.import) {
|
|
218
|
+
delete exportVal.import;
|
|
219
|
+
} else if (exportVal.require) {
|
|
220
|
+
delete exportVal.require;
|
|
221
|
+
}
|
|
222
|
+
exportVal.default = defaultExport;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
212
226
|
packageJson.exports = newExports;
|
|
213
227
|
|
|
214
228
|
await fs.writeFile(
|
package/src/cli/cmdPublish.mjs
CHANGED
|
@@ -12,8 +12,13 @@ import * as fs from 'node:fs/promises';
|
|
|
12
12
|
import * as semver from 'semver';
|
|
13
13
|
import gitUrlParse from 'git-url-parse';
|
|
14
14
|
import { $ } from 'execa';
|
|
15
|
+
import { createActionAuth } from '@octokit/auth-action';
|
|
15
16
|
import { getWorkspacePackages, publishPackages } from './pnpm.mjs';
|
|
16
17
|
|
|
18
|
+
function getOctokit() {
|
|
19
|
+
return new Octokit({ authStrategy: createActionAuth });
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
/**
|
|
18
23
|
* @typedef {Object} Args
|
|
19
24
|
* @property {boolean} dry-run Run in dry-run mode without publishing
|
|
@@ -92,14 +97,14 @@ async function parseChangelog(changelogPath, version) {
|
|
|
92
97
|
|
|
93
98
|
/**
|
|
94
99
|
* Check if GitHub release already exists
|
|
95
|
-
* @param {Octokit} octokit - GitHub API client
|
|
96
100
|
* @param {string} owner - Repository owner
|
|
97
101
|
* @param {string} repo - Repository name
|
|
98
102
|
* @param {string} version - Version to check
|
|
99
103
|
* @returns {Promise<boolean>} True if release exists
|
|
100
104
|
*/
|
|
101
|
-
async function checkGitHubReleaseExists(
|
|
105
|
+
async function checkGitHubReleaseExists(owner, repo, version) {
|
|
102
106
|
try {
|
|
107
|
+
const octokit = getOctokit();
|
|
103
108
|
await octokit.repos.getReleaseByTag({ owner, repo, tag: `v${version}` });
|
|
104
109
|
return true;
|
|
105
110
|
} catch (/** @type {any} */ error) {
|
|
@@ -184,18 +189,8 @@ async function validateGitHubRelease(version) {
|
|
|
184
189
|
const repoInfo = await getRepositoryInfo();
|
|
185
190
|
console.log(`š Repository: ${repoInfo.owner}/${repoInfo.repo}`);
|
|
186
191
|
|
|
187
|
-
// Check if release already exists on GitHub
|
|
188
|
-
const octokit = new Octokit({
|
|
189
|
-
auth: process.env.GITHUB_TOKEN,
|
|
190
|
-
});
|
|
191
|
-
|
|
192
192
|
console.log(`š Checking if GitHub release v${validVersion} already exists...`);
|
|
193
|
-
const releaseExists = await checkGitHubReleaseExists(
|
|
194
|
-
octokit,
|
|
195
|
-
repoInfo.owner,
|
|
196
|
-
repoInfo.repo,
|
|
197
|
-
validVersion,
|
|
198
|
-
);
|
|
193
|
+
const releaseExists = await checkGitHubReleaseExists(repoInfo.owner, repoInfo.repo, validVersion);
|
|
199
194
|
|
|
200
195
|
if (releaseExists) {
|
|
201
196
|
throw new Error(`GitHub release v${validVersion} already exists`);
|
|
@@ -233,12 +228,9 @@ async function publishToNpm(packages, options) {
|
|
|
233
228
|
async function createRelease(version, changelogContent, repoInfo) {
|
|
234
229
|
console.log('\nš Creating GitHub draft release...');
|
|
235
230
|
|
|
236
|
-
const octokit = new Octokit({
|
|
237
|
-
auth: process.env.GITHUB_TOKEN,
|
|
238
|
-
});
|
|
239
|
-
|
|
240
231
|
const sha = await getCurrentGitSha();
|
|
241
232
|
|
|
233
|
+
const octokit = getOctokit();
|
|
242
234
|
await octokit.repos.createRelease({
|
|
243
235
|
owner: repoInfo.owner,
|
|
244
236
|
repo: repoInfo.repo,
|