From 01740e3300e61737d910f77154623778c2aca5dc Mon Sep 17 00:00:00 2001 From: Anton Gunnarsson Date: Wed, 12 Mar 2025 08:18:38 +0000 Subject: [PATCH] Merged in feat/turborepo (pull request #1451) Turborepo Approved-by: Linus Flood --- .gitignore | 5 +- apps/scandic-web/package.json | 6 +-- apps/scandic-web/turbo.json | 14 ++++++ package.json | 11 +++-- packages/design-system/package.json | 3 +- packages/design-system/turbo.json | 8 ++++ turbo.json | 16 +++++++ yarn.lock | 72 +++++++++++++++++++++++++++++ 8 files changed, 127 insertions(+), 8 deletions(-) create mode 100644 apps/scandic-web/turbo.json create mode 100644 packages/design-system/turbo.json create mode 100644 turbo.json diff --git a/.gitignore b/.gitignore index 5b7a5eba9..74f3e9c3c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,7 @@ node_modules .yarn/build-state.yml .yarn/install-state.gz .pnp.* -.yarn/releases \ No newline at end of file +.yarn/releases + +# Turbo +.turbo \ No newline at end of file diff --git a/apps/scandic-web/package.json b/apps/scandic-web/package.json index 1358f6f0a..3a60866b7 100644 --- a/apps/scandic-web/package.json +++ b/apps/scandic-web/package.json @@ -15,9 +15,9 @@ "test:e2e:headless": "start-server-and-test test:setup http://127.0.0.1:3000/en/sponsoring \"cypress run --e2e\"", "test:setup": "yarn build && yarn start", "preinstall": "/bin/sh -c \"export $(cat .env.local | grep -v '^#' | xargs)\"", - "test:unit": "jest", - "test:unit:watch": "jest --watch", - "ci:build": "yarn lint && yarn test:unit && yarn build", + "test": "jest", + "test:watch": "jest --watch", + "ci:build": "yarn lint && yarn test && yarn build", "clean": "rm -rf .next" }, "dependencies": { diff --git a/apps/scandic-web/turbo.json b/apps/scandic-web/turbo.json new file mode 100644 index 000000000..821fdd6a9 --- /dev/null +++ b/apps/scandic-web/turbo.json @@ -0,0 +1,14 @@ +{ + "extends": ["//"], + "tasks": { + "dev": { + "dependsOn": ["@scandic-hotels/design-system#build"] + }, + "build": { + "dependsOn": ["@scandic-hotels/design-system#build"] + }, + "test": { + "dependsOn": ["@scandic-hotels/design-system#build"] + } + } +} diff --git a/package.json b/package.json index d605ad865..365916d33 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,12 @@ "name": "scandic", "packageManager": "yarn@4.6.0", "scripts": { - "build": "yarn workspace @scandic-hotels/design-system build && yarn workspace @scandic-hotels/scandic-web ci:build", - "lint": "yarn workspace @scandic-hotels/scandic-web lint", + "build": "turbo run build --env-mode=loose", + "lint": "turbo run lint", + "dev": "turbo run dev --output-logs new-only", + "dev:web": "turbo run dev --filter=@scandic-hotels/scandic-web --output-logs new-only", + "dev:ds": "turbo run dev --filter=@scandic-hotels/design-system --output-logs new-only", + "test": "turbo run test", "postinstall": "husky" }, "workspaces": [ @@ -15,6 +19,7 @@ "@types/react-dom": "^18.2.0", "husky": "^9.1.7", "lint-staged": "^15.2.2", - "ts-node": "^10.9.2" + "ts-node": "^10.9.2", + "turbo": "^2.4.4" } } diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 9c81f9de0..d95ca06ff 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -39,7 +39,8 @@ "lint:fix": "eslint . --ext ts,tsx --report-unused-disable-directives --fix --max-warnings 0 && tsc", "storybook": "yarn run generate && storybook dev -p 6006", "build-storybook": "storybook build", - "test": "vitest", + "test": "vitest --watch=false", + "test:watch": "vitest", "prepack": "yarn run build", "prepare": "husky && yarn run build" }, diff --git a/packages/design-system/turbo.json b/packages/design-system/turbo.json new file mode 100644 index 000000000..35be9c68f --- /dev/null +++ b/packages/design-system/turbo.json @@ -0,0 +1,8 @@ +{ + "extends": ["//"], + "tasks": { + "build": { + "outputs": ["dist/**"] + } + } +} diff --git a/turbo.json b/turbo.json new file mode 100644 index 000000000..418072746 --- /dev/null +++ b/turbo.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://turbo.build/schema.json", + "tasks": { + "build": { + "inputs": ["$TURBO_DEFAULT$", ".env*"], + "dependsOn": ["^build"], + "outputs": [".next/**", "!.next/cache/**"] + }, + "dev": { + "persistent": true, + "cache": false + }, + "lint": {}, + "test": {} + } +} diff --git a/yarn.lock b/yarn.lock index 4e3793f9b..74f7b5c8e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18460,6 +18460,7 @@ __metadata: husky: "npm:^9.1.7" lint-staged: "npm:^15.2.2" ts-node: "npm:^10.9.2" + turbo: "npm:^2.4.4" languageName: unknown linkType: soft @@ -19921,6 +19922,77 @@ __metadata: languageName: node linkType: hard +"turbo-darwin-64@npm:2.4.4": + version: 2.4.4 + resolution: "turbo-darwin-64@npm:2.4.4" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"turbo-darwin-arm64@npm:2.4.4": + version: 2.4.4 + resolution: "turbo-darwin-arm64@npm:2.4.4" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"turbo-linux-64@npm:2.4.4": + version: 2.4.4 + resolution: "turbo-linux-64@npm:2.4.4" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"turbo-linux-arm64@npm:2.4.4": + version: 2.4.4 + resolution: "turbo-linux-arm64@npm:2.4.4" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"turbo-windows-64@npm:2.4.4": + version: 2.4.4 + resolution: "turbo-windows-64@npm:2.4.4" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"turbo-windows-arm64@npm:2.4.4": + version: 2.4.4 + resolution: "turbo-windows-arm64@npm:2.4.4" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"turbo@npm:^2.4.4": + version: 2.4.4 + resolution: "turbo@npm:2.4.4" + dependencies: + turbo-darwin-64: "npm:2.4.4" + turbo-darwin-arm64: "npm:2.4.4" + turbo-linux-64: "npm:2.4.4" + turbo-linux-arm64: "npm:2.4.4" + turbo-windows-64: "npm:2.4.4" + turbo-windows-arm64: "npm:2.4.4" + 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: 10c0/e6810cf33835bf9fba4d037a70054b408854073b03d10747bd9a681d2889dfc1897a4a4570113006ca2639fed8a4f91b86b052d4d8111e119895f1fb1804f233 + languageName: node + linkType: hard + "tweetnacl@npm:^0.14.3, tweetnacl@npm:~0.14.0": version: 0.14.5 resolution: "tweetnacl@npm:0.14.5"