stackforge-cli 0.1.3__py3-none-any.whl → 0.1.4__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.
@@ -1,77 +1,77 @@
1
- from pathlib import Path
2
- from stackforge import ui
3
-
4
-
5
- def generate_env(base: Path, project: str):
6
- project_lower = project.lower()
7
-
8
- content = f"""ASPNETCORE_ENVIRONMENT=Development
9
- DB_HOST=db
10
- DB_PORT=5432
11
- DB_NAME={project_lower}_db
12
- DB_USER=postgres
13
- DB_PASSWORD=postgres
14
- JWT_ISSUER=https://localhost:5000
15
- JWT_AUDIENCE=https://localhost:5000
16
- JWT_SECRET_KEY=your-super-secret-key-change-this-in-production
17
- JWT_EXPIRY_MINUTES=60
18
- """
19
-
20
- file_path = base / ".env"
21
- file_path.write_text(content)
22
- ui.file_created(".env")
23
-
24
-
25
- def generate_appsettings(base: Path, project: str):
26
- project_lower = project.lower()
27
-
28
- content = f"""{{
29
- "ConnectionStrings": {{
30
- "DefaultConnection": "Host=db;Port=5432;Database={project_lower}_db;Username=postgres;Password=postgres"
31
- }},
32
- "Jwt": {{
33
- "Issuer": "https://localhost:5000",
34
- "Audience": "https://localhost:5000",
35
- "SecretKey": "your-super-secret-key-change-this-in-production",
36
- "ExpiryMinutes": 60
37
- }},
38
- "Logging": {{
39
- "LogLevel": {{
40
- "Default": "Information",
41
- "Microsoft.AspNetCore": "Warning"
42
- }}
43
- }},
44
- "AllowedHosts": "*"
45
- }}
46
- """
47
-
48
- file_path = base / "API" / "appsettings.json"
49
- file_path.write_text(content)
50
- ui.file_created("API/appsettings.json")
51
-
52
-
53
- def generate_appsettings_development(base: Path, project: str):
54
- project_lower = project.lower()
55
-
56
- content = f"""{{
57
- "ConnectionStrings": {{
58
- "DefaultConnection": "Host=localhost;Port=5432;Database={project_lower}_db;Username=postgres;Password=postgres"
59
- }},
60
- "Jwt": {{
61
- "Issuer": "https://localhost:5000",
62
- "Audience": "https://localhost:5000",
63
- "SecretKey": "your-super-secret-key-change-this-in-production",
64
- "ExpiryMinutes": 60
65
- }},
66
- "Logging": {{
67
- "LogLevel": {{
68
- "Default": "Information",
69
- "Microsoft.AspNetCore": "Warning"
70
- }}
71
- }}
72
- }}
73
- """
74
-
75
- file_path = base / "API" / "appsettings.Development.json"
76
- file_path.write_text(content)
1
+ from pathlib import Path
2
+ from stackforge import ui
3
+
4
+
5
+ def generate_env(base: Path, project: str):
6
+ project_lower = project.lower()
7
+
8
+ content = f"""ASPNETCORE_ENVIRONMENT=Development
9
+ DB_HOST=db
10
+ DB_PORT=5432
11
+ DB_NAME={project_lower}_db
12
+ DB_USER=postgres
13
+ DB_PASSWORD=postgres
14
+ JWT_ISSUER=https://localhost:5000
15
+ JWT_AUDIENCE=https://localhost:5000
16
+ JWT_SECRET_KEY=your-super-secret-key-change-this-in-production
17
+ JWT_EXPIRY_MINUTES=60
18
+ """
19
+
20
+ file_path = base / ".env"
21
+ file_path.write_text(content)
22
+ ui.file_created(".env")
23
+
24
+
25
+ def generate_appsettings(base: Path, project: str):
26
+ project_lower = project.lower()
27
+
28
+ content = f"""{{
29
+ "ConnectionStrings": {{
30
+ "DefaultConnection": "Host=db;Port=5432;Database={project_lower}_db;Username=postgres;Password=postgres"
31
+ }},
32
+ "Jwt": {{
33
+ "Issuer": "https://localhost:5000",
34
+ "Audience": "https://localhost:5000",
35
+ "SecretKey": "your-super-secret-key-change-this-in-production",
36
+ "ExpiryMinutes": 60
37
+ }},
38
+ "Logging": {{
39
+ "LogLevel": {{
40
+ "Default": "Information",
41
+ "Microsoft.AspNetCore": "Warning"
42
+ }}
43
+ }},
44
+ "AllowedHosts": "*"
45
+ }}
46
+ """
47
+
48
+ file_path = base / "API" / "appsettings.json"
49
+ file_path.write_text(content)
50
+ ui.file_created("API/appsettings.json")
51
+
52
+
53
+ def generate_appsettings_development(base: Path, project: str):
54
+ project_lower = project.lower()
55
+
56
+ content = f"""{{
57
+ "ConnectionStrings": {{
58
+ "DefaultConnection": "Host=localhost;Port=5432;Database={project_lower}_db;Username=postgres;Password=postgres"
59
+ }},
60
+ "Jwt": {{
61
+ "Issuer": "https://localhost:5000",
62
+ "Audience": "https://localhost:5000",
63
+ "SecretKey": "your-super-secret-key-change-this-in-production",
64
+ "ExpiryMinutes": 60
65
+ }},
66
+ "Logging": {{
67
+ "LogLevel": {{
68
+ "Default": "Information",
69
+ "Microsoft.AspNetCore": "Warning"
70
+ }}
71
+ }}
72
+ }}
73
+ """
74
+
75
+ file_path = base / "API" / "appsettings.Development.json"
76
+ file_path.write_text(content)
77
77
  ui.file_created("API/appsettings.Development.json")
@@ -1,83 +1,83 @@
1
- from pathlib import Path
2
- from stackforge import ui
3
-
4
-
5
- LAYER_CONFIGS = {
6
- "Domain": {
7
- "sdk": "Microsoft.NET.Sdk",
8
- "references": [],
9
- "packages": [
10
- ("Microsoft.AspNetCore.Identity.EntityFrameworkCore", "10.0.4"),
11
- ],
12
- },
13
- "Application": {
14
- "sdk": "Microsoft.NET.Sdk",
15
- "references": ["Domain"],
16
- "packages": [
17
- ("MediatR", "14.1.0"),
18
- ("FluentValidation", "11.9.0"),
19
- ("FluentValidation.DependencyInjectionExtensions", "11.9.0"),
20
- ("AutoMapper", "16.1.1"),
21
- ("Microsoft.Extensions.DependencyInjection.Abstractions", "10.0.4"),
22
- ]
23
- },
24
- "Infrastructure": {
25
- "sdk": "Microsoft.NET.Sdk",
26
- "references": ["Application"],
27
- "packages": [],
28
- },
29
- "Persistence": {
30
- "sdk": "Microsoft.NET.Sdk",
31
- "references": ["Application"],
32
- "packages": [
33
- ("Microsoft.EntityFrameworkCore", "10.0.4"),
34
- ("Npgsql.EntityFrameworkCore.PostgreSQL", "10.0.2"),
35
- ("Microsoft.EntityFrameworkCore.Tools", "10.0.4"),
36
- ],
37
- },
38
- "API": {
39
- "sdk": "Microsoft.NET.Sdk.Web",
40
- "references": ["Application", "Infrastructure", "Persistence"],
41
- "packages": [
42
- ("Swashbuckle.AspNetCore", "6.5.0"),
43
- ("Microsoft.AspNetCore.Authentication.JwtBearer", "10.0.4"),
44
- ],
45
- },
46
- }
47
-
48
-
49
- def generate_csproj(layer: str, base: Path):
50
- config = LAYER_CONFIGS[layer]
51
- sdk = config["sdk"]
52
-
53
- project_refs = ""
54
- for ref in config["references"]:
55
- project_refs += f'\n <ProjectReference Include="..\\{ref}\\{ref}.csproj" />'
56
-
57
- package_refs = ""
58
- for name, version in config["packages"]:
59
- package_refs += f'\n <PackageReference Include="{name}" Version="{version}" />'
60
-
61
- item_group = ""
62
- if project_refs:
63
- item_group += f"""
64
- <ItemGroup>{project_refs}
65
- </ItemGroup>"""
66
- if package_refs:
67
- item_group += f"""
68
- <ItemGroup>{package_refs}
69
- </ItemGroup>"""
70
-
71
- content = f"""<Project Sdk="{sdk}">
72
-
73
- <PropertyGroup>
74
- <TargetFramework>net10.0</TargetFramework>
75
- <Nullable>enable</Nullable>
76
- <ImplicitUsings>enable</ImplicitUsings>
77
- </PropertyGroup>
78
- {item_group}
79
- </Project>"""
80
-
81
- csproj_path = base / layer / f"{layer}.csproj"
82
- csproj_path.write_text(content.strip())
1
+ from pathlib import Path
2
+ from stackforge import ui
3
+
4
+
5
+ LAYER_CONFIGS = {
6
+ "Domain": {
7
+ "sdk": "Microsoft.NET.Sdk",
8
+ "references": [],
9
+ "packages": [
10
+ ("Microsoft.AspNetCore.Identity.EntityFrameworkCore", "10.0.4"),
11
+ ],
12
+ },
13
+ "Application": {
14
+ "sdk": "Microsoft.NET.Sdk",
15
+ "references": ["Domain"],
16
+ "packages": [
17
+ ("MediatR", "14.1.0"),
18
+ ("FluentValidation", "11.9.0"),
19
+ ("FluentValidation.DependencyInjectionExtensions", "11.9.0"),
20
+ ("AutoMapper", "16.1.1"),
21
+ ("Microsoft.Extensions.DependencyInjection.Abstractions", "10.0.4"),
22
+ ]
23
+ },
24
+ "Infrastructure": {
25
+ "sdk": "Microsoft.NET.Sdk",
26
+ "references": ["Application"],
27
+ "packages": [],
28
+ },
29
+ "Persistence": {
30
+ "sdk": "Microsoft.NET.Sdk",
31
+ "references": ["Application"],
32
+ "packages": [
33
+ ("Microsoft.EntityFrameworkCore", "10.0.4"),
34
+ ("Npgsql.EntityFrameworkCore.PostgreSQL", "10.0.2"),
35
+ ("Microsoft.EntityFrameworkCore.Tools", "10.0.4"),
36
+ ],
37
+ },
38
+ "API": {
39
+ "sdk": "Microsoft.NET.Sdk.Web",
40
+ "references": ["Application", "Infrastructure", "Persistence"],
41
+ "packages": [
42
+ ("Swashbuckle.AspNetCore", "6.5.0"),
43
+ ("Microsoft.AspNetCore.Authentication.JwtBearer", "10.0.4"),
44
+ ],
45
+ },
46
+ }
47
+
48
+
49
+ def generate_csproj(layer: str, base: Path):
50
+ config = LAYER_CONFIGS[layer]
51
+ sdk = config["sdk"]
52
+
53
+ project_refs = ""
54
+ for ref in config["references"]:
55
+ project_refs += f'\n <ProjectReference Include="..\\{ref}\\{ref}.csproj" />'
56
+
57
+ package_refs = ""
58
+ for name, version in config["packages"]:
59
+ package_refs += f'\n <PackageReference Include="{name}" Version="{version}" />'
60
+
61
+ item_group = ""
62
+ if project_refs:
63
+ item_group += f"""
64
+ <ItemGroup>{project_refs}
65
+ </ItemGroup>"""
66
+ if package_refs:
67
+ item_group += f"""
68
+ <ItemGroup>{package_refs}
69
+ </ItemGroup>"""
70
+
71
+ content = f"""<Project Sdk="{sdk}">
72
+
73
+ <PropertyGroup>
74
+ <TargetFramework>net10.0</TargetFramework>
75
+ <Nullable>enable</Nullable>
76
+ <ImplicitUsings>enable</ImplicitUsings>
77
+ </PropertyGroup>
78
+ {item_group}
79
+ </Project>"""
80
+
81
+ csproj_path = base / layer / f"{layer}.csproj"
82
+ csproj_path.write_text(content.strip())
83
83
  ui.file_created(f"{layer}/{layer}.csproj")
@@ -1,64 +1,64 @@
1
- from pathlib import Path
2
- from stackforge import ui
3
-
4
-
5
- def generate_dockerfile(base: Path):
6
- content = """FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
7
- WORKDIR /app
8
-
9
- COPY . .
10
-
11
- RUN dotnet publish API/API.csproj -c Release -o out
12
-
13
- ENTRYPOINT ["dotnet", "out/API.dll"]
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)
1
+ from pathlib import Path
2
+ from stackforge import ui
3
+
4
+
5
+ def generate_dockerfile(base: Path):
6
+ content = """FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
7
+ WORKDIR /app
8
+
9
+ COPY . .
10
+
11
+ RUN dotnet publish API/API.csproj -c Release -o out
12
+
13
+ ENTRYPOINT ["dotnet", "out/API.dll"]
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
64
  ui.file_created("docker-compose.yml")