@atlashub/smartstack-cli 1.29.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 +18 -87
- 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
|
@@ -115853,6 +115853,17 @@ EndGlobal
|
|
|
115853
115853
|
}
|
|
115854
115854
|
}
|
|
115855
115855
|
}
|
|
115856
|
+
if (!dryRun) {
|
|
115857
|
+
for (const { proj } of projects) {
|
|
115858
|
+
const csprojPath = (0, import_path4.join)(srcDir, proj, `${proj}.csproj`);
|
|
115859
|
+
if (await import_fs_extra3.default.pathExists(csprojPath)) {
|
|
115860
|
+
let content = await import_fs_extra3.default.readFile(csprojPath, "utf-8");
|
|
115861
|
+
content = content.replace(/\s*<TargetFramework>.*<\/TargetFramework>\s*/g, "\n ");
|
|
115862
|
+
await import_fs_extra3.default.writeFile(csprojPath, content);
|
|
115863
|
+
}
|
|
115864
|
+
}
|
|
115865
|
+
logger.info("Configured projects to inherit TargetFramework from Directory.Build.props");
|
|
115866
|
+
}
|
|
115856
115867
|
const refs = [
|
|
115857
115868
|
{ from: `${projectName}.Application`, to: `${projectName}.Domain` },
|
|
115858
115869
|
{ from: `${projectName}.Infrastructure`, to: `${projectName}.Domain` },
|
|
@@ -115906,60 +115917,9 @@ EndGlobal
|
|
|
115906
115917
|
}
|
|
115907
115918
|
if (!dryRun) {
|
|
115908
115919
|
const apiDir2 = (0, import_path4.join)(srcDir, `${projectName}.Api`);
|
|
115909
|
-
|
|
115910
|
-
try {
|
|
115911
|
-
programCs = await loadTemplate("Program.cs.template", projectName);
|
|
115912
|
-
} catch {
|
|
115913
|
-
programCs = `using Microsoft.EntityFrameworkCore;
|
|
115914
|
-
using SmartStack.Api.Extensions;
|
|
115915
|
-
using SmartStack.Infrastructure.Persistence;
|
|
115916
|
-
using ${projectName}.Infrastructure;
|
|
115917
|
-
using ${projectName}.Infrastructure.Persistence;
|
|
115918
|
-
using ${projectName}.Application;
|
|
115919
|
-
|
|
115920
|
-
var builder = WebApplication.CreateBuilder(args);
|
|
115921
|
-
|
|
115922
|
-
// ===================================================================
|
|
115923
|
-
// 1. Add SmartStack Core services (from NuGet package)
|
|
115924
|
-
// ===================================================================
|
|
115925
|
-
builder.Services.AddSmartStack(builder.Configuration, options =>
|
|
115926
|
-
{
|
|
115927
|
-
options.EnableDevSeeding = builder.Environment.IsDevelopment();
|
|
115928
|
-
options.EnableSwagger = builder.Environment.IsDevelopment();
|
|
115929
|
-
});
|
|
115930
|
-
|
|
115931
|
-
// ===================================================================
|
|
115932
|
-
// 2. Add client-specific services (Dual-DbContext pattern)
|
|
115933
|
-
// ===================================================================
|
|
115934
|
-
builder.Services.Add${projectName}Infrastructure(builder.Configuration);
|
|
115935
|
-
builder.Services.Add${projectName}Application();
|
|
115936
|
-
|
|
115937
|
-
var app = builder.Build();
|
|
115938
|
-
|
|
115939
|
-
// ===================================================================
|
|
115940
|
-
// 3. Initialize SmartStack + apply migrations (in correct order!)
|
|
115941
|
-
// ===================================================================
|
|
115942
|
-
await app.InitializeSmartStackAsync();
|
|
115943
|
-
|
|
115944
|
-
// Apply Extensions migrations AFTER Core migrations
|
|
115945
|
-
if (app.Environment.IsDevelopment())
|
|
115946
|
-
{
|
|
115947
|
-
using var scope = app.Services.CreateScope();
|
|
115948
|
-
var extDb = scope.ServiceProvider.GetRequiredService<ExtensionsDbContext>();
|
|
115949
|
-
await extDb.Database.MigrateAsync();
|
|
115950
|
-
}
|
|
115951
|
-
|
|
115952
|
-
// ===================================================================
|
|
115953
|
-
// 4. SmartStack middleware & endpoints
|
|
115954
|
-
// ===================================================================
|
|
115955
|
-
app.UseSmartStack();
|
|
115956
|
-
app.MapSmartStack();
|
|
115957
|
-
|
|
115958
|
-
app.Run();
|
|
115959
|
-
`;
|
|
115960
|
-
}
|
|
115920
|
+
const programCs = await loadTemplate("Program.cs.template", projectName);
|
|
115961
115921
|
await import_fs_extra3.default.writeFile((0, import_path4.join)(apiDir2, "Program.cs"), programCs);
|
|
115962
|
-
logger.info("
|
|
115922
|
+
logger.info("Configured Program.cs with Dual-DbContext pattern");
|
|
115963
115923
|
}
|
|
115964
115924
|
logger.info("Creating Dual-DbContext structure...");
|
|
115965
115925
|
await createDualDbContextStructure(projectDir, projectName, dryRun);
|
|
@@ -115972,9 +115932,10 @@ async function createConfigFiles(config, dryRun) {
|
|
|
115972
115932
|
logger.info("[DRY RUN] Would create configuration files");
|
|
115973
115933
|
return;
|
|
115974
115934
|
}
|
|
115935
|
+
const targetFramework = config.preview ? "net10.0" : "net9.0";
|
|
115975
115936
|
const buildProps = `<Project>
|
|
115976
115937
|
<PropertyGroup>
|
|
115977
|
-
<TargetFramework
|
|
115938
|
+
<TargetFramework>${targetFramework}</TargetFramework>
|
|
115978
115939
|
<Nullable>enable</Nullable>
|
|
115979
115940
|
<ImplicitUsings>enable</ImplicitUsings>
|
|
115980
115941
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
|
@@ -115982,6 +115943,7 @@ async function createConfigFiles(config, dryRun) {
|
|
|
115982
115943
|
</Project>
|
|
115983
115944
|
`;
|
|
115984
115945
|
await import_fs_extra3.default.writeFile((0, import_path4.join)(projectDir, "Directory.Build.props"), buildProps);
|
|
115946
|
+
logger.info(`Target framework: ${source_default.cyan(targetFramework)}${config.preview ? " (preview)" : ""}`);
|
|
115985
115947
|
const connectionString = `Server=(local);Database=${projectName};Integrated Security=true;TrustServerCertificate=true;Connection Timeout=60;Pooling=true;Min Pool Size=0;Max Pool Size=50;Load Balance Timeout=30`;
|
|
115986
115948
|
const appSettings = {
|
|
115987
115949
|
ConnectionStrings: {
|
|
@@ -116642,38 +116604,7 @@ i18n
|
|
|
116642
116604
|
export default i18n;
|
|
116643
116605
|
`;
|
|
116644
116606
|
await import_fs_extra3.default.writeFile((0, import_path4.join)(webDir, "src", "i18n", "index.ts"), i18nConfig);
|
|
116645
|
-
const apiService =
|
|
116646
|
-
|
|
116647
|
-
const api = axios.create({
|
|
116648
|
-
baseURL: '/api',
|
|
116649
|
-
headers: {
|
|
116650
|
-
'Content-Type': 'application/json',
|
|
116651
|
-
},
|
|
116652
|
-
});
|
|
116653
|
-
|
|
116654
|
-
// Request interceptor for auth token
|
|
116655
|
-
api.interceptors.request.use((config) => {
|
|
116656
|
-
const token = localStorage.getItem('token');
|
|
116657
|
-
if (token) {
|
|
116658
|
-
config.headers.Authorization = \`Bearer \${token}\`;
|
|
116659
|
-
}
|
|
116660
|
-
return config;
|
|
116661
|
-
});
|
|
116662
|
-
|
|
116663
|
-
// Response interceptor for error handling
|
|
116664
|
-
api.interceptors.response.use(
|
|
116665
|
-
(response) => response,
|
|
116666
|
-
(error) => {
|
|
116667
|
-
if (error.response?.status === 401) {
|
|
116668
|
-
localStorage.removeItem('token');
|
|
116669
|
-
window.location.href = '/login';
|
|
116670
|
-
}
|
|
116671
|
-
return Promise.reject(error);
|
|
116672
|
-
}
|
|
116673
|
-
);
|
|
116674
|
-
|
|
116675
|
-
export default api;
|
|
116676
|
-
`;
|
|
116607
|
+
const apiService = await loadTemplate("api.ts.template", projectName);
|
|
116677
116608
|
await import_fs_extra3.default.writeFile((0, import_path4.join)(webDir, "src", "services", "api.ts"), apiService);
|
|
116678
116609
|
const viteEnvDts = `/// <reference types="vite/client" />
|
|
116679
116610
|
`;
|
|
@@ -116922,8 +116853,8 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
|
|
|
116922
116853
|
if (!dryRun && !inPlace) {
|
|
116923
116854
|
await import_fs_extra3.default.ensureDir(projectDir);
|
|
116924
116855
|
}
|
|
116925
|
-
await createBackendStructure(config, dryRun);
|
|
116926
116856
|
await createConfigFiles(config, dryRun);
|
|
116857
|
+
await createBackendStructure(config, dryRun);
|
|
116927
116858
|
await createFrontendStructure(config, dryRun);
|
|
116928
116859
|
await initializeGit(config, dryRun);
|
|
116929
116860
|
logger.info("Initializing Ralph configuration...");
|