stackforge-cli 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stackforge/engines/dotnet/__init__.py +7 -7
- stackforge/engines/dotnet/api_generator.py +39 -313
- stackforge/engines/dotnet/config_generator.py +20 -77
- stackforge/engines/dotnet/csproj_generator.py +82 -82
- stackforge/engines/dotnet/docker_generator.py +15 -64
- stackforge/engines/dotnet/git_generator.py +77 -111
- stackforge/engines/dotnet/layers_generator.py +103 -544
- stackforge/engines/dotnet/program_generator.py +21 -195
- stackforge/engines/dotnet/scaffolder.py +74 -74
- stackforge/project_name.py +34 -34
- stackforge/scaffold.py +90 -90
- stackforge/templates/dotnet/API/Configurations/Swagger/ApiRoles.cs.tmpl +9 -0
- stackforge/templates/dotnet/API/ConfigureServices.cs.tmpl +120 -0
- stackforge/templates/dotnet/API/Controllers/BaseApiController.cs.tmpl +24 -0
- stackforge/templates/dotnet/API/Controllers/Main/AccountController.cs.tmpl +68 -0
- stackforge/templates/dotnet/API/DTOs/AccountDTOs.cs.tmpl +23 -0
- stackforge/templates/dotnet/API/Interface/IJwtService.cs.tmpl +7 -0
- stackforge/templates/dotnet/API/Options/JwtOptions.cs.tmpl +10 -0
- stackforge/templates/dotnet/API/Program.cs.tmpl +45 -0
- stackforge/templates/dotnet/API/Properties/launchSettings.json.tmpl +31 -0
- stackforge/templates/dotnet/API/Services/JwtService.cs.tmpl +41 -0
- stackforge/templates/dotnet/API/Swagger/EnumMemberSchemaFilter.cs.tmpl +25 -0
- stackforge/templates/dotnet/API/appsettings.Development.json.tmpl +17 -0
- stackforge/templates/dotnet/API/appsettings.json.tmpl +18 -0
- stackforge/templates/dotnet/Application/Common/Behaviors/ValidationBehavior.cs.tmpl +29 -0
- stackforge/templates/dotnet/Application/Common/Constants/ErrorMessages.cs.tmpl +10 -0
- stackforge/templates/dotnet/Application/Common/Exceptions/AppExceptions.cs.tmpl +12 -0
- stackforge/templates/dotnet/Application/Common/Exceptions/NotFoundException.cs.tmpl +10 -0
- stackforge/templates/dotnet/Application/Common/Models/ApiResponse.cs.tmpl +15 -0
- stackforge/templates/dotnet/Application/Common/Models/PagedList.cs.tmpl +30 -0
- stackforge/templates/dotnet/Application/Common/Models/PagedResponse.cs.tmpl +13 -0
- stackforge/templates/dotnet/Application/Common/Models/PaginatedResult.cs.tmpl +13 -0
- stackforge/templates/dotnet/Application/Common/Models/PagingParams.cs.tmpl +8 -0
- stackforge/templates/dotnet/Application/Common/Models/Result.cs.tmpl +30 -0
- stackforge/templates/dotnet/Application/Common/Models/Serialization/IsoDateTime.cs.tmpl +14 -0
- stackforge/templates/dotnet/Application/ConfigureServices.cs.tmpl +22 -0
- stackforge/templates/dotnet/Dockerfile.tmpl +8 -0
- stackforge/templates/dotnet/Domain/Common/BaseEntity.cs.tmpl +9 -0
- stackforge/templates/dotnet/Domain/Common/EnumMemberExtensions.cs.tmpl +16 -0
- stackforge/templates/dotnet/Domain/Entities/Identity/Role.cs.tmpl +9 -0
- stackforge/templates/dotnet/Domain/Entities/Identity/User.cs.tmpl +13 -0
- stackforge/templates/dotnet/Domain/Entities/Identity/UserRole.cs.tmpl +10 -0
- stackforge/templates/dotnet/Domain/GlobalUsings.cs.tmpl +2 -0
- stackforge/templates/dotnet/Infrastructure/ConfigureServices.cs.tmpl +14 -0
- stackforge/templates/dotnet/Persistence/Configurations/UserRoleConfiguration.cs.tmpl +24 -0
- stackforge/templates/dotnet/Persistence/ConfigureServices.cs.tmpl +18 -0
- stackforge/templates/dotnet/Persistence/DataContext.cs.tmpl +36 -0
- stackforge/templates/dotnet/Persistence/Seeders/RoleSeeder.cs.tmpl +19 -0
- stackforge/templates/dotnet/Persistence/Seeders/UserSeeder.cs.tmpl +28 -0
- stackforge/templates/dotnet/docker-compose.yml.tmpl +36 -0
- stackforge/templates/dotnet/dot_env.tmpl +10 -0
- stackforge/templates/dotnet/dot_github/workflows/sync-branches.yml.tmpl +29 -0
- stackforge/templates/dotnet/dot_gitignore.tmpl +15 -0
- stackforge/templating.py +39 -0
- stackforge/ui.py +72 -72
- stackforge/version.py +48 -48
- {stackforge_cli-0.1.3.dist-info → stackforge_cli-0.1.5.dist-info}/METADATA +109 -107
- stackforge_cli-0.1.5.dist-info/RECORD +62 -0
- {stackforge_cli-0.1.3.dist-info → stackforge_cli-0.1.5.dist-info}/WHEEL +1 -1
- stackforge_cli-0.1.3.dist-info/RECORD +0 -19
- {stackforge_cli-0.1.3.dist-info → stackforge_cli-0.1.5.dist-info}/entry_points.txt +0 -0
- {stackforge_cli-0.1.3.dist-info → stackforge_cli-0.1.5.dist-info}/top_level.txt +0 -0
|
@@ -1,64 +1,15 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
from stackforge import ui
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
""
|
|
15
|
-
|
|
16
|
-
file_path = base / "Dockerfile"
|
|
17
|
-
file_path.write_text(content)
|
|
18
|
-
ui.file_created("Dockerfile")
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def generate_docker_compose(base: Path, project: str):
|
|
22
|
-
project_lower = project.lower()
|
|
23
|
-
|
|
24
|
-
content = f"""services:
|
|
25
|
-
api:
|
|
26
|
-
build: .
|
|
27
|
-
container_name: {project_lower}_api
|
|
28
|
-
ports:
|
|
29
|
-
- "5000:8080"
|
|
30
|
-
environment:
|
|
31
|
-
- ASPNETCORE_ENVIRONMENT=Development
|
|
32
|
-
- ConnectionStrings__DefaultConnection=Host=db;Port=5432;Database={project_lower}_db;Username=postgres;Password=postgres
|
|
33
|
-
- Jwt__Issuer=http://localhost:5000
|
|
34
|
-
- Jwt__Audience=http://localhost:5000
|
|
35
|
-
- Jwt__SecretKey=your-super-secret-key-change-this-in-production
|
|
36
|
-
- Jwt__ExpiryMinutes=60
|
|
37
|
-
depends_on:
|
|
38
|
-
db:
|
|
39
|
-
condition: service_healthy
|
|
40
|
-
|
|
41
|
-
db:
|
|
42
|
-
image: postgres:latest
|
|
43
|
-
container_name: {project_lower}_db
|
|
44
|
-
environment:
|
|
45
|
-
POSTGRES_DB: {project_lower}_db
|
|
46
|
-
POSTGRES_USER: postgres
|
|
47
|
-
POSTGRES_PASSWORD: postgres
|
|
48
|
-
ports:
|
|
49
|
-
- "5432:5432"
|
|
50
|
-
volumes:
|
|
51
|
-
- {project_lower}_pgdata:/var/lib/postgresql
|
|
52
|
-
healthcheck:
|
|
53
|
-
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
54
|
-
interval: 5s
|
|
55
|
-
timeout: 5s
|
|
56
|
-
retries: 5
|
|
57
|
-
|
|
58
|
-
volumes:
|
|
59
|
-
{project_lower}_pgdata:
|
|
60
|
-
"""
|
|
61
|
-
|
|
62
|
-
file_path = base / "docker-compose.yml"
|
|
63
|
-
file_path.write_text(content)
|
|
64
|
-
ui.file_created("docker-compose.yml")
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from stackforge import ui
|
|
3
|
+
from stackforge.templating import render_file
|
|
4
|
+
|
|
5
|
+
ENGINE = "dotnet"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def generate_dockerfile(base: Path, project: str = ""):
|
|
9
|
+
render_file(ENGINE, base, "Dockerfile", project)
|
|
10
|
+
ui.file_created("Dockerfile")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def generate_docker_compose(base: Path, project: str):
|
|
14
|
+
render_file(ENGINE, base, "docker-compose.yml", project)
|
|
15
|
+
ui.file_created("docker-compose.yml")
|
|
@@ -1,111 +1,77 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
""
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
ui.file_created(".gitignore")
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def generate_github_workflow(base: Path):
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if ! git ls-remote --exit-code origin refs/heads/development; then
|
|
79
|
-
git push origin HEAD:refs/heads/development
|
|
80
|
-
fi
|
|
81
|
-
"""
|
|
82
|
-
file_path = workflow_dir / "sync-branches.yml"
|
|
83
|
-
file_path.write_text(content.lstrip())
|
|
84
|
-
ui.file_created(".github/workflows/sync-branches.yml")
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def git_init(base: Path, project: str):
|
|
88
|
-
try:
|
|
89
|
-
subprocess.run(["git", "init", "-b", "main"], cwd=base, check=True, capture_output=True)
|
|
90
|
-
ui.file_created("git init (main)")
|
|
91
|
-
|
|
92
|
-
subprocess.run(["git", "add", "."], cwd=base, check=True, capture_output=True)
|
|
93
|
-
ui.file_created("git add .")
|
|
94
|
-
|
|
95
|
-
subprocess.run(
|
|
96
|
-
["git", "commit", "-m", f"initial: scaffold {project} with stackforge"],
|
|
97
|
-
cwd=base,
|
|
98
|
-
check=True,
|
|
99
|
-
capture_output=True
|
|
100
|
-
)
|
|
101
|
-
ui.file_created("initial commit")
|
|
102
|
-
|
|
103
|
-
subprocess.run(["git", "branch", "staging"], cwd=base, check=True, capture_output=True)
|
|
104
|
-
subprocess.run(["git", "branch", "development"], cwd=base, check=True, capture_output=True)
|
|
105
|
-
ui.file_created("branches: main, staging, development")
|
|
106
|
-
|
|
107
|
-
except subprocess.CalledProcessError as e:
|
|
108
|
-
ui.error(f"Git error: {e}")
|
|
109
|
-
except FileNotFoundError:
|
|
110
|
-
ui.error("Git not found. Make sure Git is installed and in your PATH.")
|
|
111
|
-
|
|
1
|
+
import uuid
|
|
2
|
+
import subprocess
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from stackforge import ui
|
|
5
|
+
from stackforge.templating import render_file
|
|
6
|
+
|
|
7
|
+
ENGINE = "dotnet"
|
|
8
|
+
|
|
9
|
+
def generate_sln(base: Path, project: str):
|
|
10
|
+
layers = ["API", "Application", "Domain", "Infrastructure", "Persistence"]
|
|
11
|
+
configurations = ["Debug|Any CPU", "Release|Any CPU"]
|
|
12
|
+
|
|
13
|
+
project_entries = ""
|
|
14
|
+
project_configs = ""
|
|
15
|
+
for layer in layers:
|
|
16
|
+
guid = "{" + str(uuid.uuid4()).upper() + "}"
|
|
17
|
+
project_entries += f"""Project("{{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}}") = "{layer}", "{layer}\\{layer}.csproj", "{guid}"
|
|
18
|
+
EndProject
|
|
19
|
+
"""
|
|
20
|
+
for config in configurations:
|
|
21
|
+
project_configs += f"\t\t{guid}.{config}.ActiveCfg = {config}\n"
|
|
22
|
+
project_configs += f"\t\t{guid}.{config}.Build.0 = {config}\n"
|
|
23
|
+
|
|
24
|
+
solution_configs = "".join(f"\t\t{config} = {config}\n" for config in configurations)
|
|
25
|
+
|
|
26
|
+
# Without the Global section, dotnet build/restore on the .sln finds no projects to build.
|
|
27
|
+
content = f"""
|
|
28
|
+
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
29
|
+
# Visual Studio Version 17
|
|
30
|
+
{project_entries}Global
|
|
31
|
+
\tGlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
32
|
+
{solution_configs}\tEndGlobalSection
|
|
33
|
+
\tGlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
34
|
+
{project_configs}\tEndGlobalSection
|
|
35
|
+
EndGlobal
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
file_path = base / f"{project}.sln"
|
|
39
|
+
file_path.write_text(content)
|
|
40
|
+
ui.file_created(f"{project}.sln")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def generate_gitignore(base: Path, project: str = ""):
|
|
44
|
+
render_file(ENGINE, base, ".gitignore", project)
|
|
45
|
+
ui.file_created(".gitignore")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def generate_github_workflow(base: Path, project: str = ""):
|
|
49
|
+
render_file(ENGINE, base, ".github/workflows/sync-branches.yml", project)
|
|
50
|
+
ui.file_created(".github/workflows/sync-branches.yml")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def git_init(base: Path, project: str):
|
|
54
|
+
try:
|
|
55
|
+
subprocess.run(["git", "init", "-b", "main"], cwd=base, check=True, capture_output=True)
|
|
56
|
+
ui.file_created("git init (main)")
|
|
57
|
+
|
|
58
|
+
subprocess.run(["git", "add", "."], cwd=base, check=True, capture_output=True)
|
|
59
|
+
ui.file_created("git add .")
|
|
60
|
+
|
|
61
|
+
subprocess.run(
|
|
62
|
+
["git", "commit", "-m", f"initial: scaffold {project} with stackforge"],
|
|
63
|
+
cwd=base,
|
|
64
|
+
check=True,
|
|
65
|
+
capture_output=True
|
|
66
|
+
)
|
|
67
|
+
ui.file_created("initial commit")
|
|
68
|
+
|
|
69
|
+
subprocess.run(["git", "branch", "staging"], cwd=base, check=True, capture_output=True)
|
|
70
|
+
subprocess.run(["git", "branch", "development"], cwd=base, check=True, capture_output=True)
|
|
71
|
+
ui.file_created("branches: main, staging, development")
|
|
72
|
+
|
|
73
|
+
except subprocess.CalledProcessError as e:
|
|
74
|
+
ui.error(f"Git error: {e}")
|
|
75
|
+
except FileNotFoundError:
|
|
76
|
+
ui.error("Git not found. Make sure Git is installed and in your PATH.")
|
|
77
|
+
|