From 0044907daf6f14cff10dbf1590a3df84bebd2aac Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Thu, 25 Jun 2026 15:06:15 +0530 Subject: [PATCH] Revert "fix: return default adapter in framework detection response" --- composer.lock | 12 +++--- .../Repositories/Detections/Create.php | 43 ++++--------------- .../Response/Model/DetectionFramework.php | 6 --- .../e2e/Services/VCS/VCSConsoleClientTest.php | 19 -------- 4 files changed, 15 insertions(+), 65 deletions(-) diff --git a/composer.lock b/composer.lock index 4e0de16a28..b1fa6bf2d1 100644 --- a/composer.lock +++ b/composer.lock @@ -3736,16 +3736,16 @@ }, { "name": "utopia-php/detector", - "version": "0.2.5", + "version": "0.2.4", "source": { "type": "git", "url": "https://github.com/utopia-php/detector.git", - "reference": "20f7e2ea8084176fae88a473f82f410281978a3b" + "reference": "a564381108518ce6d18b6ab441f1448bd8355afd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/detector/zipball/20f7e2ea8084176fae88a473f82f410281978a3b", - "reference": "20f7e2ea8084176fae88a473f82f410281978a3b", + "url": "https://api.github.com/repos/utopia-php/detector/zipball/a564381108518ce6d18b6ab441f1448bd8355afd", + "reference": "a564381108518ce6d18b6ab441f1448bd8355afd", "shasum": "" }, "require": { @@ -3775,9 +3775,9 @@ ], "support": { "issues": "https://github.com/utopia-php/detector/issues", - "source": "https://github.com/utopia-php/detector/tree/0.2.5" + "source": "https://github.com/utopia-php/detector/tree/0.2.4" }, - "time": "2026-06-17T08:16:37+00:00" + "time": "2026-02-17T11:26:34+00:00" }, { "name": "utopia-php/di", diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Detections/Create.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Detections/Create.php index eaf3834036..4da5699a4e 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Detections/Create.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Detections/Create.php @@ -152,6 +152,7 @@ class Create extends Action $contentResponse = $github->getRepositoryContent($owner, $repositoryName, \rtrim($providerRootDirectory, '/') . '/package.json'); $packages = $contentResponse['content'] ?? ''; } catch (FileNotFound $e) { + // Continue detection without package.json } $output = new Document([ @@ -159,7 +160,6 @@ class Create extends Action 'installCommand' => '', 'buildCommand' => '', 'outputDirectory' => '', - 'adapter' => '', ]); $detector = new Framework($packager); @@ -190,43 +190,19 @@ class Create extends Action $output->setAttribute('installCommand', $framework->getInstallCommand()); $output->setAttribute('buildCommand', $framework->getBuildCommand()); $output->setAttribute('outputDirectory', $framework->getOutputDirectory()); - $frameworkName = $framework->getName(); - - $configContent = ''; - foreach ($framework->getConfigFiles() as $configFile) { - if (!\in_array($configFile, $files, true)) { - continue; - } - try { - $configPath = \rtrim($providerRootDirectory, '/') . '/' . $configFile; - $configResponse = $github->getRepositoryContent($owner, $repositoryName, $configPath); - $configContent = $configResponse['content'] ?? ''; - if (!empty($configContent)) { - break; - } - } catch (FileNotFound $e) { - } - } - - $detectedAdapter = !empty($configContent) ? $framework->getAdapter($configContent) : ''; + $framework = $framework->getName(); } else { - $frameworkName = 'other'; - $detectedAdapter = ''; + $framework = 'other'; + $output->setAttribute('installCommand', ''); + $output->setAttribute('buildCommand', ''); + $output->setAttribute('outputDirectory', ''); } $frameworks = Config::getParam('frameworks'); - if (!\in_array($frameworkName, \array_keys($frameworks), true)) { - $frameworkName = 'other'; - } - $output->setAttribute('framework', $frameworkName); - - $frameworkConfig = $frameworks[$frameworkName] ?? []; - if (!empty($frameworkConfig['adapters'])) { - $adapter = (!empty($detectedAdapter) && isset($frameworkConfig['adapters'][$detectedAdapter])) - ? $detectedAdapter - : \array_key_first($frameworkConfig['adapters']); - $output->setAttribute('adapter', $adapter); + if (!\in_array($framework, \array_keys($frameworks), true)) { + $framework = 'other'; } + $output->setAttribute('framework', $framework); } else { $output = new Document([ 'runtime' => '', @@ -337,5 +313,4 @@ class Create extends Action $response->dynamic($output, $type === 'framework' ? Response::MODEL_DETECTION_FRAMEWORK : Response::MODEL_DETECTION_RUNTIME); } - } diff --git a/src/Appwrite/Utopia/Response/Model/DetectionFramework.php b/src/Appwrite/Utopia/Response/Model/DetectionFramework.php index 873839dae4..00f318ba4a 100644 --- a/src/Appwrite/Utopia/Response/Model/DetectionFramework.php +++ b/src/Appwrite/Utopia/Response/Model/DetectionFramework.php @@ -38,12 +38,6 @@ class DetectionFramework extends Detection 'description' => 'Site Output Directory', 'default' => '', 'example' => 'dist', - ]) - ->addRule('adapter', [ - 'type' => self::TYPE_STRING, - 'description' => 'Site Adapter', - 'default' => '', - 'example' => 'ssr', ]); } diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index 8091c94156..e936013a90 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -185,7 +185,6 @@ final class VCSConsoleClientTest extends Scope $this->assertEquals('npm install', $framework['body']['installCommand']); $this->assertEquals('npm run build', $framework['body']['buildCommand']); $this->assertEquals('./build', $framework['body']['outputDirectory']); - $this->assertEquals('ssr', $framework['body']['adapter']); $framework = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -201,7 +200,6 @@ final class VCSConsoleClientTest extends Scope $this->assertEquals('npm install', $framework['body']['installCommand']); $this->assertEquals('npm run build', $framework['body']['buildCommand']); $this->assertEquals('./dist', $framework['body']['outputDirectory']); - $this->assertEquals('ssr', $framework['body']['adapter']); $framework = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -217,23 +215,6 @@ final class VCSConsoleClientTest extends Scope $this->assertEquals('npm install', $framework['body']['installCommand']); $this->assertEquals('npm run build', $framework['body']['buildCommand']); $this->assertEquals('./build', $framework['body']['outputDirectory']); - $this->assertEquals('ssr', $framework['body']['adapter']); - - $framework = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ - 'x-appwrite-project' => $this->getProject()['$id'], - 'content-type' => 'application/json', - ], $this->getHeaders()), [ - 'providerRepositoryId' => $this->providerRepositoryId4, - 'type' => 'framework', - 'providerRootDirectory' => 'tanstack-start/starter' - ]); - - $this->assertEquals(200, $framework['headers']['status-code']); - $this->assertEquals('tanstack-start', $framework['body']['framework']); - $this->assertEquals('npm install', $framework['body']['installCommand']); - $this->assertEquals('npm run build', $framework['body']['buildCommand']); - $this->assertEquals('./.output', $framework['body']['outputDirectory']); - $this->assertEquals('ssr', $framework['body']['adapter']); /** * Test for FAILURE