@mui/internal-code-infra 0.0.4-canary.3 → 0.0.4-canary.5

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.
@@ -5,6 +5,7 @@ export type PublishOptions = import('../utils/pnpm.mjs').PublishOptions;
5
5
  export type Args = {
6
6
  dryRun?: boolean;
7
7
  githubRelease?: boolean;
8
+ package?: string[];
8
9
  };
9
10
  export type Commit = {
10
11
  sha: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-code-infra",
3
- "version": "0.0.4-canary.3",
3
+ "version": "0.0.4-canary.5",
4
4
  "description": "Infra scripts and configs to be used across MUI repos.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,6 +43,9 @@
43
43
  "./brokenLinksChecker": {
44
44
  "types": "./build/brokenLinksChecker/index.d.mts",
45
45
  "default": "./src/brokenLinksChecker/index.mjs"
46
+ },
47
+ "./build-env": {
48
+ "types": "./src/build-env.d.ts"
46
49
  }
47
50
  },
48
51
  "bin": {
@@ -114,8 +117,8 @@
114
117
  "unified": "^11.0.5",
115
118
  "yargs": "^18.0.0",
116
119
  "@mui/internal-babel-plugin-display-name": "1.0.4-canary.14",
117
- "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.33",
118
- "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.24"
120
+ "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.24",
121
+ "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.33"
119
122
  },
120
123
  "peerDependencies": {
121
124
  "@next/eslint-plugin-next": "*",
@@ -161,7 +164,7 @@
161
164
  "publishConfig": {
162
165
  "access": "public"
163
166
  },
164
- "gitSha": "b172a15e6b44720b15353ba8b15816cbbf5674e8",
167
+ "gitSha": "993d672e95892fc2f0e64b730dca5a79644b8d0a",
165
168
  "scripts": {
166
169
  "build": "tsgo -p tsconfig.build.json",
167
170
  "typescript": "tsgo -noEmit",
@@ -0,0 +1,13 @@
1
+ export {};
2
+
3
+ declare global {
4
+ interface Env {
5
+ NODE_ENV?: 'production' | undefined;
6
+ }
7
+
8
+ interface Process {
9
+ env: Env;
10
+ }
11
+
12
+ const process: Process;
13
+ }
@@ -28,6 +28,7 @@ import { getCurrentGitSha, getRepositoryInfo } from '../utils/git.mjs';
28
28
  * @typedef {Object} Args
29
29
  * @property {boolean} [dryRun] - Whether to run in dry-run mode
30
30
  * @property {boolean} [githubRelease] - Whether to create GitHub releases for canary packages
31
+ * @property {string[]} [package] - Only publish canary versions for specified packages (by name)
31
32
  */
32
33
 
33
34
  const CANARY_TAG = 'canary';
@@ -132,7 +133,7 @@ async function getPackageToDependencyMap() {
132
133
  if (!pkg.name) {
133
134
  return acc;
134
135
  }
135
- const deps = Object.keys(pkg.dependencies || {});
136
+ const deps = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
136
137
  if (!deps.length) {
137
138
  return acc;
138
139
  }
@@ -495,7 +496,11 @@ async function publishCanaryVersions(
495
496
  let publishSuccess = false;
496
497
  try {
497
498
  console.log(`📤 Publishing ${packagesToPublish.length} canary versions...`);
498
- await publishPackages(packagesToPublish, { ...options, noGitChecks: true, tag: CANARY_TAG });
499
+ await publishPackages(packagesToPublish, {
500
+ dryRun: options.dryRun,
501
+ noGitChecks: true,
502
+ tag: CANARY_TAG,
503
+ });
499
504
 
500
505
  packagesToPublish.forEach((pkg) => {
501
506
  const canaryVersion = canaryVersions.get(pkg.name);
@@ -542,10 +547,15 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
542
547
  type: 'boolean',
543
548
  default: false,
544
549
  description: 'Create GitHub releases for published packages',
550
+ })
551
+ .option('package', {
552
+ type: 'string',
553
+ array: true,
554
+ description: 'Only publish canary versions for specified packages (by name)',
545
555
  });
546
556
  },
547
557
  handler: async (argv) => {
548
- const { dryRun = false, githubRelease = false } = argv;
558
+ const { dryRun = false, githubRelease = false, package: explicitPackages = [] } = argv;
549
559
 
550
560
  const options = { dryRun, githubRelease };
551
561
 
@@ -566,14 +576,40 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
566
576
  return;
567
577
  }
568
578
 
579
+ // Validate that all workspace dependencies are explicitly passed by the user
580
+ if (explicitPackages.length > 0) {
581
+ const pkgDepMap = await getPackageToDependencyMap();
582
+ const missingDeps = new Set();
583
+ for (const pkg of explicitPackages) {
584
+ const deps = pkgDepMap[pkg] || [];
585
+ deps.forEach((dep) => {
586
+ if (!explicitPackages.includes(dep)) {
587
+ missingDeps.add(dep);
588
+ }
589
+ });
590
+ }
591
+ if (missingDeps.size > 0) {
592
+ throw new Error(
593
+ `Missing required workspace dependencies:
594
+ ${Array.from(missingDeps).join('\n ')}
595
+ Pass all workspace dependencies explicitly through the --package argument.`,
596
+ );
597
+ }
598
+ }
599
+
569
600
  // Check for canary tag to determine selective publishing
570
601
  const canaryTag = await getLastCanaryTag();
571
602
 
572
603
  console.log('🔍 Checking for packages changed since canary tag...');
573
- const packages = canaryTag
604
+ let packages = canaryTag
574
605
  ? await getWorkspacePackages({ sinceRef: canaryTag, publicOnly: true })
575
606
  : allPackages;
576
607
 
608
+ // If user provided package list, filter to only those in packageNames
609
+ if (explicitPackages.length > 0) {
610
+ packages = packages.filter((pkg) => explicitPackages.includes(pkg.name));
611
+ }
612
+
577
613
  console.log(`📋 Found ${packages.length} packages(s) for canary publishing:`);
578
614
  packages.forEach((pkg) => {
579
615
  console.log(` • ${pkg.name}@${pkg.version}`);