@mui/internal-code-infra 0.0.4-canary.13 → 0.0.4-canary.14
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 +2 -2
- package/build/utils/pnpm.d.mts +28 -5
- package/build/utils/testUtils.d.mts +7 -0
- package/package.json +4 -4
- package/src/cli/cmdPublishCanary.mjs +12 -2
- package/src/cli/cmdPublishNewPackage.mjs +1 -1
- package/src/utils/build.test.mjs +546 -575
- package/src/utils/pnpm.mjs +57 -23
- package/src/utils/pnpm.test.mjs +580 -0
- package/src/utils/testUtils.mjs +18 -0
- package/src/utils/typescript.test.mjs +249 -272
package/README.md
CHANGED
|
@@ -45,13 +45,13 @@ pnpm code-infra publish-new-package
|
|
|
45
45
|
|
|
46
46
|
This command detects the new public packages in the repo and asks for your confirmation before publishing them to the npm registry. Add the `--dryRun` flag to skip the actual publishing.
|
|
47
47
|
|
|
48
|
-
2. Goto the settings link for each packages, ie, https://www.npmjs.com/package/<pkg-name>/access , and setup `Trusted Publisher`.
|
|
48
|
+
2. Goto the settings link for each packages, ie, `https://www.npmjs.com/package/<pkg-name>/access` , and setup `Trusted Publisher`.
|
|
49
49
|
3. In `Select your publisher` step in the above link, click on the `Github Actions` button to configure Github actions based trusted publishing.
|
|
50
50
|
4. Fill in the details of the repo -
|
|
51
51
|
1. `Organization or user` as `mui`,
|
|
52
52
|
2. `Repository` as per the new package
|
|
53
53
|
3. `Workflow filename*` should be `publish.yml`
|
|
54
|
-
4. `Environment name` should be `npm-publish`
|
|
54
|
+
4. `Environment name` should be `npm-publish` or `npm-publish-internal` based on whether the package is user facing package or internal package respectively.
|
|
55
55
|
5. In the `Publishing access` section, toggle the recommended option of `Require two-factor authentication and disallow tokens`.
|
|
56
56
|
6. Finally, save the changes by clicking on `Update Package Settings` button.
|
|
57
57
|
|
package/build/utils/pnpm.d.mts
CHANGED
|
@@ -69,10 +69,12 @@ export type GetTransitiveDependenciesOptions = {
|
|
|
69
69
|
/**
|
|
70
70
|
* Get all transitive workspace dependencies for a set of packages.
|
|
71
71
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
72
|
+
* Only follows deps whose version spec starts with `workspace:` (e.g. `workspace:*`
|
|
73
|
+
* or `workspace:^`), meaning they are sourced directly from the monorepo. Pinned
|
|
74
|
+
* external versions (e.g. `^1.0.0`) are ignored even when the package name exists
|
|
75
|
+
* in the workspace. Traverses `dependencies` and optionally `devDependencies`.
|
|
76
|
+
* Results are cached per package so each package is read from disk at most once
|
|
77
|
+
* regardless of how many roots depend on it.
|
|
76
78
|
*
|
|
77
79
|
* @param {string[]} packageNames - Package names to start the traversal from
|
|
78
80
|
* @param {GetTransitiveDependenciesOptions} [options]
|
|
@@ -80,7 +82,28 @@ export type GetTransitiveDependenciesOptions = {
|
|
|
80
82
|
*/
|
|
81
83
|
export declare function getTransitiveDependencies(packageNames: string[], options?: GetTransitiveDependenciesOptions): Promise<Set<string>>;
|
|
82
84
|
/**
|
|
83
|
-
*
|
|
85
|
+
* Pure validation logic: given a publish set and workspace maps, checks that all
|
|
86
|
+
* transitive hard workspace dependencies are covered and none are private.
|
|
87
|
+
*
|
|
88
|
+
* A hard dependency is one listed in `dependencies` (not `peerDependencies` or
|
|
89
|
+
* `devDependencies`) using a `workspace:` version specifier (e.g. `workspace:*` or
|
|
90
|
+
* `workspace:^`). Peer dependencies are never bundled and dev dependencies are not installed
|
|
91
|
+
* on consumer devices - both are excluded regardless of version specifier. Pinned-version
|
|
92
|
+
* references in `dependencies` are also excluded - they resolve from the registry and do
|
|
93
|
+
* not need to be co-published.
|
|
94
|
+
*
|
|
95
|
+
* @param {PublicPackage[]} packages - The packages intended for publishing
|
|
96
|
+
* @param {Map<string, PublicPackage | PrivatePackage>} workspacePackageByName - All workspace packages by name
|
|
97
|
+
* @param {Map<string, string>} workspacePathByName - Map of workspace package name to directory path
|
|
98
|
+
* @returns {Promise<{issues: string[]}>}
|
|
99
|
+
* List of human-readable issue strings. Empty when the dependency set is valid.
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
export declare function checkPublishDependencies(packages: PublicPackage[], workspacePackageByName: Map<string, PublicPackage | PrivatePackage>, workspacePathByName: Map<string, string>): Promise<{
|
|
103
|
+
issues: string[];
|
|
104
|
+
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Validate that a set of packages covers all of their transitive hard workspace dependencies,
|
|
84
107
|
* and that none of those dependencies are private (which would make them unpublishable).
|
|
85
108
|
*
|
|
86
109
|
* @param {PublicPackage[]} packages - The packages intended for publishing
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a temporary directory and registers an `onTestFinished` hook to
|
|
3
|
+
* remove it automatically when the current test ends — even if the test throws.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Promise<string>} The path of the created temporary directory.
|
|
6
|
+
*/
|
|
7
|
+
export declare function makeTempDir(): Promise<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
|
+
"version": "0.0.4-canary.14",
|
|
4
4
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
"unified": "^11.0.5",
|
|
118
118
|
"yargs": "^18.0.0",
|
|
119
119
|
"@mui/internal-babel-plugin-display-name": "1.0.4-canary.15",
|
|
120
|
-
"@mui/internal-babel-plugin-
|
|
121
|
-
"@mui/internal-babel-plugin-
|
|
120
|
+
"@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.24",
|
|
121
|
+
"@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.33"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
124
124
|
"@next/eslint-plugin-next": "*",
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"publishConfig": {
|
|
165
165
|
"access": "public"
|
|
166
166
|
},
|
|
167
|
-
"gitSha": "
|
|
167
|
+
"gitSha": "0913e8254e8626b56e03ea048567da0273f0bd18",
|
|
168
168
|
"scripts": {
|
|
169
169
|
"build": "tsgo -p tsconfig.build.json",
|
|
170
170
|
"typescript": "tsgo -noEmit",
|
|
@@ -159,7 +159,10 @@ async function prepareChangelogsFromGitCli(packagesToPublish, allPackages, canar
|
|
|
159
159
|
|
|
160
160
|
const transitiveDepSets = await Promise.all(
|
|
161
161
|
allPackages.map((pkg) =>
|
|
162
|
-
getTransitiveDependencies([pkg.name], {
|
|
162
|
+
getTransitiveDependencies([pkg.name], {
|
|
163
|
+
includeDev: false,
|
|
164
|
+
workspacePathByName,
|
|
165
|
+
}),
|
|
163
166
|
),
|
|
164
167
|
);
|
|
165
168
|
|
|
@@ -315,7 +318,14 @@ async function getLastCanaryTag() {
|
|
|
315
318
|
// Tag might not exist locally, which is fine
|
|
316
319
|
}
|
|
317
320
|
|
|
318
|
-
|
|
321
|
+
try {
|
|
322
|
+
await $`git fetch origin tag ${CANARY_TAG}`;
|
|
323
|
+
} catch (err) {
|
|
324
|
+
// Tag might not exist on the remote yet (first canary run), which is fine
|
|
325
|
+
if (!(/** @type {Error} */ (err).message?.includes("couldn't find remote ref"))) {
|
|
326
|
+
throw err;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
319
329
|
const { stdout: remoteCanaryTag } = await $`git ls-remote --tags origin ${CANARY_TAG}`;
|
|
320
330
|
return remoteCanaryTag.trim() ? CANARY_TAG : null;
|
|
321
331
|
}
|
|
@@ -62,7 +62,7 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
62
62
|
version: '0.0.1',
|
|
63
63
|
repository: {
|
|
64
64
|
type: 'git',
|
|
65
|
-
url: `git+https://github.com/${repo.owner}/${repo.
|
|
65
|
+
url: `git+https://github.com/${repo.owner}/${repo.repo}.git`,
|
|
66
66
|
directory: toPosixPath(path.relative(workspaceDir, pkg.path)),
|
|
67
67
|
},
|
|
68
68
|
};
|