@atlashub/smartstack-cli 1.30.0 → 1.31.0
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.
- package/dist/index.js +4 -86
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/project/api.ts.template +31 -0
- package/templates/skills/review-code/references/clean-code-principles.md +152 -0
- package/templates/skills/review-code/references/smartstack-conventions.md +25 -1
- package/templates/skills/ui-components/SKILL.md +174 -0
package/dist/index.js
CHANGED
|
@@ -115917,60 +115917,9 @@ EndGlobal
|
|
|
115917
115917
|
}
|
|
115918
115918
|
if (!dryRun) {
|
|
115919
115919
|
const apiDir2 = (0, import_path4.join)(srcDir, `${projectName}.Api`);
|
|
115920
|
-
|
|
115921
|
-
try {
|
|
115922
|
-
programCs = await loadTemplate("Program.cs.template", projectName);
|
|
115923
|
-
} catch {
|
|
115924
|
-
programCs = `using Microsoft.EntityFrameworkCore;
|
|
115925
|
-
using SmartStack.Api.Extensions;
|
|
115926
|
-
using SmartStack.Infrastructure.Persistence;
|
|
115927
|
-
using ${projectName}.Infrastructure;
|
|
115928
|
-
using ${projectName}.Infrastructure.Persistence;
|
|
115929
|
-
using ${projectName}.Application;
|
|
115930
|
-
|
|
115931
|
-
var builder = WebApplication.CreateBuilder(args);
|
|
115932
|
-
|
|
115933
|
-
// ===================================================================
|
|
115934
|
-
// 1. Add SmartStack Core services (from NuGet package)
|
|
115935
|
-
// ===================================================================
|
|
115936
|
-
builder.Services.AddSmartStack(builder.Configuration, options =>
|
|
115937
|
-
{
|
|
115938
|
-
options.EnableDevSeeding = builder.Environment.IsDevelopment();
|
|
115939
|
-
options.EnableSwagger = builder.Environment.IsDevelopment();
|
|
115940
|
-
});
|
|
115941
|
-
|
|
115942
|
-
// ===================================================================
|
|
115943
|
-
// 2. Add client-specific services (Dual-DbContext pattern)
|
|
115944
|
-
// ===================================================================
|
|
115945
|
-
builder.Services.Add${projectName}Infrastructure(builder.Configuration);
|
|
115946
|
-
builder.Services.Add${projectName}Application();
|
|
115947
|
-
|
|
115948
|
-
var app = builder.Build();
|
|
115949
|
-
|
|
115950
|
-
// ===================================================================
|
|
115951
|
-
// 3. Initialize SmartStack + apply migrations (in correct order!)
|
|
115952
|
-
// ===================================================================
|
|
115953
|
-
await app.InitializeSmartStackAsync();
|
|
115954
|
-
|
|
115955
|
-
// Apply Extensions migrations AFTER Core migrations
|
|
115956
|
-
if (app.Environment.IsDevelopment())
|
|
115957
|
-
{
|
|
115958
|
-
using var scope = app.Services.CreateScope();
|
|
115959
|
-
var extDb = scope.ServiceProvider.GetRequiredService<ExtensionsDbContext>();
|
|
115960
|
-
await extDb.Database.MigrateAsync();
|
|
115961
|
-
}
|
|
115962
|
-
|
|
115963
|
-
// ===================================================================
|
|
115964
|
-
// 4. SmartStack middleware & endpoints
|
|
115965
|
-
// ===================================================================
|
|
115966
|
-
app.UseSmartStack();
|
|
115967
|
-
app.MapSmartStack();
|
|
115968
|
-
|
|
115969
|
-
app.Run();
|
|
115970
|
-
`;
|
|
115971
|
-
}
|
|
115920
|
+
const programCs = await loadTemplate("Program.cs.template", projectName);
|
|
115972
115921
|
await import_fs_extra3.default.writeFile((0, import_path4.join)(apiDir2, "Program.cs"), programCs);
|
|
115973
|
-
logger.info("
|
|
115922
|
+
logger.info("Configured Program.cs with Dual-DbContext pattern");
|
|
115974
115923
|
}
|
|
115975
115924
|
logger.info("Creating Dual-DbContext structure...");
|
|
115976
115925
|
await createDualDbContextStructure(projectDir, projectName, dryRun);
|
|
@@ -116655,38 +116604,7 @@ i18n
|
|
|
116655
116604
|
export default i18n;
|
|
116656
116605
|
`;
|
|
116657
116606
|
await import_fs_extra3.default.writeFile((0, import_path4.join)(webDir, "src", "i18n", "index.ts"), i18nConfig);
|
|
116658
|
-
const apiService =
|
|
116659
|
-
|
|
116660
|
-
const api = axios.create({
|
|
116661
|
-
baseURL: '/api',
|
|
116662
|
-
headers: {
|
|
116663
|
-
'Content-Type': 'application/json',
|
|
116664
|
-
},
|
|
116665
|
-
});
|
|
116666
|
-
|
|
116667
|
-
// Request interceptor for auth token
|
|
116668
|
-
api.interceptors.request.use((config) => {
|
|
116669
|
-
const token = localStorage.getItem('token');
|
|
116670
|
-
if (token) {
|
|
116671
|
-
config.headers.Authorization = \`Bearer \${token}\`;
|
|
116672
|
-
}
|
|
116673
|
-
return config;
|
|
116674
|
-
});
|
|
116675
|
-
|
|
116676
|
-
// Response interceptor for error handling
|
|
116677
|
-
api.interceptors.response.use(
|
|
116678
|
-
(response) => response,
|
|
116679
|
-
(error) => {
|
|
116680
|
-
if (error.response?.status === 401) {
|
|
116681
|
-
localStorage.removeItem('token');
|
|
116682
|
-
window.location.href = '/login';
|
|
116683
|
-
}
|
|
116684
|
-
return Promise.reject(error);
|
|
116685
|
-
}
|
|
116686
|
-
);
|
|
116687
|
-
|
|
116688
|
-
export default api;
|
|
116689
|
-
`;
|
|
116607
|
+
const apiService = await loadTemplate("api.ts.template", projectName);
|
|
116690
116608
|
await import_fs_extra3.default.writeFile((0, import_path4.join)(webDir, "src", "services", "api.ts"), apiService);
|
|
116691
116609
|
const viteEnvDts = `/// <reference types="vite/client" />
|
|
116692
116610
|
`;
|
|
@@ -116935,8 +116853,8 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
|
|
|
116935
116853
|
if (!dryRun && !inPlace) {
|
|
116936
116854
|
await import_fs_extra3.default.ensureDir(projectDir);
|
|
116937
116855
|
}
|
|
116938
|
-
await createBackendStructure(config, dryRun);
|
|
116939
116856
|
await createConfigFiles(config, dryRun);
|
|
116857
|
+
await createBackendStructure(config, dryRun);
|
|
116940
116858
|
await createFrontendStructure(config, dryRun);
|
|
116941
116859
|
await initializeGit(config, dryRun);
|
|
116942
116860
|
logger.info("Initializing Ralph configuration...");
|