Skip to content

Commit 93312c1

Browse files
committed
feat(new): add production backend and web templates
2 parents fbe6b8d + 1669eb3 commit 93312c1

47 files changed

Lines changed: 3335 additions & 564 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/vix/cli/commands/new/NewGenerator.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ namespace vix::commands::new_cmd::generator
7979
const FeaturesSelection &features,
8080
std::string &err);
8181

82+
bool generate_web_project(
83+
const std::filesystem::path &projectDir,
84+
const std::string &projName,
85+
const FeaturesSelection &features,
86+
std::string &err);
87+
8288
// ------------------------------------------------------------------
8389
// Post-generation output
8490
// ------------------------------------------------------------------
@@ -87,4 +93,7 @@ namespace vix::commands::new_cmd::generator
8793
void print_next_steps_lib(const fs::path &projectDir, const std::string &projName);
8894
void print_next_steps_game(const fs::path &projectDir, const std::string &projName);
8995
void print_next_steps_backend(const fs::path &projectDir, const std::string &projName);
96+
void print_next_steps_web(
97+
const std::filesystem::path &projectDir,
98+
const std::string &projName);
9099
} // namespace vix::commands::new_cmd::generator

include/vix/cli/commands/new/NewOutput.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ namespace vix::commands::new_cmd::output
5454
const std::string &projName,
5555
const FeaturesSelection &features);
5656

57+
void print_creation_web(
58+
const std::filesystem::path &projectDir,
59+
const std::string &projName,
60+
const FeaturesSelection &features);
61+
5762
} // namespace vix::commands::new_cmd::output
5863

5964
#endif

include/vix/cli/commands/new/NewTemplates.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
#include <vix/cli/commands/new/templates/GameTemplates.hpp>
1919
#include <vix/cli/commands/new/templates/LibTemplates.hpp>
2020
#include <vix/cli/commands/new/templates/VueTemplates.hpp>
21+
#include <vix/cli/commands/new/templates/WebTemplates.hpp>

include/vix/cli/commands/new/NewTypes.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ namespace vix::commands::new_cmd
2020
Lib,
2121
Vue,
2222
Game,
23-
Backend
23+
Backend,
24+
Web
2425
};
2526

2627
struct FeaturesSelection

include/vix/cli/commands/new/templates/BackendTemplates.hpp

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,15 @@
44
* @file BackendTemplates.hpp
55
* @author Gaspard Kirira
66
*
7-
* File-content templates for the production backend `vix new` template.
7+
* Public facade for the production backend `vix new` template.
88
*/
99

10-
#include <string>
11-
12-
#include <vix/cli/commands/new/NewTypes.hpp>
13-
14-
namespace vix::commands::new_cmd::templates
15-
{
16-
17-
std::string make_backend_main_cpp(const std::string &projectName);
18-
19-
std::string make_backend_app_bootstrap_hpp(const std::string &projectName);
20-
std::string make_backend_app_bootstrap_cpp(const std::string &projectName);
21-
22-
std::string make_backend_route_registry_hpp(const std::string &projectName);
23-
std::string make_backend_route_registry_cpp(const std::string &projectName);
24-
25-
std::string make_backend_middleware_registry_hpp(const std::string &projectName);
26-
std::string make_backend_middleware_registry_cpp(const std::string &projectName);
27-
28-
std::string make_backend_health_controller_hpp(const std::string &projectName);
29-
std::string make_backend_health_controller_cpp(const std::string &projectName);
30-
31-
std::string make_backend_production_config_json();
32-
std::string make_backend_env_example();
33-
std::string make_backend_basic_test_cpp(const std::string &projectName);
34-
35-
std::string make_readme_backend(const std::string &projectName);
36-
37-
std::string make_project_manifest_backend(
38-
const std::string &projectName,
39-
const FeaturesSelection &features);
40-
41-
std::string make_vix_json_backend(const std::string &projectName);
42-
43-
} // namespace vix::commands::new_cmd::templates
10+
#include <vix/cli/commands/new/templates/backend/BackendBootstrapTemplates.hpp>
11+
#include <vix/cli/commands/new/templates/backend/BackendConfigTemplates.hpp>
12+
#include <vix/cli/commands/new/templates/backend/BackendControllerTemplates.hpp>
13+
#include <vix/cli/commands/new/templates/backend/BackendManifestTemplates.hpp>
14+
#include <vix/cli/commands/new/templates/backend/BackendMiddlewareTemplates.hpp>
15+
#include <vix/cli/commands/new/templates/backend/BackendReadmeTemplates.hpp>
16+
#include <vix/cli/commands/new/templates/backend/BackendRouteTemplates.hpp>
17+
#include <vix/cli/commands/new/templates/backend/BackendTestTemplates.hpp>
18+
#include <vix/cli/commands/new/templates/backend/BackendSupportTemplates.hpp>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#pragma once
2+
3+
/**
4+
* @file WebTemplates.hpp
5+
* @author Gaspard Kirira
6+
*
7+
* Public facade for the server-rendered web `vix new` template.
8+
*/
9+
10+
#include <vix/cli/commands/new/templates/web/WebBootstrapTemplates.hpp>
11+
#include <vix/cli/commands/new/templates/web/WebConfigTemplates.hpp>
12+
#include <vix/cli/commands/new/templates/web/WebControllerTemplates.hpp>
13+
#include <vix/cli/commands/new/templates/web/WebManifestTemplates.hpp>
14+
#include <vix/cli/commands/new/templates/web/WebMiddlewareTemplates.hpp>
15+
#include <vix/cli/commands/new/templates/web/WebReadmeTemplates.hpp>
16+
#include <vix/cli/commands/new/templates/web/WebRouteTemplates.hpp>
17+
#include <vix/cli/commands/new/templates/web/WebTestTemplates.hpp>
18+
#include <vix/cli/commands/new/templates/web/WebViewTemplates.hpp>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
3+
/**
4+
* @file BackendBootstrapTemplates.hpp
5+
* @author Gaspard Kirira
6+
*
7+
* Entry-point and bootstrap file-content templates for the production backend
8+
* `vix new` template.
9+
*/
10+
11+
#include <string>
12+
13+
namespace vix::commands::new_cmd::templates
14+
{
15+
16+
std::string make_backend_main_cpp(const std::string &projectName);
17+
std::string make_backend_app_bootstrap_hpp(const std::string &projectName);
18+
std::string make_backend_app_bootstrap_cpp(const std::string &projectName);
19+
20+
} // namespace vix::commands::new_cmd::templates
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#pragma once
2+
3+
/**
4+
* @file BackendConfigTemplates.hpp
5+
* @author Gaspard Kirira
6+
*
7+
* Configuration file-content templates for the production backend `vix new`
8+
* template.
9+
*/
10+
11+
#include <string>
12+
13+
namespace vix::commands::new_cmd::templates
14+
{
15+
16+
std::string make_backend_production_config_json(const std::string &projectName);
17+
std::string make_backend_env_example(const std::string &projectName);
18+
19+
} // namespace vix::commands::new_cmd::templates
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
3+
/**
4+
* @file BackendControllerTemplates.hpp
5+
* @author Gaspard Kirira
6+
*
7+
* Controller file-content templates for the production backend `vix new`
8+
* template.
9+
*/
10+
11+
#include <string>
12+
13+
namespace vix::commands::new_cmd::templates
14+
{
15+
16+
std::string make_backend_home_controller_hpp(const std::string &projectName);
17+
std::string make_backend_home_controller_cpp(const std::string &projectName);
18+
19+
std::string make_backend_health_controller_hpp(const std::string &projectName);
20+
std::string make_backend_health_controller_cpp(const std::string &projectName);
21+
22+
} // namespace vix::commands::new_cmd::templates
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
3+
/**
4+
* @file BackendManifestTemplates.hpp
5+
* @author Gaspard Kirira
6+
*
7+
* Manifest file-content templates for the production backend `vix new`
8+
* template.
9+
*/
10+
11+
#include <string>
12+
13+
#include <vix/cli/commands/new/NewTypes.hpp>
14+
15+
namespace vix::commands::new_cmd::templates
16+
{
17+
18+
std::string make_project_manifest_backend(
19+
const std::string &projectName,
20+
const FeaturesSelection &features);
21+
22+
std::string make_vix_json_backend(const std::string &projectName);
23+
24+
} // namespace vix::commands::new_cmd::templates

0 commit comments

Comments
 (0)