mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Revert "fix: return default adapter in framework detection response"
This commit is contained in:
1 parent
978a16211d
commit
0044907daf
4 files changed
+15
-65
No files matched your search
Generated
+6
-6
@@ -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",
|
||||
|
||||
+9
-34
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user