From fd8c1197b2eff54db1e4d489f4a12642931bcfeb Mon Sep 17 00:00:00 2001 From: Jan Kaifer Date: Wed, 4 Jan 2023 14:09:47 +0100 Subject: [PATCH] Revert "Use turbo for packing files in test setup (#44074)" This reverts commit fd9ec646acc26e746822cff903981ca7d7d366e1. --- .../actions/next-stats-action/package.json | 6 +-- .../src/prepare/repo-setup.js | 48 ++----------------- package.json | 1 - 3 files changed, 5 insertions(+), 50 deletions(-) diff --git a/.github/actions/next-stats-action/package.json b/.github/actions/next-stats-action/package.json index 3949a110476ff..4d2e88dae3e3e 100644 --- a/.github/actions/next-stats-action/package.json +++ b/.github/actions/next-stats-action/package.json @@ -1,9 +1,6 @@ { "private": true, "main": "src/index.js", - "scripts": { - "turbo": "turbo" - }, "dependencies": { "async-sema": "^3.1.0", "fs-extra": "^8.1.0", @@ -15,7 +12,6 @@ "prettier": "^1.18.2", "pretty-bytes": "^5.3.0", "pretty-ms": "^5.0.0", - "semver": "7.3.4", - "turbo": "1.6.3" + "semver": "7.3.4" } } diff --git a/.github/actions/next-stats-action/src/prepare/repo-setup.js b/.github/actions/next-stats-action/src/prepare/repo-setup.js index f2de937a30597..f490a48ba3daa 100644 --- a/.github/actions/next-stats-action/src/prepare/repo-setup.js +++ b/.github/actions/next-stats-action/src/prepare/repo-setup.js @@ -10,18 +10,6 @@ const mockTrace = () => ({ traceChild: () => mockTrace(), }) -let turboRepoRoot = path.join(__dirname, '..', '..', '..', '..', '..') - -// stats-action runs this code without access to the original repo. -// In that case we just use the temporary directory (everything is temporary anyway in CI) -if (turboRepoRoot === '/') { - turboRepoRoot = path.join(__dirname, '..', '..') -} - -/** Save turbo cache to persistent storage */ -const turboCacheLocation = path.join(turboRepoRoot, 'node_modules/.cache/turbo') -const packedPkgsDir = path.join(turboRepoRoot, 'test/tmp/packedPkgs') - module.exports = (actionInfo) => { return { async cloneRepo(repoPath = '', dest = '') { @@ -93,15 +81,9 @@ module.exports = (actionInfo) => { await rootSpan .traceChild('prepare packages for packing') .traceAsyncFn(async () => { - await fs.ensureDir(packedPkgsDir) - const repoData = require(path.join(repoDir, 'package.json')) - for (const pkg of pkgs) { const pkgPath = path.join(repoDir, 'packages', pkg) - const packedPkgPath = path.join( - packedPkgsDir, - `${pkg}-packed.tgz` - ) + const packedPkgPath = path.join(pkgPath, `${pkg}-packed.tgz`) const pkgDataPath = path.join(pkgPath, 'package.json') if (!fs.existsSync(pkgDataPath)) { @@ -121,8 +103,7 @@ module.exports = (actionInfo) => { } for (const pkg of pkgDatas.keys()) { - const { pkgDataPath, pkgData, pkgPath, packedPkgPath } = - pkgDatas.get(pkg) + const { pkgDataPath, pkgData } = pkgDatas.get(pkg) for (const pkg of pkgDatas.keys()) { const { packedPkgPath } = pkgDatas.get(pkg) @@ -158,27 +139,6 @@ module.exports = (actionInfo) => { } } - // Turbo requires package manager specification - pkgData.packageManager = - pkgData.packageManager || repoData.packageManager - - pkgData.scripts = { - ...pkgData.scripts, - 'test-pack': `yarn pack -f ${packedPkgPath}`, - } - - await fs.writeJSON(path.join(pkgPath, 'turbo.json'), { - pipeline: { - 'test-pack': { - outputs: [packedPkgPath], - inputs: ['*', '!node_modules/', '!.turbo/'], - }, - }, - }) - - // Turbo requires pnpm-lock.yaml that is not empty - await fs.writeFile(path.join(pkgPath, 'pnpm-lock.yaml'), '') - await fs.writeFile( pkgDataPath, JSON.stringify(pkgData, null, 2), @@ -197,9 +157,9 @@ module.exports = (actionInfo) => { await packingSpan .traceChild(`pack ${pkgName}`) .traceAsyncFn(async () => { - const { pkgPath } = pkgDatas.get(pkgName) + const { pkg, pkgPath } = pkgDatas.get(pkgName) await exec( - `pnpm run --dir="${turboRepoRoot}" turbo run test-pack --cache-dir="${turboCacheLocation}" --cwd="${pkgPath}"`, + `cd ${pkgPath} && yarn pack -f '${pkg}-packed.tgz'`, true ) }) diff --git a/package.json b/package.json index fac64903af2e8..c2bdd60d026b9 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "build": "turbo run build", "lerna": "lerna", "dev": "turbo run dev --parallel", - "turbo": "turbo", "test-types": "pnpm tsc", "test-unit": "pnpm jest test/unit/", "test-dev": "cross-env NEXT_TEST_MODE=dev pnpm testheadless",