@mui/internal-code-infra 0.0.3-canary.6 → 0.0.3-canary.61
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 +55 -0
- package/build/babel-config.d.mts +40 -0
- package/build/brokenLinksChecker/index.d.mts +138 -0
- package/build/cli/cmdArgosPush.d.mts +13 -0
- package/build/cli/cmdBuild.d.mts +56 -0
- package/build/cli/cmdCopyFiles.d.mts +20 -0
- package/build/cli/cmdExtractErrorCodes.d.mts +3 -0
- package/build/cli/cmdGithubAuth.d.mts +6 -0
- package/build/cli/cmdListWorkspaces.d.mts +18 -0
- package/build/cli/cmdPublish.d.mts +27 -0
- package/build/cli/cmdPublishCanary.d.mts +30 -0
- package/build/cli/cmdPublishNewPackage.d.mts +8 -0
- package/build/cli/cmdSetVersionOverrides.d.mts +9 -0
- package/build/cli/cmdValidateBuiltTypes.d.mts +2 -0
- package/build/cli/index.d.mts +1 -0
- package/build/eslint/baseConfig.d.mts +10 -0
- package/build/eslint/docsConfig.d.mts +4 -0
- package/build/eslint/extensions.d.mts +8 -0
- package/build/eslint/index.d.mts +4 -0
- package/build/eslint/jsonConfig.d.mts +4 -0
- package/build/eslint/material-ui/config.d.mts +8 -0
- package/build/eslint/material-ui/index.d.mts +2 -0
- package/build/eslint/material-ui/rules/disallow-active-element-as-key-event-target.d.mts +5 -0
- package/build/eslint/material-ui/rules/disallow-react-api-in-server-components.d.mts +2 -0
- package/build/eslint/material-ui/rules/docgen-ignore-before-comment.d.mts +2 -0
- package/build/eslint/material-ui/rules/mui-name-matches-component-name.d.mts +5 -0
- package/build/eslint/material-ui/rules/no-empty-box.d.mts +5 -0
- package/build/eslint/material-ui/rules/no-restricted-resolved-imports.d.mts +12 -0
- package/build/eslint/material-ui/rules/no-styled-box.d.mts +5 -0
- package/build/eslint/material-ui/rules/rules-of-use-theme-variants.d.mts +9 -0
- package/build/eslint/material-ui/rules/straight-quotes.d.mts +5 -0
- package/build/eslint/testConfig.d.mts +14 -0
- package/build/markdownlint/duplicate-h1.d.mts +27 -0
- package/build/markdownlint/git-diff.d.mts +8 -0
- package/build/markdownlint/index.d.mts +56 -0
- package/build/markdownlint/straight-quotes.d.mts +8 -0
- package/build/markdownlint/table-alignment.d.mts +8 -0
- package/build/markdownlint/terminal-language.d.mts +8 -0
- package/build/prettier.d.mts +20 -0
- package/build/stylelint/index.d.mts +32 -0
- package/build/utils/babel.d.mts +71 -0
- package/build/utils/build.d.mts +50 -0
- package/build/utils/changelog.d.mts +64 -0
- package/build/utils/credentials.d.mts +17 -0
- package/build/utils/extractErrorCodes.d.mts +19 -0
- package/build/utils/git.d.mts +26 -0
- package/build/utils/github.d.mts +41 -0
- package/build/utils/pnpm.d.mts +238 -0
- package/build/utils/typescript.d.mts +35 -0
- package/package.json +92 -42
- package/src/babel-config.mjs +52 -8
- package/src/brokenLinksChecker/__fixtures__/static-site/broken-links.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +22 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/example.md +9 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +21 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +17 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/index.html +26 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +5 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +19 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +24 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +28 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +19 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +31 -0
- package/src/brokenLinksChecker/index.mjs +641 -0
- package/src/brokenLinksChecker/index.test.ts +178 -0
- package/src/cli/cmdArgosPush.mjs +13 -2
- package/src/cli/cmdBuild.mjs +228 -31
- package/src/cli/cmdGithubAuth.mjs +36 -0
- package/src/cli/cmdListWorkspaces.mjs +2 -2
- package/src/cli/cmdPublish.mjs +203 -49
- package/src/cli/cmdPublishCanary.mjs +404 -46
- package/src/cli/cmdPublishNewPackage.mjs +86 -0
- package/src/cli/cmdSetVersionOverrides.mjs +17 -1
- package/src/cli/cmdValidateBuiltTypes.mjs +49 -0
- package/src/cli/index.mjs +6 -2
- package/src/cli/packageJson.d.ts +729 -0
- package/src/eslint/baseConfig.mjs +96 -78
- package/src/eslint/docsConfig.mjs +26 -13
- package/src/eslint/extensions.mjs +8 -8
- package/src/eslint/jsonConfig.mjs +40 -0
- package/src/eslint/material-ui/config.mjs +8 -9
- package/src/eslint/material-ui/rules/mui-name-matches-component-name.mjs +4 -2
- package/src/eslint/material-ui/rules/rules-of-use-theme-variants.mjs +2 -1
- package/src/eslint/testConfig.mjs +72 -66
- package/src/stylelint/index.mjs +46 -0
- package/src/untyped-plugins.d.ts +13 -0
- package/src/{cli → utils}/babel.mjs +10 -3
- package/src/utils/build.mjs +27 -1
- package/src/utils/changelog.mjs +157 -0
- package/src/utils/credentials.mjs +71 -0
- package/src/utils/extractErrorCodes.mjs +2 -2
- package/src/utils/git.mjs +67 -0
- package/src/utils/github.mjs +263 -0
- package/src/{cli → utils}/pnpm.mjs +23 -13
- package/src/{cli → utils}/typescript.mjs +13 -7
- package/src/cli/cmdJsonLint.mjs +0 -69
|
@@ -31,6 +31,7 @@ import * as semver from 'semver';
|
|
|
31
31
|
* @typedef {Object} PublishOptions
|
|
32
32
|
* @property {boolean} [dryRun] - Whether to run in dry-run mode
|
|
33
33
|
* @property {boolean} [noGitChecks] - Whether to skip git checks
|
|
34
|
+
* @property {string} [tag] - NPM dist tag to publish to
|
|
34
35
|
*/
|
|
35
36
|
|
|
36
37
|
/**
|
|
@@ -45,6 +46,7 @@ import * as semver from 'semver';
|
|
|
45
46
|
* @typedef {Object} GetWorkspacePackagesOptions
|
|
46
47
|
* @property {string|null} [sinceRef] - Git reference to filter changes since
|
|
47
48
|
* @property {boolean} [publicOnly=false] - Whether to filter to only public packages
|
|
49
|
+
* @property {boolean} [nonPublishedOnly=false] - Whether to filter to only non-published packages. It by default means public packages yet to be published.
|
|
48
50
|
*/
|
|
49
51
|
|
|
50
52
|
/**
|
|
@@ -55,6 +57,10 @@ import * as semver from 'semver';
|
|
|
55
57
|
* @returns {Promise<PublicPackage[]>} Array of packages
|
|
56
58
|
*
|
|
57
59
|
* @overload
|
|
60
|
+
* @param {{ nonPublishedOnly: true } & GetWorkspacePackagesOptions} [options={}] - Options for filtering packages
|
|
61
|
+
* @returns {Promise<PublicPackage[]>} Array of packages
|
|
62
|
+
*
|
|
63
|
+
* @overload
|
|
58
64
|
* @param {{ publicOnly?: false | undefined } & GetWorkspacePackagesOptions} [options={}] - Options for filtering packages
|
|
59
65
|
* @returns {Promise<PrivatePackage[]>} Array of packages
|
|
60
66
|
*
|
|
@@ -66,7 +72,7 @@ import * as semver from 'semver';
|
|
|
66
72
|
* @returns {Promise<(PrivatePackage | PublicPackage)[]>} Array of packages
|
|
67
73
|
*/
|
|
68
74
|
export async function getWorkspacePackages(options = {}) {
|
|
69
|
-
const { sinceRef = null, publicOnly = false } = options;
|
|
75
|
+
const { sinceRef = null, publicOnly = false, nonPublishedOnly = false } = options;
|
|
70
76
|
|
|
71
77
|
// Build command with conditional filter
|
|
72
78
|
const filterArg = sinceRef ? ['--filter', `...[${sinceRef}]`] : [];
|
|
@@ -90,6 +96,19 @@ export async function getWorkspacePackages(options = {}) {
|
|
|
90
96
|
];
|
|
91
97
|
});
|
|
92
98
|
|
|
99
|
+
if (nonPublishedOnly) {
|
|
100
|
+
// Check if any of the packages are new/need manual publishing first.
|
|
101
|
+
const filteredPublicPackages = filteredPackages.filter((pkg) => !pkg.isPrivate);
|
|
102
|
+
|
|
103
|
+
const results = await Promise.all(
|
|
104
|
+
filteredPublicPackages.map(async (pkg) => {
|
|
105
|
+
const url = `${process.env.npm_config_registry || 'https://registry.npmjs.org'}/${pkg.name}`;
|
|
106
|
+
return fetch(url).then((res) => res.status === 404);
|
|
107
|
+
}),
|
|
108
|
+
);
|
|
109
|
+
return filteredPublicPackages.filter((_pkg, index) => !!results[index]);
|
|
110
|
+
}
|
|
111
|
+
|
|
93
112
|
return filteredPackages;
|
|
94
113
|
}
|
|
95
114
|
|
|
@@ -129,12 +148,12 @@ export async function getPackageVersionInfo(packageName, baseVersion) {
|
|
|
129
148
|
/**
|
|
130
149
|
* Publish packages with the given options
|
|
131
150
|
* @param {PublicPackage[]} packages - Packages to publish
|
|
132
|
-
* @param {string} tag - npm tag to publish with
|
|
133
151
|
* @param {PublishOptions} [options={}] - Publishing options
|
|
134
152
|
* @returns {Promise<void>}
|
|
135
153
|
*/
|
|
136
|
-
export async function publishPackages(packages,
|
|
154
|
+
export async function publishPackages(packages, options = {}) {
|
|
137
155
|
const args = [];
|
|
156
|
+
const tag = options.tag ?? 'latest';
|
|
138
157
|
|
|
139
158
|
// Add package filters
|
|
140
159
|
packages.forEach((pkg) => {
|
|
@@ -156,7 +175,7 @@ export async function publishPackages(packages, tag, options = {}) {
|
|
|
156
175
|
/**
|
|
157
176
|
* Read package.json from a directory
|
|
158
177
|
* @param {string} packagePath - Path to package directory
|
|
159
|
-
* @returns {Promise<
|
|
178
|
+
* @returns {Promise<import('../cli/packageJson').PackageJson>} Parsed package.json content
|
|
160
179
|
*/
|
|
161
180
|
export async function readPackageJson(packagePath) {
|
|
162
181
|
const content = await fs.readFile(path.join(packagePath, 'package.json'), 'utf8');
|
|
@@ -174,15 +193,6 @@ export async function writePackageJson(packagePath, packageJson) {
|
|
|
174
193
|
await fs.writeFile(path.join(packagePath, 'package.json'), content);
|
|
175
194
|
}
|
|
176
195
|
|
|
177
|
-
/**
|
|
178
|
-
* Get current git SHA
|
|
179
|
-
* @returns {Promise<string>} Current git commit SHA
|
|
180
|
-
*/
|
|
181
|
-
export async function getCurrentGitSha() {
|
|
182
|
-
const result = await $`git rev-parse HEAD`;
|
|
183
|
-
return result.stdout.trim();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
196
|
/**
|
|
187
197
|
* Resolve a package@version specifier to an exact version
|
|
188
198
|
* @param {string} packageSpec - Package specifier in format "package@version"
|
|
@@ -8,6 +8,7 @@ import { globby } from 'globby';
|
|
|
8
8
|
import * as fs from 'node:fs/promises';
|
|
9
9
|
import * as os from 'node:os';
|
|
10
10
|
import * as path from 'node:path';
|
|
11
|
+
import { mapConcurrently } from '../utils/build.mjs';
|
|
11
12
|
|
|
12
13
|
const $$ = $({ stdio: 'inherit' });
|
|
13
14
|
|
|
@@ -27,7 +28,8 @@ export async function emitDeclarations(tsconfig, outDir) {
|
|
|
27
28
|
--emitDeclarationOnly
|
|
28
29
|
--noEmit false
|
|
29
30
|
--composite false
|
|
30
|
-
--incremental false
|
|
31
|
+
--incremental false
|
|
32
|
+
--declarationMap false`;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/**
|
|
@@ -80,8 +82,9 @@ async function postProcessDeclarations({ directory }) {
|
|
|
80
82
|
[pluginRemoveImports, { test: /\.css$/ }],
|
|
81
83
|
];
|
|
82
84
|
|
|
83
|
-
await
|
|
84
|
-
dtsFiles
|
|
85
|
+
await mapConcurrently(
|
|
86
|
+
dtsFiles,
|
|
87
|
+
async (dtsFile) => {
|
|
85
88
|
const result = await babel.transformFileAsync(dtsFile, {
|
|
86
89
|
configFile: false,
|
|
87
90
|
plugins: babelPlugins,
|
|
@@ -92,7 +95,8 @@ async function postProcessDeclarations({ directory }) {
|
|
|
92
95
|
} else {
|
|
93
96
|
console.error('failed to transform', dtsFile);
|
|
94
97
|
}
|
|
95
|
-
}
|
|
98
|
+
},
|
|
99
|
+
20,
|
|
96
100
|
);
|
|
97
101
|
}
|
|
98
102
|
|
|
@@ -107,11 +111,13 @@ async function renameDeclarations({ directory }) {
|
|
|
107
111
|
return;
|
|
108
112
|
}
|
|
109
113
|
console.log(`Renaming d.ts files to d.mts in ${directory}`);
|
|
110
|
-
await
|
|
111
|
-
dtsFiles
|
|
114
|
+
await mapConcurrently(
|
|
115
|
+
dtsFiles,
|
|
116
|
+
async (dtsFile) => {
|
|
112
117
|
const newFileName = dtsFile.replace(/\.d\.ts$/, '.d.mts');
|
|
113
118
|
await fs.rename(dtsFile, newFileName);
|
|
114
|
-
}
|
|
119
|
+
},
|
|
120
|
+
20,
|
|
115
121
|
);
|
|
116
122
|
}
|
|
117
123
|
|
package/src/cli/cmdJsonLint.mjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import fs from 'node:fs/promises';
|
|
5
|
-
import { globby } from 'globby';
|
|
6
|
-
import path from 'node:path';
|
|
7
|
-
import { mapConcurrently } from '../utils/build.mjs';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @typedef {Object} Args
|
|
11
|
-
* @property {boolean} [silent] Run in silent mode without logging
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @param {string} message
|
|
16
|
-
* @returns {string}
|
|
17
|
-
*/
|
|
18
|
-
const passMessage = (message) => `✓ ${chalk.gray(message)}`;
|
|
19
|
-
/**
|
|
20
|
-
* @param {string} message
|
|
21
|
-
* @returns {string}
|
|
22
|
-
*/
|
|
23
|
-
const failMessage = (message) => `❌ ${chalk.whiteBright(message)}`;
|
|
24
|
-
|
|
25
|
-
export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
26
|
-
command: 'jsonlint',
|
|
27
|
-
describe: 'Lint JSON files',
|
|
28
|
-
builder: (yargs) => {
|
|
29
|
-
return yargs.option('silent', {
|
|
30
|
-
type: 'boolean',
|
|
31
|
-
default: false,
|
|
32
|
-
description: "Don't log file names.",
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
handler: async (args) => {
|
|
36
|
-
const cwd = process.cwd();
|
|
37
|
-
|
|
38
|
-
const filenames = await globby('**/*.json', {
|
|
39
|
-
cwd,
|
|
40
|
-
gitignore: true,
|
|
41
|
-
ignoreFiles: ['.lintignore'],
|
|
42
|
-
ignore: ['**/tsconfig*.json'],
|
|
43
|
-
followSymbolicLinks: false,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
let passed = true;
|
|
47
|
-
|
|
48
|
-
await mapConcurrently(
|
|
49
|
-
filenames,
|
|
50
|
-
async (filename) => {
|
|
51
|
-
const content = await fs.readFile(path.join(cwd, filename), { encoding: 'utf8' });
|
|
52
|
-
try {
|
|
53
|
-
JSON.parse(content);
|
|
54
|
-
if (!args.silent) {
|
|
55
|
-
// eslint-disable-next-line no-console
|
|
56
|
-
console.log(passMessage(filename));
|
|
57
|
-
}
|
|
58
|
-
} catch (error) {
|
|
59
|
-
passed = false;
|
|
60
|
-
console.error(failMessage(`Error parsing ${filename}:\n\n${String(error)}`));
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
20,
|
|
64
|
-
);
|
|
65
|
-
if (!passed) {
|
|
66
|
-
throw new Error('❌ At least one file did not pass. Check the console output');
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
});
|