@mui/internal-code-infra 0.0.4-canary.72 → 0.0.4-canary.73
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/utils/git.d.mts +7 -0
- package/package.json +2 -2
- package/src/cli/cmdPublish.mjs +8 -2
- package/src/utils/git.mjs +11 -0
package/build/utils/git.d.mts
CHANGED
|
@@ -20,3 +20,10 @@ export declare function getRepositoryInfo(cwd?: string): Promise<RepoInfo>;
|
|
|
20
20
|
* @returns {Promise<string>} Current git commit SHA
|
|
21
21
|
*/
|
|
22
22
|
export declare function getCurrentGitSha(): Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Check whether a tag already exists on the origin remote
|
|
25
|
+
* @param {string} tagName - Tag name to check (e.g. `v1.2.3`)
|
|
26
|
+
* @param {string} [cwd=process.cwd()]
|
|
27
|
+
* @returns {Promise<boolean>} True if the tag exists on origin
|
|
28
|
+
*/
|
|
29
|
+
export declare function remoteGitTagExists(tagName: string, cwd?: string): Promise<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.0.4-canary.
|
|
3
|
+
"version": "0.0.4-canary.73",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"publishConfig": {
|
|
187
187
|
"access": "public"
|
|
188
188
|
},
|
|
189
|
-
"gitSha": "
|
|
189
|
+
"gitSha": "a646322dc5697683ef464c5a05a0de6240de9f05",
|
|
190
190
|
"scripts": {
|
|
191
191
|
"build": "tsgo -p tsconfig.build.json",
|
|
192
192
|
"typescript": "tsgo -noEmit",
|
package/src/cli/cmdPublish.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
publishPackages,
|
|
24
24
|
validatePublishDependencies,
|
|
25
25
|
} from '../utils/pnpm.mjs';
|
|
26
|
-
import { getCurrentGitSha, getRepositoryInfo } from '../utils/git.mjs';
|
|
26
|
+
import { getCurrentGitSha, getRepositoryInfo, remoteGitTagExists } from '../utils/git.mjs';
|
|
27
27
|
|
|
28
28
|
const isCI = envCI().isCi;
|
|
29
29
|
|
|
@@ -365,7 +365,13 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
365
365
|
console.log(`✅ Published ${pkg.name}@${pkg.version}`);
|
|
366
366
|
});
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
// Tag the root version when it's new. Arbitrary package publishes that don't
|
|
369
|
+
// bump the root version don't create a new tag, so skip in that case.
|
|
370
|
+
if (await remoteGitTagExists(`v${version}`)) {
|
|
371
|
+
console.log(`ℹ️ Git tag v${version} already exists, skipping tag creation.`);
|
|
372
|
+
} else {
|
|
373
|
+
await createGitTag(version, dryRun);
|
|
374
|
+
}
|
|
369
375
|
|
|
370
376
|
// Create GitHub release or git tag after successful npm publishing
|
|
371
377
|
if (githubRelease && githubReleaseData) {
|
package/src/utils/git.mjs
CHANGED
|
@@ -73,3 +73,14 @@ export async function getCurrentGitSha() {
|
|
|
73
73
|
const result = await $`git rev-parse HEAD`;
|
|
74
74
|
return result.stdout.trim();
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Check whether a tag already exists on the origin remote
|
|
79
|
+
* @param {string} tagName - Tag name to check (e.g. `v1.2.3`)
|
|
80
|
+
* @param {string} [cwd=process.cwd()]
|
|
81
|
+
* @returns {Promise<boolean>} True if the tag exists on origin
|
|
82
|
+
*/
|
|
83
|
+
export async function remoteGitTagExists(tagName, cwd = process.cwd()) {
|
|
84
|
+
const { stdout } = await $({ cwd })`git ls-remote --tags origin refs/tags/${tagName}`;
|
|
85
|
+
return stdout.trim().length > 0;
|
|
86
|
+
}
|