diff --git a/README.md b/README.md index 3f2ef88..f0e4254 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ $detector ->addOption(new Angular()) ->addOption(new Remix()) ->addOption(new SvelteKit()) + ->addOption(new Lynx()) ->addOption(new NextJs()); $detectedFramework = $detector->detect(); @@ -130,6 +131,7 @@ Framework Adapters: | SvelteKit | ✅ | | Angular | ✅ | | Analog | ✅ | +| Lynx | ✅ | Packager Adapters: diff --git a/src/Detection/Framework/Analog.php b/src/Detection/Framework/Analog.php index 4900c96..19de424 100644 --- a/src/Detection/Framework/Analog.php +++ b/src/Detection/Framework/Analog.php @@ -16,7 +16,7 @@ public function getName(): string */ public function getFiles(): array { - return ['vite.config.js', 'vite.config.ts', 'angular.json']; + return ['angular.json']; } public function getInstallCommand(): string diff --git a/src/Detection/Framework/Lynx.php b/src/Detection/Framework/Lynx.php new file mode 100644 index 0000000..790d191 --- /dev/null +++ b/src/Detection/Framework/Lynx.php @@ -0,0 +1,44 @@ + + */ + public function getFiles(): array + { + return ['lynx.config.ts', 'lynx.config.js']; + } + + public function getInstallCommand(): string + { + return match ($this->packager) { + 'yarn' => 'yarn install', + 'pnpm' => 'pnpm install', + default => 'npm install', + }; + } + + public function getBuildCommand(): string + { + return match ($this->packager) { + 'yarn' => 'yarn build', + 'pnpm' => 'pnpm build', + default => 'npm run build', + }; + } + + public function getOutputDirectory(): string + { + return './dist'; + } +} diff --git a/src/Detection/Framework/Remix.php b/src/Detection/Framework/Remix.php index 89c7416..7a34da7 100644 --- a/src/Detection/Framework/Remix.php +++ b/src/Detection/Framework/Remix.php @@ -16,7 +16,7 @@ public function getName(): string */ public function getFiles(): array { - return ['remix.config.js', 'remix.config.ts', 'vite.config.ts', 'vite.config.mjs']; + return ['remix.config.js', 'remix.config.ts']; } public function getInstallCommand(): string diff --git a/src/Detection/Framework/SvelteKit.php b/src/Detection/Framework/SvelteKit.php index 88ca901..d84d63d 100644 --- a/src/Detection/Framework/SvelteKit.php +++ b/src/Detection/Framework/SvelteKit.php @@ -16,7 +16,7 @@ public function getName(): string */ public function getFiles(): array { - return ['svelte.config.js', 'vite.config.js', 'vite.config.mjs', 'vite.config.ts']; + return ['svelte.config.js']; } public function getInstallCommand(): string diff --git a/src/Detection/Rendering/SSR.php b/src/Detection/Rendering/SSR.php index e4be83d..a4631d7 100644 --- a/src/Detection/Rendering/SSR.php +++ b/src/Detection/Rendering/SSR.php @@ -15,6 +15,7 @@ class SSR extends Rendering 'angular' => ['server/server.mjs'], 'analog' => ['server/index.mjs'], 'flutter' => [], + 'lynx' => [], ]; public function getName(): string diff --git a/tests/unit/DetectorTest.php b/tests/unit/DetectorTest.php index d8dc2eb..d52e760 100644 --- a/tests/unit/DetectorTest.php +++ b/tests/unit/DetectorTest.php @@ -7,6 +7,7 @@ use Utopia\Detector\Detection\Framework\Angular; use Utopia\Detector\Detection\Framework\Astro; use Utopia\Detector\Detection\Framework\Flutter; +use Utopia\Detector\Detection\Framework\Lynx; use Utopia\Detector\Detection\Framework\NextJs; use Utopia\Detector\Detection\Framework\Nuxt; use Utopia\Detector\Detection\Framework\Remix; @@ -262,6 +263,7 @@ public function testFrameworkDetection(array $files, ?string $framework, ?string ->addOption(new Remix()) ->addOption(new SvelteKit()) ->addOption(new NextJs()) + ->addOption(new Lynx()) ->addOption(new Angular()) ->addOption(new Analog()); @@ -287,6 +289,7 @@ public function frameworkDataProvider(): array [['src', 'types', 'makefile', 'components.js', 'debug.js', 'package.json', 'svelte.config.js'], 'sveltekit', 'npm install', 'npm run build', './build'], [['app', 'backend', 'public', 'Dockerfile', 'docker-compose.yml', 'ecosystem.config.js', 'middleware.ts', 'next.config.js', 'package-lock.json', 'package.json', 'server.js', 'tsconfig.json'], 'nextjs', 'npm install', 'npm run build', './.next'], [['assets', 'components', 'layouts', 'pages', 'babel.config.js', 'error.vue', 'nuxt.config.js', 'yarn.lock'], 'nuxt', 'npm install', 'npm run build', './output'], + [['lynx.config.js'], 'lynx', 'npm install', 'npm run build', './dist'], [['src', 'package.json', 'tsconfig.json', 'angular.json', 'logo.png'], 'angular', 'npm install', 'npm run build', './dist/angular'], [['app', 'public', 'remix.config.js', 'remix.env.d.ts', 'sandbox.config.js', 'tsconfig.json', 'package.json'], 'remix', 'npm install', 'npm run build', './build'], [['public', 'src', 'astro.config.mjs', 'package-lock.json', 'package.json', 'tsconfig.json'], 'astro', 'npm install', 'npm run build', './dist'],