mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Revert unrelated framework output directory work
The previous commit swept in an in-flight change to the TanStack Start output directory along with the unit tests written against it. That work belongs to a separate change, and the snapshot caught it mid-edit: FrameworksTest asserts a Nuxt static output directory that the committed config does not carry, so the unit suite fails. Restore app/config/frameworks.php and DetectionTest.php to their state on main and drop FrameworksTest, leaving this branch with only the Sites e2e tests it is meant to carry.
This commit is contained in:
1 parent
55e76fe537
commit
cb64087d95
3 files changed
+1
-129
No files matched your search
@@ -240,15 +240,11 @@ return [
|
||||
'bundleCommand' => 'bash /usr/local/server/helpers/tanstack-start/bundle.sh',
|
||||
'envCommand' => 'source /usr/local/server/helpers/tanstack-start/env.sh',
|
||||
'adapters' => [
|
||||
// TanStack Start >= 1.133 builds vite-native, emitting the server
|
||||
// entry as dist/server/server.js next to dist/client. Builds that
|
||||
// opt into the nitro plugin emit .output instead, which the runtime
|
||||
// still detects, but they have to override the directory here.
|
||||
'ssr' => [
|
||||
'key' => 'ssr',
|
||||
'buildCommand' => 'npm run build',
|
||||
'installCommand' => 'npm install',
|
||||
'outputDirectory' => './dist',
|
||||
'outputDirectory' => './.output',
|
||||
'startCommand' => 'bash helpers/tanstack-start/server.sh',
|
||||
],
|
||||
'static' => [
|
||||
|
||||
@@ -24,49 +24,4 @@ final class DetectionTest extends TestCase
|
||||
$this->assertSame('ssr', $detection->getName());
|
||||
$this->assertNull($detection->getFallbackFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* TanStack Start >= 1.133 builds vite-native, emitting the server entry as
|
||||
* dist/server/server.js alongside dist/client.
|
||||
*/
|
||||
public function testRenderingFindsTanStackStartSSR(): void
|
||||
{
|
||||
$detection = Detection::rendering('tanstack-start', [
|
||||
'./client/assets/main-BBU0Zbc3.js',
|
||||
'./server/server.js',
|
||||
]);
|
||||
|
||||
$this->assertSame('ssr', $detection->getName());
|
||||
$this->assertNull($detection->getFallbackFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Opting into the nitro plugin keeps the older layout, where the server
|
||||
* entry is .output/server/index.mjs.
|
||||
*/
|
||||
public function testRenderingFindsTanStackStartNitroSSR(): void
|
||||
{
|
||||
$detection = Detection::rendering('tanstack-start', [
|
||||
'./public/favicon.ico',
|
||||
'./server/index.mjs',
|
||||
]);
|
||||
|
||||
$this->assertSame('ssr', $detection->getName());
|
||||
$this->assertNull($detection->getFallbackFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* A prerendered build ships only the client bundle, so no server entry is
|
||||
* present to match on.
|
||||
*/
|
||||
public function testRenderingFindsTanStackStartStatic(): void
|
||||
{
|
||||
$detection = Detection::rendering('tanstack-start', [
|
||||
'./index.html',
|
||||
'./assets/main-BBU0Zbc3.js',
|
||||
]);
|
||||
|
||||
$this->assertSame('static', $detection->getName());
|
||||
$this->assertSame('index.html', $detection->getFallbackFile());
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Deployment;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* A framework's ssr and static adapters describe two views of one build, so
|
||||
* their output directories have to come from the same layout. Pointing an
|
||||
* adapter at a directory the build never writes yields an empty deployment
|
||||
* rather than a build failure, which is why these are asserted directly.
|
||||
*/
|
||||
final class FrameworksTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
private array $frameworks;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
// Read the file rather than Config, which other suites overwrite.
|
||||
$this->frameworks = require __DIR__ . '/../../../app/config/frameworks.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* TanStack Start >= 1.133 builds vite-native: dist/server/server.js next to
|
||||
* dist/client. Only builds that opt into the nitro plugin still emit
|
||||
* .output, and those override the directory on the site.
|
||||
*/
|
||||
public function testTanStackStartAdaptersShareViteOutput(): void
|
||||
{
|
||||
$adapters = $this->frameworks['tanstack-start']['adapters'];
|
||||
|
||||
$this->assertSame('./dist', $adapters['ssr']['outputDirectory']);
|
||||
$this->assertSame('./dist/client', $adapters['static']['outputDirectory']);
|
||||
}
|
||||
|
||||
/**
|
||||
* nuxt generate writes .output/public, and leaves dist as a symlink to it.
|
||||
*/
|
||||
public function testNuxtStaticOutputIsInsideDotOutput(): void
|
||||
{
|
||||
$adapters = $this->frameworks['nuxt']['adapters'];
|
||||
|
||||
$this->assertSame('./.output', $adapters['ssr']['outputDirectory']);
|
||||
$this->assertSame('./.output/public', $adapters['static']['outputDirectory']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Next.js is the one framework whose static export genuinely leaves the ssr
|
||||
* build root, so it is excluded rather than special-cased below.
|
||||
*/
|
||||
public function testStaticOutputStaysInsideSsrOutput(): void
|
||||
{
|
||||
foreach ($this->frameworks as $key => $framework) {
|
||||
if ($key === 'nextjs') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ssr = $framework['adapters']['ssr']['outputDirectory'] ?? null;
|
||||
$static = $framework['adapters']['static']['outputDirectory'] ?? null;
|
||||
|
||||
if ($ssr === null || $static === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->assertStringStartsWith(
|
||||
\rtrim($ssr, '/') . '/',
|
||||
\rtrim($static, '/') . '/',
|
||||
"Framework '{$key}' serves static files from outside its ssr build output."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user