@mui/internal-code-infra 0.0.4-canary.50 → 0.0.4-canary.52

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
3
  Copyright (c) 2019 Material-UI SAS
4
4
 
@@ -2,6 +2,7 @@
2
2
  export type Args = {
3
3
  workspaces: string[];
4
4
  check?: boolean;
5
+ baseBranch?: string;
5
6
  };
6
7
  declare const _default: import('yargs').CommandModule<{}, Args>;
7
8
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-code-infra",
3
- "version": "0.0.4-canary.50",
3
+ "version": "0.0.4-canary.52",
4
4
  "author": "MUI Team",
5
5
  "description": "Infra scripts and configs to be used across MUI repos.",
6
6
  "license": "MIT",
@@ -140,8 +140,8 @@
140
140
  "unist-util-visit": "^5.1.0",
141
141
  "yargs": "^18.0.0",
142
142
  "@mui/internal-babel-plugin-display-name": "1.0.4-canary.20",
143
- "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.27",
144
- "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.36"
143
+ "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.36",
144
+ "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.27"
145
145
  },
146
146
  "peerDependencies": {
147
147
  "@next/eslint-plugin-next": "*",
@@ -191,7 +191,7 @@
191
191
  "publishConfig": {
192
192
  "access": "public"
193
193
  },
194
- "gitSha": "4c409b3d174cfefb32e4a3fe633f9aa46f53bce3",
194
+ "gitSha": "199cf2a0437625d612e5c2bbb6e63c1e9c9e8ecc",
195
195
  "scripts": {
196
196
  "build": "tsgo -p tsconfig.build.json",
197
197
  "typescript": "tsgo -noEmit",
@@ -6,6 +6,7 @@
6
6
  * @typedef {Object} Args
7
7
  * @property {string[]} workspaces - List of workspace names to process
8
8
  * @property {boolean} [check] - Check mode - error if the generated content differs from current
9
+ * @property {string} [baseBranch] - Branch to compare PRs against (default: master)
9
10
  */
10
11
 
11
12
  import * as fs from 'node:fs/promises';
@@ -15,16 +16,29 @@ import { toPosixPath } from '../utils/path.mjs';
15
16
  import { getTransitiveDependencies, getWorkspacePackages } from '../utils/pnpm.mjs';
16
17
 
17
18
  /**
18
- * Generate the ignore command string for netlify.toml
19
+ * Generate the ignore command string for netlify.toml.
20
+ *
21
+ * Production and branch deploys (every Netlify $CONTEXT other than
22
+ * "deploy-preview") always build, so downstream plugins (e.g. e2e triggers)
23
+ * run on every deploy and catch regressions in external dependencies even
24
+ * when the commit doesn't touch the watched paths.
25
+ *
26
+ * Only deploy-previews (PR previews) are eligible to be skipped: they diff
27
+ * against the merge-base with origin/<baseBranch>. This way a PR rebase whose
28
+ * head commit doesn't touch the watched paths still rebuilds when the PR as a
29
+ * whole introduces changes to them — otherwise downstream plugins silently
30
+ * never run.
31
+ *
19
32
  * @param {string[]} paths - Array of paths to include in the ignore command
20
33
  * @param {string} packagePath - Absolute path to the package directory
21
34
  * @param {string} workspaceRoot - Absolute path to the workspace root
35
+ * @param {string} baseBranch - Branch to compare PRs against
22
36
  * @returns {string} The ignore command string
23
37
  */
24
- function generateIgnoreCommand(paths, packagePath, workspaceRoot) {
38
+ function generateIgnoreCommand(paths, packagePath, workspaceRoot, baseBranch) {
25
39
  const relFromBase = `${toPosixPath(path.relative(packagePath, workspaceRoot))}/`;
26
40
  const pathsStr = paths.join(' ');
27
- return ` ignore = "cd ${relFromBase} && git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ${pathsStr}"`;
41
+ return ` ignore = """cd ${relFromBase} && [ "$CONTEXT" = "deploy-preview" ] && git fetch origin ${baseBranch} --depth=500 -q && git diff --quiet FETCH_HEAD...$COMMIT_REF -- ${pathsStr}"""`;
28
42
  }
29
43
 
30
44
  /**
@@ -94,6 +108,12 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
94
108
  default: false,
95
109
  describe: 'Check if the netlify.toml needs updating without modifying it',
96
110
  })
111
+ .option('base-branch', {
112
+ type: 'string',
113
+ default: 'master',
114
+ describe:
115
+ "Branch to compare PRs against (the site's production branch on Netlify). Production and branch deploys always rebuild regardless of this value.",
116
+ })
97
117
  .example('$0 netlify-ignore @mui/internal-docs-infra', 'Update netlify.toml for a workspace')
98
118
  .example(
99
119
  '$0 netlify-ignore @mui/internal-docs-infra @mui/internal-code-infra',
@@ -105,7 +125,7 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
105
125
  );
106
126
  },
107
127
  handler: async (argv) => {
108
- const { workspaces, check = false } = argv;
128
+ const { workspaces, check = false, baseBranch = 'master' } = argv;
109
129
 
110
130
  // Get the workspace root
111
131
  const workspaceRoot = await findWorkspaceDir(process.cwd());
@@ -157,7 +177,12 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
157
177
  const allPaths = [...relativePaths, 'pnpm-lock.yaml'];
158
178
 
159
179
  // Generate the ignore command for this workspace
160
- const newIgnoreCommand = generateIgnoreCommand(allPaths, workspacePath, workspaceRoot);
180
+ const newIgnoreCommand = generateIgnoreCommand(
181
+ allPaths,
182
+ workspacePath,
183
+ workspaceRoot,
184
+ baseBranch,
185
+ );
161
186
 
162
187
  // Update or check the netlify.toml file
163
188
  await updateNetlifyToml(tomlPath, newIgnoreCommand, check);