diff --git a/.gitignore b/.gitignore index b215516a5..a903d2f51 100644 --- a/.gitignore +++ b/.gitignore @@ -120,3 +120,6 @@ packages/devreact/webpack.config.json # Local Netlify folder .netlify + +# Turborepo +.turbo diff --git a/package.json b/package.json index 21519f22e..5e2875f2f 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "postinstall": "patch-package", "link-packages": "./scripts/link-packages.sh", "prepare": "husky install", + "dev:core": "turbo run dev --parallel --filter=@metamask/sdk-communication-layer --filter=@metamask/sdk --filter=@metamask/sdk-react", "lint": "yarn workspaces foreach --no-private run lint", "lint:changelogs": "yarn workspaces foreach --no-private run lint:changelog", "lint:eslint": "yarn workspaces foreach --no-private run lint:eslint", @@ -86,6 +87,8 @@ "rimraf": "^3.0.2", "serve": "^14.2.1", "ts-jest": "^29.0.3", + "turbo": "^2.3.3", + "turborepo": "^0.0.1", "typescript": "^4.3.5" }, "engines": { diff --git a/packages/sdk-communication-layer/package.json b/packages/sdk-communication-layer/package.json index 48662eda2..524b35ddc 100644 --- a/packages/sdk-communication-layer/package.json +++ b/packages/sdk-communication-layer/package.json @@ -25,6 +25,7 @@ "build:clean": "yarn clean && yarn build", "build": "yarn build:types && rollup -c --bundleConfigAsCjs", "build:dev": "yarn build:types && NODE_ENV=dev rollup -c --bundleConfigAsCjs", + "dev": "concurrently \"tsc --watch\" \"rollup -c --bundleConfigAsCjs -w\"", "build:post-tsc": "echo 'N/A'", "build:pre-tsc": "echo 'N/A'", "size": "size-limit", @@ -69,6 +70,7 @@ "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^4.26.0", "@typescript-eslint/parser": "^4.26.0", + "concurrently": "^9.1.2", "cross-fetch": "^4.0.0", "eciesjs": "^0.4.11", "eslint": "^7.30.0", diff --git a/packages/sdk-react/package.json b/packages/sdk-react/package.json index cc3963a90..60f3b8861 100644 --- a/packages/sdk-react/package.json +++ b/packages/sdk-react/package.json @@ -34,7 +34,7 @@ "build:post-tsc": "echo 'N/A'", "build:pre-tsc": "echo 'N/A'", "clean": "rimraf dist", - "dev": "rollup -c -w", + "dev": "rollup -c -w --bundleConfigAsCjs", "lint": "yarn lint:eslint && yarn lint:misc --check", "lint:changelog": "../../scripts/validate-changelog.sh @metamask/sdk-react", "lint:eslint": "eslint . --cache --ext js,ts", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 53031e736..bc70ef57c 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -25,7 +25,6 @@ "build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly --outDir dist/types", "build": "yarn build:types && rollup -c --bundleConfigAsCjs", "build:clean": "yarn clean && yarn build", - "build:dev": "yarn build:types && NODE_ENV=dev rollup -c --bundleConfigAsCjs", "build:post-tsc": "echo 'N/A'", "build:pre-tsc": "echo 'N/A'", "typecheck": "tsc --noEmit", @@ -44,7 +43,9 @@ "test:e2e": "jest --testPathPattern \"/e2e/\"", "test:ci": "jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js --testPathIgnorePatterns \"/e2e/\"", "test:dev": "jest -c ./jest.config.ts --detectOpenHandles --testPathIgnorePatterns \"/e2e/\"", - "watch": "rollup -c -w" + "watch": "rollup -c -w", + "dev": "concurrently \"tsc --watch\" \"rollup -c -w --bundleConfigAsCjs\"", + "build:dev": "yarn build:types && NODE_ENV=dev rollup -c --bundleConfigAsCjs" }, "dependencies": { "@babel/runtime": "^7.26.0", @@ -91,6 +92,7 @@ "@typescript-eslint/parser": "^4.26.0", "browserify-zlib": "^0.2.0", "buffer": "^6.0.3", + "concurrently": "^9.1.2", "crypto-browserify": "^3.12.0", "eslint": "^7.30.0", "eslint-config-prettier": "^8.3.0", diff --git a/turbo.json b/turbo.json new file mode 100644 index 000000000..326a78f2b --- /dev/null +++ b/turbo.json @@ -0,0 +1,34 @@ +{ + "$schema": "https://turbo.build/schema.json", + "globalDependencies": [ + "**/.env.*local" + ], + "globalEnv": [ + "NODE_ENV", + "SITEED_NPM_TOKEN" + ], + "tasks": { + "build": { + "dependsOn": [ + "^build" + ], + "outputs": [ + "dist/**", + ".next/**" + ] + }, + "check-types": { + "dependsOn": [ + "^check-types" + ] + }, + "lint": { + "outputs": [] + }, + "dev": { + "cache": false, + "persistent": true, + "outputs": ["dist/**"] + } + } +} diff --git a/yarn.lock b/yarn.lock index 381eb1ea6..44a5bb269 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10939,6 +10939,7 @@ __metadata: "@typescript-eslint/eslint-plugin": ^4.26.0 "@typescript-eslint/parser": ^4.26.0 bufferutil: ^4.0.8 + concurrently: ^9.1.2 cross-fetch: ^4.0.0 date-fns: ^2.29.3 debug: ^4.3.4 @@ -11580,6 +11581,7 @@ __metadata: bowser: ^2.9.0 browserify-zlib: ^0.2.0 buffer: ^6.0.3 + concurrently: ^9.1.2 cross-fetch: ^4.0.0 crypto-browserify: ^3.12.0 debug: ^4.3.4 @@ -25325,6 +25327,24 @@ __metadata: languageName: node linkType: hard +"concurrently@npm:^9.1.2": + version: 9.1.2 + resolution: "concurrently@npm:9.1.2" + dependencies: + chalk: ^4.1.2 + lodash: ^4.17.21 + rxjs: ^7.8.1 + shell-quote: ^1.8.1 + supports-color: ^8.1.1 + tree-kill: ^1.2.2 + yargs: ^17.7.2 + bin: + conc: dist/bin/concurrently.js + concurrently: dist/bin/concurrently.js + checksum: 9e25e8ee6272ada26739aff1fb43e96ac458fafca82f45b8360bdd9115d60bbc679d282dfc52001b861b6e9f32b3063aed975691d8dec9e62807a9679763a1d8 + languageName: node + linkType: hard + "confusing-browser-globals@npm:^1.0.11": version: 1.0.11 resolution: "confusing-browser-globals@npm:1.0.11" @@ -38093,6 +38113,8 @@ __metadata: serve: ^14.2.1 ts-jest: ^29.0.3 ts-node: ^10.9.1 + turbo: ^2.3.3 + turborepo: ^0.0.1 typescript: ^4.3.5 languageName: unknown linkType: soft @@ -45998,7 +46020,7 @@ __metadata: languageName: node linkType: hard -"rxjs@npm:^7.5.5, rxjs@npm:^7.8.0": +"rxjs@npm:^7.5.5, rxjs@npm:^7.8.0, rxjs@npm:^7.8.1": version: 7.8.1 resolution: "rxjs@npm:7.8.1" dependencies: @@ -46687,6 +46709,13 @@ __metadata: languageName: node linkType: hard +"shell-quote@npm:^1.8.1": + version: 1.8.2 + resolution: "shell-quote@npm:1.8.2" + checksum: 1e97b62ced1c4c5135015978ebf273bed1f425a68cf84163e83fbb0f34b3ff9471e656720dab2b7cbb4ae0f58998e686d17d166c28dfb3662acd009e8bd7faed + languageName: node + linkType: hard + "side-channel@npm:^1.0.4": version: 1.0.4 resolution: "side-channel@npm:1.0.4" @@ -48168,7 +48197,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^8.0.0": +"supports-color@npm:^8.0.0, supports-color@npm:^8.1.1": version: 8.1.1 resolution: "supports-color@npm:8.1.1" dependencies: @@ -49022,6 +49051,15 @@ __metadata: languageName: node linkType: hard +"tree-kill@npm:^1.2.2": + version: 1.2.2 + resolution: "tree-kill@npm:1.2.2" + bin: + tree-kill: cli.js + checksum: 49117f5f410d19c84b0464d29afb9642c863bc5ba40fcb9a245d474c6d5cc64d1b177a6e6713129eb346b40aebb9d4631d967517f9fbe8251c35b21b13cd96c7 + languageName: node + linkType: hard + "trim-newlines@npm:^3.0.0": version: 3.0.1 resolution: "trim-newlines@npm:3.0.1" @@ -49247,6 +49285,34 @@ __metadata: languageName: node linkType: hard +"turbo-darwin-64@npm:2.3.3": + version: 2.3.3 + resolution: "turbo-darwin-64@npm:2.3.3" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"turbo-darwin-arm64@npm:2.3.3": + version: 2.3.3 + resolution: "turbo-darwin-arm64@npm:2.3.3" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"turbo-linux-64@npm:2.3.3": + version: 2.3.3 + resolution: "turbo-linux-64@npm:2.3.3" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"turbo-linux-arm64@npm:2.3.3": + version: 2.3.3 + resolution: "turbo-linux-arm64@npm:2.3.3" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + "turbo-stream@npm:^2.0.0": version: 2.2.0 resolution: "turbo-stream@npm:2.2.0" @@ -49254,6 +49320,56 @@ __metadata: languageName: node linkType: hard +"turbo-windows-64@npm:2.3.3": + version: 2.3.3 + resolution: "turbo-windows-64@npm:2.3.3" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"turbo-windows-arm64@npm:2.3.3": + version: 2.3.3 + resolution: "turbo-windows-arm64@npm:2.3.3" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"turbo@npm:^2.3.3": + version: 2.3.3 + resolution: "turbo@npm:2.3.3" + dependencies: + turbo-darwin-64: 2.3.3 + turbo-darwin-arm64: 2.3.3 + turbo-linux-64: 2.3.3 + turbo-linux-arm64: 2.3.3 + turbo-windows-64: 2.3.3 + turbo-windows-arm64: 2.3.3 + dependenciesMeta: + turbo-darwin-64: + optional: true + turbo-darwin-arm64: + optional: true + turbo-linux-64: + optional: true + turbo-linux-arm64: + optional: true + turbo-windows-64: + optional: true + turbo-windows-arm64: + optional: true + bin: + turbo: bin/turbo + checksum: b495ad024c2586fd090d3aabcc1263a89d72ee96d93b2259b553d9c931e22056a388e030a51bd70a11ec8bec373d1cb0a6ef0931806e8a283cb8360c000d0538 + languageName: node + linkType: hard + +"turborepo@npm:^0.0.1": + version: 0.0.1 + resolution: "turborepo@npm:0.0.1" + checksum: 4975a23063185a87729f5de4fdb42c2118b52d88263128fa1416fe651798725a8d9f3e8a10a099d1188bd5ae04a39a93fe39810ced7e9187230ae9aa3ba645cf + languageName: node + linkType: hard + "tweetnacl-util@npm:^0.15.1": version: 0.15.1 resolution: "tweetnacl-util@npm:0.15.1"