Skip to content

Commit

Permalink
Update Yarn constraints to use JavaScript-based constraints (#2740)
Browse files Browse the repository at this point in the history
This replaces the (deprecated) Progol-based constraints with
JavaScript-based constraints. The constraints file is largely based on
the constraints used by `MetaMask/core`, with slight modifications to
support the difference in this repo.
  • Loading branch information
Mrtenz authored Sep 20, 2024
1 parent f6e88dc commit cbb7dac
Show file tree
Hide file tree
Showing 54 changed files with 865 additions and 422 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {

overrides: [
{
files: ['**/*.js'],
files: ['**/*.js', '**/*.cjs'],
extends: ['@metamask/eslint-config-nodejs'],

parserOptions: {
Expand All @@ -48,6 +48,14 @@ module.exports = {
},
},

{
files: ['**/*.mjs'],
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
},

{
files: ['**/*.ts', '**/*.tsx', '**/*.mts'],
extends: ['@metamask/eslint-config-typescript'],
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ jobs:
run: |
yarn install --immutable
yarn build
yarn workspace @metamask/snaps-execution-environments run build:lavamoat
- uses: actions/cache@v4
id: restore-build
with:
Expand Down
350 changes: 0 additions & 350 deletions constraints.pro

This file was deleted.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"packages/*"
],
"scripts": {
"build": "ts-bridge --project tsconfig.build.json --verbose && yarn build:examples",
"build:ci": "ts-bridge --project tsconfig.build.json --verbose --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose",
"build:ci": "ts-bridge --project tsconfig.build.json --verbose",
"build:examples": "yarn workspace @metamask/example-snaps build",
"build:execution-environments": "yarn workspace @metamask/snaps-execution-environments build:lavamoat",
"build:post": "yarn build:examples && yarn build:execution-environments",
"changelog:update": "yarn workspaces foreach --all --parallel --interlaced --verbose run changelog:update",
"changelog:validate": "yarn workspaces foreach --all --parallel --interlaced --verbose run changelog:validate",
"child-workspace-package-names-as-json": "ts-node scripts/child-workspace-package-names-as-json.ts",
Expand All @@ -24,7 +26,7 @@
"lint": "yarn workspaces foreach --all --parallel run lint:eslint && yarn lint:misc --check && yarn lint:tsconfig && yarn constraints && yarn lint:dependencies",
"lint:ci": "yarn lint:eslint && yarn lint:misc --check && yarn lint:tsconfig && yarn constraints && yarn lint:dependencies",
"lint:dependencies": "yarn workspaces foreach --all --parallel --verbose run lint:dependencies && yarn dedupe --check",
"lint:eslint": "eslint . --cache --ext js,jsx,ts,tsx",
"lint:eslint": "eslint . --cache --ext js,cjs,mjs,jsx,ts,mts,cts,tsx",
"lint:fix": "yarn workspaces foreach --all --parallel run lint:eslint --fix && yarn lint:misc --write && yarn lint:tsconfig && yarn constraints --fix && yarn dedupe",
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn '**/*.json' '**/*.md' '!**/CHANGELOG.md' '**/*.yml' '**/*.html'",
"lint:tsconfig": "node scripts/verify-tsconfig.mjs",
Expand Down Expand Up @@ -81,9 +83,11 @@
"@swc/core": "1.3.78",
"@ts-bridge/cli": "^0.5.1",
"@types/jest": "^27.5.1",
"@types/lodash": "^4",
"@types/node": "18.14.2",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^6.21.0",
"@yarnpkg/types": "^4.0.0",
"chromedriver": "^127.0.0",
"depcheck": "^1.4.7",
"eslint": "^8.27.0",
Expand All @@ -100,6 +104,7 @@
"jest": "^29.0.2",
"jest-silent-reporter": "^0.6.0",
"lint-staged": "^12.4.1",
"lodash": "^4.17.21",
"minimatch": "^7.4.1",
"prettier": "^2.8.8",
"prettier-plugin-packagejson": "^2.5.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dist"
],
"scripts": {
"build": "ts-bridge --project tsconfig.build.json --verbose --no-references",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:chmod": "chmod +x ./dist/main.mjs && chmod +x ./dist/main.js",
"build:clean": "yarn clean && yarn build",
"build:watch": "tsc-watch --onSuccess 'yarn build:chmod'",
Expand Down
1 change: 1 addition & 0 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"scripts": {
"build": "yarn workspaces foreach --worktree --parallel --verbose --no-private run build",
"build:clean": "yarn clean && yarn build",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/example-snaps",
"changelog:validates": "yarn workspaces foreach --worktree --parallel --verbose run changelog:validate",
"clean": "yarn workspaces foreach --worktree --parallel --verbose --no-private run clean",
"lint": "yarn workspaces foreach --worktree --parallel --verbose --interlaced --no-private run lint && yarn lint:dependencies",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip44/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/browserify-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/client-status/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/cronjobs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/dialogs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethereum-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethers-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/file-upload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-entropy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json",
"files/"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/home-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/images/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/interactive-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions packages/examples/packages/invoke-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"scripts": {
"build": "yarn workspaces foreach --worktree --parallel --verbose run build",
"build:clean": "yarn clean && yarn build",
"changelog:validate": "../../../../scripts/validate-changelog.sh @metamask/invoke-snap-example-snap",
"clean": "yarn workspaces foreach --worktree --parallel --verbose run clean",
"lint": "yarn workspaces foreach --worktree --parallel --verbose --interlaced run lint && yarn lint:dependencies",
"lint:ci": "yarn lint:eslint && yarn lint:misc --check",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/json-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/jsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/lifecycle-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/localization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json",
"locales/"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/manage-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/name-lookup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/network-access/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/preinstalled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/rollup-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/send-flow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/signature-insights/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sideEffects": false,
"main": "./dist/bundle.js",
"files": [
"dist/",
"dist",
"snap.manifest.json"
],
"scripts": {
Expand Down
Loading

0 comments on commit cbb7dac

Please sign in to comment.