Merge branch 'main' into fix/vcs-disconnect-on-revoked-installation

This commit is contained in:
Harsh Mahajan authored and GitHub committed 2026-06-24 19:07:29 +05:30
commit 1fe1ada9f4
4 files changed
+65 -15

No files matched your search

Generated
+6 -6
View File
@@ -3736,16 +3736,16 @@
},
{
"name": "utopia-php/detector",
"version": "0.2.4",
"version": "0.2.5",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/detector.git",
"reference": "a564381108518ce6d18b6ab441f1448bd8355afd"
"reference": "20f7e2ea8084176fae88a473f82f410281978a3b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/detector/zipball/a564381108518ce6d18b6ab441f1448bd8355afd",
"reference": "a564381108518ce6d18b6ab441f1448bd8355afd",
"url": "https://api.github.com/repos/utopia-php/detector/zipball/20f7e2ea8084176fae88a473f82f410281978a3b",
"reference": "20f7e2ea8084176fae88a473f82f410281978a3b",
"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.4"
"source": "https://github.com/utopia-php/detector/tree/0.2.5"
},
"time": "2026-02-17T11:26:34+00:00"
"time": "2026-06-17T08:16:37+00:00"
},
{
"name": "utopia-php/di",
@@ -152,7 +152,6 @@ 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([
@@ -160,6 +159,7 @@ class Create extends Action
'installCommand' => '',
'buildCommand' => '',
'outputDirectory' => '',
'adapter' => '',
]);
$detector = new Framework($packager);
@@ -190,19 +190,43 @@ class Create extends Action
$output->setAttribute('installCommand', $framework->getInstallCommand());
$output->setAttribute('buildCommand', $framework->getBuildCommand());
$output->setAttribute('outputDirectory', $framework->getOutputDirectory());
$framework = $framework->getName();
$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) : '';
} else {
$framework = 'other';
$output->setAttribute('installCommand', '');
$output->setAttribute('buildCommand', '');
$output->setAttribute('outputDirectory', '');
$frameworkName = 'other';
$detectedAdapter = '';
}
$frameworks = Config::getParam('frameworks');
if (!\in_array($framework, \array_keys($frameworks), true)) {
$framework = 'other';
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);
}
$output->setAttribute('framework', $framework);
} else {
$output = new Document([
'runtime' => '',
@@ -313,4 +337,5 @@ class Create extends Action
$response->dynamic($output, $type === 'framework' ? Response::MODEL_DETECTION_FRAMEWORK : Response::MODEL_DETECTION_RUNTIME);
}
}
@@ -38,6 +38,12 @@ class DetectionFramework extends Detection
'description' => 'Site Output Directory',
'default' => '',
'example' => 'dist',
])
->addRule('adapter', [
'type' => self::TYPE_STRING,
'description' => 'Site Adapter',
'default' => '',
'example' => 'ssr',
]);
}
@@ -185,6 +185,7 @@ 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'],
@@ -200,6 +201,7 @@ 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'],
@@ -215,6 +217,23 @@ 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