From 0d314c00a690003d1efce7424742813b7d68d75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 22 Nov 2024 14:55:52 +0100 Subject: [PATCH] Add more defaults to frameworks --- app/config/frameworks.php | 35 ++++++++++--- .../specs/open-api3-latest-console.json | 50 ++++++++++++++----- app/config/specs/open-api3-latest-server.json | 50 ++++++++++++++----- app/config/specs/swagger2-latest-console.json | 50 ++++++++++++++----- app/config/specs/swagger2-latest-server.json | 50 ++++++++++++++----- .../Utopia/Response/Model/Framework.php | 42 +++++++++++----- .../Response/Model/TemplateFramework.php | 24 ++++----- 7 files changed, 222 insertions(+), 79 deletions(-) diff --git a/app/config/frameworks.php b/app/config/frameworks.php index 14ee3cde56..ef2827c275 100644 --- a/app/config/frameworks.php +++ b/app/config/frameworks.php @@ -24,7 +24,10 @@ return [ 'static-1' ], 'defaultBuildRuntime' => 'node-22', - 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node') + 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'defaultBuildCommand' => 'npm run build', + 'defaultInstallCommand' => 'npm install', + 'defaultOutputDirectory' => './build', ], 'nextjs' => [ 'key' => 'nextjs', @@ -34,7 +37,10 @@ return [ 'static-1' ], 'defaultBuildRuntime' => 'node-22', - 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node') + 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'defaultBuildCommand' => 'npm run build', + 'defaultInstallCommand' => 'npm install', + 'defaultOutputDirectory' => './out', ], 'nuxt' => [ 'key' => 'nuxt', @@ -44,7 +50,10 @@ return [ 'static-1' ], 'defaultBuildRuntime' => 'node-22', - 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node') + 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'defaultBuildCommand' => 'npm run generate', + 'defaultInstallCommand' => 'npm install', + 'defaultOutputDirectory' => './dist', ], 'angular' => [ 'key' => 'angular', @@ -54,7 +63,10 @@ return [ 'static-1' ], 'defaultBuildRuntime' => 'node-22', - 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node') + 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'defaultBuildCommand' => 'npm run build', + 'defaultInstallCommand' => 'npm install', + 'defaultOutputDirectory' => './dist/starter/browser', ], 'astro' => [ 'key' => 'astro', @@ -64,7 +76,10 @@ return [ 'static-1' ], 'defaultBuildRuntime' => 'node-22', - 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node') + 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'defaultBuildCommand' => 'npm run build', + 'defaultInstallCommand' => 'npm install', + 'defaultOutputDirectory' => './dist', ], 'remix' => [ 'key' => 'remix', @@ -74,7 +89,10 @@ return [ 'static-1' ], 'defaultBuildRuntime' => 'node-22', - 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node') + 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'defaultBuildCommand' => 'npm run build', + 'defaultInstallCommand' => 'npm install', + 'defaultOutputDirectory' => './build/client', ], 'static' => [ 'key' => 'static', @@ -84,6 +102,9 @@ return [ 'static-1' ], 'defaultBuildRuntime' => 'node-22', - 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node') + 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'defaultBuildCommand' => 'npm run build', + 'defaultInstallCommand' => 'npm install', + 'defaultOutputDirectory' => './build', ] ]; diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 62879abf67..34b86b7dae 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -25313,6 +25313,10 @@ "enum": [ "sveltekit", "nextjs", + "nuxt", + "angular", + "astro", + "remix", "static" ], "x-enum-name": null, @@ -25980,6 +25984,10 @@ "enum": [ "sveltekit", "nextjs", + "nuxt", + "angular", + "astro", + "remix", "static" ], "x-enum-name": null, @@ -38286,11 +38294,6 @@ "description": "Name of the logo image.", "x-example": "sveltekit.png" }, - "defaultServeRuntime": { - "type": "string", - "description": "Default runtime version.", - "x-example": "static-1" - }, "serveRuntimes": { "type": "array", "description": "List of supported runtime versions.", @@ -38299,11 +38302,6 @@ }, "x-example": "static-1" }, - "defaultBuildRuntime": { - "type": "string", - "description": "Default runtime version.", - "x-example": "node-22" - }, "buildRuntimes": { "type": "array", "description": "List of supported runtime versions.", @@ -38311,16 +38309,44 @@ "type": "string" }, "x-example": "node-21.0" + }, + "defaultServeRuntime": { + "type": "string", + "description": "Default runtime version.", + "x-example": "static-1" + }, + "defaultBuildRuntime": { + "type": "string", + "description": "Default runtime version.", + "x-example": "node-22" + }, + "defaultInstallCommand": { + "type": "string", + "description": "Default command to download dependencies.", + "x-example": "npm install" + }, + "defaultBuildCommand": { + "type": "string", + "description": "Default command to build site into output directory.", + "x-example": "npm run build" + }, + "defaultOutputDirectory": { + "type": "string", + "description": "Default output directory of build.", + "x-example": ".\/dist" } }, "required": [ "key", "name", "logo", - "defaultServeRuntime", "serveRuntimes", + "buildRuntimes", + "defaultServeRuntime", "defaultBuildRuntime", - "buildRuntimes" + "defaultInstallCommand", + "defaultBuildCommand", + "defaultOutputDirectory" ] }, "deployment": { diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index abe0f04787..b3ea4fde67 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -17129,6 +17129,10 @@ "enum": [ "sveltekit", "nextjs", + "nuxt", + "angular", + "astro", + "remix", "static" ], "x-enum-name": null, @@ -17561,6 +17565,10 @@ "enum": [ "sveltekit", "nextjs", + "nuxt", + "angular", + "astro", + "remix", "static" ], "x-enum-name": null, @@ -28015,11 +28023,6 @@ "description": "Name of the logo image.", "x-example": "sveltekit.png" }, - "defaultServeRuntime": { - "type": "string", - "description": "Default runtime version.", - "x-example": "static-1" - }, "serveRuntimes": { "type": "array", "description": "List of supported runtime versions.", @@ -28028,11 +28031,6 @@ }, "x-example": "static-1" }, - "defaultBuildRuntime": { - "type": "string", - "description": "Default runtime version.", - "x-example": "node-22" - }, "buildRuntimes": { "type": "array", "description": "List of supported runtime versions.", @@ -28040,16 +28038,44 @@ "type": "string" }, "x-example": "node-21.0" + }, + "defaultServeRuntime": { + "type": "string", + "description": "Default runtime version.", + "x-example": "static-1" + }, + "defaultBuildRuntime": { + "type": "string", + "description": "Default runtime version.", + "x-example": "node-22" + }, + "defaultInstallCommand": { + "type": "string", + "description": "Default command to download dependencies.", + "x-example": "npm install" + }, + "defaultBuildCommand": { + "type": "string", + "description": "Default command to build site into output directory.", + "x-example": "npm run build" + }, + "defaultOutputDirectory": { + "type": "string", + "description": "Default output directory of build.", + "x-example": ".\/dist" } }, "required": [ "key", "name", "logo", - "defaultServeRuntime", "serveRuntimes", + "buildRuntimes", + "defaultServeRuntime", "defaultBuildRuntime", - "buildRuntimes" + "defaultInstallCommand", + "defaultBuildCommand", + "defaultOutputDirectory" ] }, "deployment": { diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index ac086117dd..46da49df95 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -25790,6 +25790,10 @@ "enum": [ "sveltekit", "nextjs", + "nuxt", + "angular", + "astro", + "remix", "static" ], "x-enum-name": null, @@ -26474,6 +26478,10 @@ "enum": [ "sveltekit", "nextjs", + "nuxt", + "angular", + "astro", + "remix", "static" ], "x-enum-name": null, @@ -38845,11 +38853,6 @@ "description": "Name of the logo image.", "x-example": "sveltekit.png" }, - "defaultServeRuntime": { - "type": "string", - "description": "Default runtime version.", - "x-example": "static-1" - }, "serveRuntimes": { "type": "array", "description": "List of supported runtime versions.", @@ -38858,11 +38861,6 @@ }, "x-example": "static-1" }, - "defaultBuildRuntime": { - "type": "string", - "description": "Default runtime version.", - "x-example": "node-22" - }, "buildRuntimes": { "type": "array", "description": "List of supported runtime versions.", @@ -38870,16 +38868,44 @@ "type": "string" }, "x-example": "node-21.0" + }, + "defaultServeRuntime": { + "type": "string", + "description": "Default runtime version.", + "x-example": "static-1" + }, + "defaultBuildRuntime": { + "type": "string", + "description": "Default runtime version.", + "x-example": "node-22" + }, + "defaultInstallCommand": { + "type": "string", + "description": "Default command to download dependencies.", + "x-example": "npm install" + }, + "defaultBuildCommand": { + "type": "string", + "description": "Default command to build site into output directory.", + "x-example": "npm run build" + }, + "defaultOutputDirectory": { + "type": "string", + "description": "Default output directory of build.", + "x-example": ".\/dist" } }, "required": [ "key", "name", "logo", - "defaultServeRuntime", "serveRuntimes", + "buildRuntimes", + "defaultServeRuntime", "defaultBuildRuntime", - "buildRuntimes" + "defaultInstallCommand", + "defaultBuildCommand", + "defaultOutputDirectory" ] }, "deployment": { diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 2114a88711..a95b46dfe4 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -17574,6 +17574,10 @@ "enum": [ "sveltekit", "nextjs", + "nuxt", + "angular", + "astro", + "remix", "static" ], "x-enum-name": null, @@ -18027,6 +18031,10 @@ "enum": [ "sveltekit", "nextjs", + "nuxt", + "angular", + "astro", + "remix", "static" ], "x-enum-name": null, @@ -28547,11 +28555,6 @@ "description": "Name of the logo image.", "x-example": "sveltekit.png" }, - "defaultServeRuntime": { - "type": "string", - "description": "Default runtime version.", - "x-example": "static-1" - }, "serveRuntimes": { "type": "array", "description": "List of supported runtime versions.", @@ -28560,11 +28563,6 @@ }, "x-example": "static-1" }, - "defaultBuildRuntime": { - "type": "string", - "description": "Default runtime version.", - "x-example": "node-22" - }, "buildRuntimes": { "type": "array", "description": "List of supported runtime versions.", @@ -28572,16 +28570,44 @@ "type": "string" }, "x-example": "node-21.0" + }, + "defaultServeRuntime": { + "type": "string", + "description": "Default runtime version.", + "x-example": "static-1" + }, + "defaultBuildRuntime": { + "type": "string", + "description": "Default runtime version.", + "x-example": "node-22" + }, + "defaultInstallCommand": { + "type": "string", + "description": "Default command to download dependencies.", + "x-example": "npm install" + }, + "defaultBuildCommand": { + "type": "string", + "description": "Default command to build site into output directory.", + "x-example": "npm run build" + }, + "defaultOutputDirectory": { + "type": "string", + "description": "Default output directory of build.", + "x-example": ".\/dist" } }, "required": [ "key", "name", "logo", - "defaultServeRuntime", "serveRuntimes", + "buildRuntimes", + "defaultServeRuntime", "defaultBuildRuntime", - "buildRuntimes" + "defaultInstallCommand", + "defaultBuildCommand", + "defaultOutputDirectory" ] }, "deployment": { diff --git a/src/Appwrite/Utopia/Response/Model/Framework.php b/src/Appwrite/Utopia/Response/Model/Framework.php index 9d55250e87..162ab08cca 100644 --- a/src/Appwrite/Utopia/Response/Model/Framework.php +++ b/src/Appwrite/Utopia/Response/Model/Framework.php @@ -28,12 +28,6 @@ class Framework extends Model 'default' => '', 'example' => 'sveltekit.png', ]) - ->addRule('defaultServeRuntime', [ - 'type' => self::TYPE_STRING, - 'description' => 'Default runtime version.', - 'default' => '', - 'example' => 'static-1', - ]) ->addRule('serveRuntimes', [ 'type' => self::TYPE_STRING, 'description' => 'List of supported runtime versions.', @@ -41,12 +35,6 @@ class Framework extends Model 'example' => 'static-1', 'array' => true, ]) - ->addRule('defaultBuildRuntime', [ - 'type' => self::TYPE_STRING, - 'description' => 'Default runtime version.', - 'default' => '', - 'example' => 'node-22', - ]) ->addRule('buildRuntimes', [ 'type' => self::TYPE_STRING, 'description' => 'List of supported runtime versions.', @@ -54,6 +42,36 @@ class Framework extends Model 'example' => 'node-21.0', 'array' => true, ]) + ->addRule('defaultServeRuntime', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default runtime version.', + 'default' => '', + 'example' => 'static-1', + ]) + ->addRule('defaultBuildRuntime', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default runtime version.', + 'default' => '', + 'example' => 'node-22', + ]) + ->addRule('defaultInstallCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default command to download dependencies.', + 'default' => '', + 'example' => 'npm install', + ]) + ->addRule('defaultBuildCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default command to build site into output directory.', + 'default' => '', + 'example' => 'npm run build', + ]) + ->addRule('defaultOutputDirectory', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default output directory of build.', + 'default' => '', + 'example' => './dist', + ]) ; } diff --git a/src/Appwrite/Utopia/Response/Model/TemplateFramework.php b/src/Appwrite/Utopia/Response/Model/TemplateFramework.php index 63d1c6e218..67b7e21152 100644 --- a/src/Appwrite/Utopia/Response/Model/TemplateFramework.php +++ b/src/Appwrite/Utopia/Response/Model/TemplateFramework.php @@ -10,18 +10,18 @@ class TemplateFramework extends Model public function __construct() { $this - ->addRule('key', [ - 'type' => self::TYPE_STRING, - 'description' => 'Parent framework key.', - 'default' => '', - 'example' => 'sveltekit', - ]) - ->addRule('name', [ - 'type' => self::TYPE_STRING, - 'description' => 'Framework Name.', - 'default' => '', - 'example' => 'SvelteKit' - ]) + ->addRule('key', [ + 'type' => self::TYPE_STRING, + 'description' => 'Parent framework key.', + 'default' => '', + 'example' => 'sveltekit', + ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'Framework Name.', + 'default' => '', + 'example' => 'SvelteKit' + ]) ->addRule('installCommand', [ 'type' => self::TYPE_STRING, 'description' => 'The install command used to install the dependencies.',