diff --git a/.depcheckrc.yml b/.depcheckrc.yml index 3494b20d6..f68333a8c 100644 --- a/.depcheckrc.yml +++ b/.depcheckrc.yml @@ -17,6 +17,7 @@ ignores: - 'ts-jest' - 'ts-node' - 'typedoc' + - 'typescript' # Ignore plugins for tools - '@typescript-eslint/*' - 'eslint-config-*' diff --git a/.github/workflows/publish-preview.yml b/.github/workflows/publish-preview.yml index 78283ed9b..e6555e1db 100644 --- a/.github/workflows/publish-preview.yml +++ b/.github/workflows/publish-preview.yml @@ -15,7 +15,7 @@ jobs: with: rename-after-install-and-build: true environment: default-branch - docs-url: 'https://github.com/MetaMask/core/blob/main/docs/processes/preview-builds.md' + docs-url: 'https://github.com/MetaMask/internal-snaps/blob/main/docs/processes/preview-builds.md' secrets: PUBLISH_PREVIEW_NPM_TOKEN: ${{ secrets.PUBLISH_PREVIEW_NPM_TOKEN }} BUILD_ENV: | diff --git a/docs/processes/preview-builds.md b/docs/processes/preview-builds.md index 4fa51c859..de741488b 100644 --- a/docs/processes/preview-builds.md +++ b/docs/processes/preview-builds.md @@ -15,25 +15,10 @@ Generally, when working with preview builds, you will follow this process: To publish preview builds: 1. Create a pull request with the changes to your package(s). -2. Post a comment on the pull request with the text `@metamaskbot publish-previews`. The `publish-preview` GitHub action will kick off to generate and publish preview builds for all packages in the monorepo. +2. Post a comment on the pull request with the text `@metamaskbot publish-preview`. The `publish-preview` GitHub action will kick off to generate and publish preview builds for all packages in the monorepo. 3. After a few minutes, you will see a new comment that lists the newly published packages along with their versions. -
Publishing preview builds as an independent contributor -
-Note that the steps above will only work if you are a member of the MetaMask engineering team on GitHub. If you are not, you'll need to follow some different steps: - -1. First, you'll need access to an NPM organization under which the preview builds will be published. If you have not already done so, you can either [create a new organization](https://www.npmjs.com/org/create) or [convert your existing username into an organization](https://www.npmjs.com/org/upgrade). -2. Open the `package.json` for each package that you want to publish, and change the NPM scope in the package's name from `@metamask` to reflect your NPM organization. -3. Run the following command to create and publish preview builds for all packages in the monorepo (replacing `NPM_ORG` as appropriate): - - ```bash - yarn prepare-preview-builds "@" "$(git rev-parse --short HEAD)" - yarn build - yarn publish-previews - ``` - - You will see a list of the newly published packages along with their versions. -
+This workflow is available to members of the MetaMask engineering team on GitHub. Independent contributors should use [local builds](./local-builds.md) instead. ## Using preview builds diff --git a/eslint-suppressions.json b/eslint-suppressions.json index f82d6d77e..2ec0efa4f 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -245,9 +245,6 @@ }, "@typescript-eslint/no-unused-vars": { "count": 6 - }, - "n/no-unsupported-features/node-builtins": { - "count": 6 } }, "packages/solana-wallet-snap/src/core/handlers/onKeyringRequest/Keyring.ts": { @@ -486,9 +483,6 @@ "packages/solana-wallet-snap/src/core/services/send/SendService.test.ts": { "@typescript-eslint/no-explicit-any": { "count": 6 - }, - "n/no-unsupported-features/node-builtins": { - "count": 1 } }, "packages/solana-wallet-snap/src/core/services/send/SendSolBuilder.test.ts": { @@ -572,9 +566,6 @@ }, "n/no-sync": { "count": 22 - }, - "n/no-unsupported-features/node-builtins": { - "count": 4 } }, "packages/solana-wallet-snap/src/core/services/subscriptions/SubscriptionService.ts": { @@ -1377,33 +1368,21 @@ "packages/stellar-wallet-snap/src/handlers/keyring/keyring.test.ts": { "@typescript-eslint/explicit-function-return-type": { "count": 2 - }, - "n/no-unsupported-features/node-builtins": { - "count": 2 } }, "packages/stellar-wallet-snap/src/handlers/keyring/signAuthEntry.test.ts": { "@typescript-eslint/explicit-function-return-type": { "count": 1 - }, - "n/no-unsupported-features/node-builtins": { - "count": 1 } }, "packages/stellar-wallet-snap/src/handlers/keyring/signMessage.test.ts": { "@typescript-eslint/explicit-function-return-type": { "count": 1 - }, - "n/no-unsupported-features/node-builtins": { - "count": 1 } }, "packages/stellar-wallet-snap/src/handlers/keyring/signTransaction.test.ts": { "@typescript-eslint/explicit-function-return-type": { "count": 1 - }, - "n/no-unsupported-features/node-builtins": { - "count": 1 } }, "packages/stellar-wallet-snap/src/services/account/AccountService.test.ts": { @@ -1494,9 +1473,6 @@ "packages/stellar-wallet-snap/src/services/on-chain-account/OnChainAccountService.test.ts": { "@typescript-eslint/explicit-function-return-type": { "count": 1 - }, - "n/no-unsupported-features/node-builtins": { - "count": 3 } }, "packages/stellar-wallet-snap/src/services/on-chain-account/OnChainAccountSynchronizeService.test.ts": { @@ -1508,9 +1484,6 @@ }, "jsdoc/require-returns": { "count": 2 - }, - "n/no-unsupported-features/node-builtins": { - "count": 1 } }, "packages/stellar-wallet-snap/src/services/on-chain-account/__mocks__/onChainAccount.fixtures.ts": { @@ -1601,11 +1574,6 @@ "count": 5 } }, - "packages/stellar-wallet-snap/src/services/wallet/WalletService.test.ts": { - "n/no-unsupported-features/node-builtins": { - "count": 3 - } - }, "packages/stellar-wallet-snap/src/services/wallet/__mocks__/wallet.fixtures.ts": { "@typescript-eslint/explicit-function-return-type": { "count": 2 diff --git a/eslint.config.mjs b/eslint.config.mjs index 993148d20..2ecded431 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,7 +3,7 @@ import jest from '@metamask/eslint-config-jest'; import nodejs from '@metamask/eslint-config-nodejs'; import typescript from '@metamask/eslint-config-typescript'; -const NODE_LTS_VERSION = 22; +const NODE_LTS_VERSION = 24; /** * Arguments to the `no-restricted` syntax rule that advises use of diff --git a/package.json b/package.json index 45ad17422..09cb6dd37 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@metamask/internal-snaps-monorepo", "version": "7.0.0", "private": true, - "description": "Monorepo for firt-party snaps", + "description": "Monorepo for first-party snaps", "repository": { "type": "git", "url": "https://github.com/MetaMask/internal-snaps.git" @@ -10,13 +10,11 @@ "workspaces": [ "packages/*" ], - "files": [], "scripts": { "build": "yarn workspaces foreach --all --no-private --topological-dev --parallel --interlaced --verbose run build", "build:clean": "yarn build:only-clean && yarn build", "build:docs": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run build:docs", "build:only-clean": "rimraf -g 'packages/*/dist'", - "build:types": "tsc --build tsconfig.build.json --verbose", "changelog:update": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:update", "changelog:validate": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:validate", "create-release-branch": "create-release-branch --formatter oxfmt", @@ -24,15 +22,13 @@ "lint": "yarn lint:eslint && echo && yarn lint:misc --check && yarn constraints && yarn lint:dependencies && yarn readme-content:check", "lint:dependencies": "depcheck && yarn dedupe --check", "lint:dependencies:fix": "depcheck && yarn dedupe", - "lint:eslint": "yarn build:only-clean && NODE_OPTIONS='--max-old-space-size=6144' yarn eslint", + "lint:eslint": "yarn eslint", "lint:fix": "yarn lint:eslint --fix --prune-suppressions && echo && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies:fix && yarn readme-content:update", "lint:misc": "oxfmt --ignore-path .gitignore", "lint:misc:check": "yarn lint:misc --check", "prepack": "./scripts/prepack.sh", - "prepare-preview-builds": "./scripts/prepare-preview-builds.sh", "readme-content:check": "tsx scripts/update-readme-content.ts --check", "readme-content:update": "tsx scripts/update-readme-content.ts", - "setup": "yarn install", "test": "yarn test:scripts --silent --collectCoverage=false --reporters=jest-silent-reporter && yarn test:packages", "test:clean": "yarn workspaces foreach --all --parallel --verbose run test:clean && yarn test", "test:packages": "yarn test:verbose --silent --collectCoverage=false --reporters=jest-silent-reporter", @@ -51,7 +47,7 @@ "@metamask/utils": "^11.11.0", "@types/jest": "^30.0.0", "@types/lodash": "^4.17.15", - "@types/node": "^16.18.54", + "@types/node": "^24", "@types/semver": "^7", "@typescript-eslint/eslint-plugin": "^8.48.0", "@typescript-eslint/parser": "^8.48.0", @@ -101,9 +97,6 @@ "ripemd160@npm:^2.0.1": "2.0.2", "ws@7.4.6": "^7.5.10" }, - "simple-git-hooks": { - "pre-push": "yarn lint" - }, "engines": { "node": ">=20" }, diff --git a/tsconfig.build.json b/tsconfig.build.json index d9833b845..e5a321b17 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,10 +1,8 @@ { /** - * This configuration is used by the `build` script in `package.json`. - * - * This is just used as a way to request builds for all packages. `tsconfig.base.json` is not - * extended here because the `tsconfig.build.json` file referenced for each package already - * (indirectly) extends it. + * Solution-style config for library packages that emit types via `ts-bridge`. + * `create-package` adds new library packages to `references`. Snap packages + * do not use this file; they are built with `mm-snap`. */ "references": [ { diff --git a/yarn.config.cjs b/yarn.config.cjs index 9d8a0cc91..2b1f91768 100644 --- a/yarn.config.cjs +++ b/yarn.config.cjs @@ -244,11 +244,9 @@ module.exports = defineConfig({ expectWorkspaceArrayField(workspace, 'files', 'dist/'); } } else { - // The root package must specify an empty set of published files. (This - // is required in order to be able to import anything in - // development-only scripts, as otherwise the - // `node/no-unpublished-require` ESLint rule will disallow it.) - expectWorkspaceField(workspace, 'files', []); + // The root package is private and is never published, so `files` is + // unused. Unset it so it cannot be reintroduced. + workspace.unset('files'); } // If one workspace package lists another workspace package within diff --git a/yarn.lock b/yarn.lock index 49126b87a..e50cb4896 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2696,7 +2696,7 @@ __metadata: "@metamask/utils": "npm:^11.11.0" "@types/jest": "npm:^30.0.0" "@types/lodash": "npm:^4.17.15" - "@types/node": "npm:^16.18.54" + "@types/node": "npm:^24" "@types/semver": "npm:^7" "@typescript-eslint/eslint-plugin": "npm:^8.48.0" "@typescript-eslint/parser": "npm:^8.48.0" @@ -5559,7 +5559,16 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:22.7.5": +"@types/node@npm:*, @types/node@npm:^24": + version: 24.13.3 + resolution: "@types/node@npm:24.13.3" + dependencies: + undici-types: "npm:~7.18.0" + checksum: 10/cfa6ed1e16c4624d1e83b09aeb72a2f50a7e17d837bf5a1259a52e346f33a693afd289402d3b6118ce3abea7aff35f2a4f13a0284b96bc5807a50f0e22e1ec77 + languageName: node + linkType: hard + +"@types/node@npm:22.7.5": version: 22.7.5 resolution: "@types/node@npm:22.7.5" dependencies: @@ -5568,13 +5577,6 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^16.18.54": - version: 16.18.106 - resolution: "@types/node@npm:16.18.106" - checksum: 10/1970719a048bfc56554f8e132e8e5292c197d6e023d334190b0d3817a05a12bfb6537eaa24778ddb695d2073195f0545e5a4b6bcaf81b656994bbca39f349c3b - languageName: node - linkType: hard - "@types/parse-json@npm:^4.0.0": version: 4.0.2 resolution: "@types/parse-json@npm:4.0.2" @@ -15050,6 +15052,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~7.18.0": + version: 7.18.2 + resolution: "undici-types@npm:7.18.2" + checksum: 10/e61a5918f624d68420c3ca9d301e9f15b61cba6e97be39fe2ce266dd6151e4afe424d679372638826cb506be33952774e0424141200111a9857e464216c009af + languageName: node + linkType: hard + "unicorn-magic@npm:^0.3.0": version: 0.3.0 resolution: "unicorn-magic@npm:0.3.0"