@mui/internal-code-infra 0.0.4-canary.14 → 0.0.4-canary.16

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 CHANGED
@@ -37,22 +37,33 @@ This is stored in the `docs` top-level directory.
37
37
 
38
38
  Whenever new packages are added to the repo (that will get published to npm) or a private package is turned into a public one, follow the below steps before invoking the publish workflow of the previous section.
39
39
 
40
- 1. Goto your repo's code base on your system, open terminal and run:
40
+ 1. Go to your repo's code base on your system, then log in to npm using
41
+
42
+ ```bash
43
+ npm login
44
+ ```
45
+
46
+ 2. Once logged-in, open terminal and run:
41
47
 
42
48
  ```bash
43
49
  pnpm code-infra publish-new-package
44
50
  ```
45
51
 
46
52
  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.
53
+ If publishing fails with npm asking for `otp`, run the command again with 6 digit auth code from your authenticator app where you've added npm; Google Authenticator, Authy or similar:
54
+
55
+ ```bash
56
+ pnpm code-infra publish-new-package --otp=123456
57
+ ```
47
58
 
48
- 2. Goto the settings link for each packages, ie, `https://www.npmjs.com/package/<pkg-name>/access` , and setup `Trusted Publisher`.
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
- 4. Fill in the details of the repo -
59
+ 3. Go to the settings link for each package, e.g., `https://www.npmjs.com/package/<pkg-name>/access`, and setup `Trusted Publisher`.
60
+ 4. In the `Select your publisher` step in the above link, click on the `GitHub Actions` button to configure GitHub Actions-based trusted publishing.
61
+ 5. Fill in the details of the repo -
51
62
  1. `Organization or user` as `mui`,
52
63
  2. `Repository` as per the new package
53
64
  3. `Workflow filename*` should be `publish.yml`
54
65
  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
- 5. In the `Publishing access` section, toggle the recommended option of `Require two-factor authentication and disallow tokens`.
56
- 6. Finally, save the changes by clicking on `Update Package Settings` button.
66
+ 6. In the `Publishing access` section, toggle the recommended option of `Require two-factor authentication and disallow tokens`.
67
+ 7. Finally, save the changes by clicking on `Update Package Settings` button.
57
68
 
58
69
  After following these steps, the `Publish` workflow can be invoked again.
@@ -1,9 +1,11 @@
1
1
  export type Args = {
2
2
  dryRun?: boolean;
3
+ otp?: string;
3
4
  };
4
5
  /**
5
6
  * @typedef {Object} Args
6
7
  * @property {boolean} [dryRun] If true, will only log the commands without executing them
8
+ * @property {string} [otp] 6 digit auth code to forward to npm for two-factor authentication
7
9
  */
8
10
  declare const _default: import("yargs").CommandModule<{}, Args>;
9
11
  export default /** @type {import('yargs').CommandModule<{}, Args>} */ _default;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@mui/internal-code-infra",
3
- "version": "0.0.4-canary.14",
3
+ "version": "0.0.4-canary.16",
4
4
  "description": "Infra scripts and configs to be used across MUI repos.",
5
- "type": "module",
6
5
  "license": "MIT",
6
+ "type": "module",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/mui/mui-public.git",
@@ -116,9 +116,9 @@
116
116
  "typescript-eslint": "^8.57.1",
117
117
  "unified": "^11.0.5",
118
118
  "yargs": "^18.0.0",
119
- "@mui/internal-babel-plugin-display-name": "1.0.4-canary.15",
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
+ "@mui/internal-babel-plugin-display-name": "1.0.4-canary.16",
120
+ "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.25",
121
+ "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.34"
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": "0913e8254e8626b56e03ea048567da0273f0bd18",
167
+ "gitSha": "efcec841291fc0941e740ebbf6a13439a1c4494a",
168
168
  "scripts": {
169
169
  "build": "tsgo -p tsconfig.build.json",
170
170
  "typescript": "tsgo -noEmit",
@@ -16,17 +16,34 @@ import { getWorkspacePackages } from '../utils/pnpm.mjs';
16
16
  /**
17
17
  * @typedef {Object} Args
18
18
  * @property {boolean} [dryRun] If true, will only log the commands without executing them
19
+ * @property {string} [otp] 6 digit auth code to forward to npm for two-factor authentication
19
20
  */
20
21
 
21
22
  export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
22
23
  command: 'publish-new-package [pkg...]',
23
24
  describe: 'Publish new empty package(s) to the npm registry.',
24
25
  builder: (yargs) =>
25
- yargs.option('dryRun', {
26
- type: 'boolean',
27
- default: false,
28
- description: 'If true, will only log the commands without executing them.',
29
- }),
26
+ yargs
27
+ .option('dryRun', {
28
+ type: 'boolean',
29
+ default: false,
30
+ description: 'If true, will only log the commands without executing them.',
31
+ })
32
+ .option('otp', {
33
+ type: 'string',
34
+ description: '6 digit auth code to forward to npm for two-factor authentication.',
35
+ coerce: (value) => {
36
+ if (value === undefined) {
37
+ return value;
38
+ }
39
+
40
+ if (!/^\d{6}$/.test(value)) {
41
+ throw new Error('The --otp option must be a 6 digit number.');
42
+ }
43
+
44
+ return value;
45
+ },
46
+ }),
30
47
  async handler(args) {
31
48
  console.log(`🔍 Detecting new packages to publish in workspace...`);
32
49
  const newPackages = await getWorkspacePackages({ nonPublishedOnly: true });
@@ -78,6 +95,9 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
78
95
  if (args.dryRun) {
79
96
  publishArgs.push('--dry-run');
80
97
  }
98
+ if (args.otp) {
99
+ publishArgs.push('--otp', args.otp);
100
+ }
81
101
  await $({
82
102
  cwd: newPkgDir,
83
103
  })`npm publish --access public --tag=canary ${publishArgs}`;