@atlashub/smartstack-cli 1.6.1 → 1.8.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 CHANGED
@@ -42029,9 +42029,7 @@ function checkPrerequisites() {
42029
42029
  }
42030
42030
  };
42031
42031
  return {
42032
- dotnet: check("dotnet", ["--version"]),
42033
- node: check("node", ["--version"]),
42034
- npm: check("npm", ["--version"])
42032
+ dotnet: check("dotnet", ["--version"])
42035
42033
  };
42036
42034
  }
42037
42035
  async function checkMcpServers() {
@@ -42170,61 +42168,6 @@ async function createBackendStructure(config, dryRun) {
42170
42168
  }
42171
42169
  }
42172
42170
  }
42173
- async function createFrontendStructure(config, dryRun) {
42174
- const { name, nameLower } = config;
42175
- const webDir = (0, import_path4.join)(name, "web", `${nameLower}-web`);
42176
- logger.info("Creating React application...");
42177
- if (!dryRun) {
42178
- await import_fs_extra3.default.ensureDir(webDir);
42179
- }
42180
- execCommand(`npm create vite@latest . -- --template react-ts`, webDir, dryRun);
42181
- execCommand("npm install", webDir, dryRun);
42182
- logger.info("Installing @atlashub/smartstack-react...");
42183
- execCommand("npm install @atlashub/smartstack-react", webDir, dryRun);
42184
- execCommand("npm install axios react-router-dom i18next react-i18next", webDir, dryRun);
42185
- execCommand("npm install -D tailwindcss @tailwindcss/vite", webDir, dryRun);
42186
- if (!dryRun) {
42187
- const viteConfig = `import { defineConfig } from 'vite'
42188
- import react from '@vitejs/plugin-react'
42189
- import tailwindcss from '@tailwindcss/vite'
42190
-
42191
- export default defineConfig({
42192
- plugins: [react(), tailwindcss()],
42193
- server: {
42194
- port: 5173,
42195
- proxy: {
42196
- '/api': {
42197
- target: 'https://localhost:5001',
42198
- changeOrigin: true,
42199
- secure: false
42200
- }
42201
- }
42202
- }
42203
- })
42204
- `;
42205
- await import_fs_extra3.default.writeFile((0, import_path4.join)(webDir, "vite.config.ts"), viteConfig);
42206
- }
42207
- if (!dryRun) {
42208
- const mainTsx = `import { StrictMode } from 'react'
42209
- import { createRoot } from 'react-dom/client'
42210
- import { BrowserRouter } from 'react-router-dom'
42211
- import { SmartStackProvider } from '@atlashub/smartstack-react'
42212
- import '@atlashub/smartstack-react/styles'
42213
- import App from './App'
42214
-
42215
- createRoot(document.getElementById('root')!).render(
42216
- <StrictMode>
42217
- <BrowserRouter>
42218
- <SmartStackProvider apiUrl="https://localhost:5001/api">
42219
- <App />
42220
- </SmartStackProvider>
42221
- </BrowserRouter>
42222
- </StrictMode>
42223
- )
42224
- `;
42225
- await import_fs_extra3.default.writeFile((0, import_path4.join)(webDir, "src", "main.tsx"), mainTsx);
42226
- }
42227
- }
42228
42171
  async function createConfigFiles(config, dryRun) {
42229
42172
  const { name } = config;
42230
42173
  if (dryRun) {
@@ -42307,13 +42250,9 @@ A SmartStack application.
42307
42250
  ## Prerequisites
42308
42251
 
42309
42252
  - .NET 10.0 SDK
42310
- - Node.js 18+
42311
- - npm 9+
42312
42253
 
42313
42254
  ## Getting Started
42314
42255
 
42315
- ### Backend
42316
-
42317
42256
  \`\`\`bash
42318
42257
  # Restore packages
42319
42258
  dotnet restore
@@ -42328,14 +42267,6 @@ dotnet ef database update -p src/${name}.Infrastructure -s src/${name}.Api
42328
42267
  dotnet run --project src/${name}.Api
42329
42268
  \`\`\`
42330
42269
 
42331
- ### Frontend
42332
-
42333
- \`\`\`bash
42334
- cd web/${name.toLowerCase()}-web
42335
- npm install
42336
- npm run dev
42337
- \`\`\`
42338
-
42339
42270
  ## Project Structure
42340
42271
 
42341
42272
  \`\`\`
@@ -42345,8 +42276,6 @@ ${name}/
42345
42276
  \u2502 \u251C\u2500\u2500 ${name}.Application/ # Application services and DTOs
42346
42277
  \u2502 \u251C\u2500\u2500 ${name}.Infrastructure/ # EF Core, repositories, external services
42347
42278
  \u2502 \u2514\u2500\u2500 ${name}.Api/ # Web API controllers and configuration
42348
- \u251C\u2500\u2500 web/
42349
- \u2502 \u2514\u2500\u2500 ${name.toLowerCase()}-web/ # React frontend
42350
42279
  \u2514\u2500\u2500 tests/ # Unit and integration tests
42351
42280
  \`\`\`
42352
42281
 
@@ -42368,7 +42297,7 @@ async function initializeGit(config, dryRun) {
42368
42297
  execCommand("git add .", name, dryRun);
42369
42298
  execCommand('git commit -m "chore: initial SmartStack project setup"', name, dryRun);
42370
42299
  }
42371
- var initCommand = new Command("init").description("Initialize a new SmartStack project").argument("<name>", "Project name").option("--full-stack", "Create full stack project (default)").option("--backend", "Create backend only").option("--frontend", "Create frontend only").option("--db <type>", "Database type (sqlserver, postgresql, sqlite)", "sqlserver").option("--dry-run", "Show what would be created without actually creating").option("-y, --yes", "Skip prompts and use defaults").option("--skip-mcp-check", "Skip MCP servers verification").action(async (name, options) => {
42300
+ var initCommand = new Command("init").description("Initialize a new SmartStack project").argument("<name>", "Project name").option("--db <type>", "Database type (sqlserver, postgresql, sqlite)", "sqlserver").option("--dry-run", "Show what would be created without actually creating").option("-y, --yes", "Skip prompts and use defaults").option("--skip-mcp-check", "Skip MCP servers verification").action(async (name, options) => {
42372
42301
  logger.header("SmartStack Project Initialization");
42373
42302
  if (!options.skipMcpCheck) {
42374
42303
  logger.info("Checking MCP servers...");
@@ -42421,45 +42350,24 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
42421
42350
  }
42422
42351
  }
42423
42352
  const prereqs = checkPrerequisites();
42424
- const needsBackend = !options.frontend;
42425
- const needsFrontend = !options.backend;
42426
- if (needsBackend && !prereqs.dotnet) {
42353
+ if (!prereqs.dotnet) {
42427
42354
  logger.error(".NET SDK not found. Please install .NET 10.0 or later.");
42428
42355
  process.exit(1);
42429
42356
  }
42430
- if (needsFrontend && (!prereqs.node || !prereqs.npm)) {
42431
- logger.error("Node.js/npm not found. Please install Node.js 18 or later.");
42432
- process.exit(1);
42433
- }
42434
42357
  if (await import_fs_extra3.default.pathExists(name)) {
42435
42358
  logger.error(`Directory '${name}' already exists.`);
42436
42359
  process.exit(1);
42437
42360
  }
42438
- let projectType = "full-stack";
42439
- if (options.backend) projectType = "backend";
42440
- if (options.frontend) projectType = "frontend";
42441
42361
  let config;
42442
42362
  if (options.yes) {
42443
42363
  config = {
42444
42364
  name,
42445
42365
  nameLower: name.toLowerCase(),
42446
- type: projectType,
42447
42366
  database: options.db || "sqlserver",
42448
42367
  modules: ["Auth", "Navigation", "Notifications"]
42449
42368
  };
42450
42369
  } else {
42451
42370
  const answers = await lib_default.prompt([
42452
- {
42453
- type: "list",
42454
- name: "type",
42455
- message: "What type of project do you want to create?",
42456
- choices: [
42457
- { name: "Full Stack (Backend .NET + Frontend React)", value: "full-stack" },
42458
- { name: "Backend Only (.NET API)", value: "backend" },
42459
- { name: "Frontend Only (React)", value: "frontend" }
42460
- ],
42461
- default: projectType
42462
- },
42463
42371
  {
42464
42372
  type: "list",
42465
42373
  name: "database",
@@ -42469,8 +42377,7 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
42469
42377
  { name: "PostgreSQL", value: "postgresql" },
42470
42378
  { name: "SQLite", value: "sqlite" }
42471
42379
  ],
42472
- default: options.db || "sqlserver",
42473
- when: (ans) => ans.type !== "frontend"
42380
+ default: options.db || "sqlserver"
42474
42381
  },
42475
42382
  {
42476
42383
  type: "checkbox",
@@ -42481,14 +42388,12 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
42481
42388
  { name: "Navigation (Dynamic menus)", value: "Navigation", checked: true },
42482
42389
  { name: "AI (OpenAI/Claude integration)", value: "AI", checked: false },
42483
42390
  { name: "Notifications (SignalR real-time)", value: "Notifications", checked: true }
42484
- ],
42485
- when: (ans) => ans.type !== "frontend"
42391
+ ]
42486
42392
  }
42487
42393
  ]);
42488
42394
  config = {
42489
42395
  name,
42490
42396
  nameLower: name.toLowerCase(),
42491
- type: answers.type,
42492
42397
  database: answers.database || "sqlserver",
42493
42398
  modules: answers.modules || []
42494
42399
  };
@@ -42499,25 +42404,15 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
42499
42404
  }
42500
42405
  console.log();
42501
42406
  logger.info(`Project: ${source_default.cyan(config.name)}`);
42502
- logger.info(`Type: ${source_default.cyan(config.type)}`);
42503
- if (config.type !== "frontend") {
42504
- logger.info(`Database: ${source_default.cyan(config.database)}`);
42505
- logger.info(`Modules: ${source_default.cyan(config.modules.join(", ") || "None")}`);
42506
- }
42407
+ logger.info(`Database: ${source_default.cyan(config.database)}`);
42408
+ logger.info(`Modules: ${source_default.cyan(config.modules.join(", ") || "None")}`);
42507
42409
  console.log();
42508
42410
  try {
42509
42411
  if (!dryRun) {
42510
42412
  await import_fs_extra3.default.ensureDir(name);
42511
42413
  }
42512
- if (config.type === "full-stack" || config.type === "backend") {
42513
- await createBackendStructure(config, dryRun);
42514
- }
42515
- if (config.type === "full-stack" || config.type === "frontend") {
42516
- await createFrontendStructure(config, dryRun);
42517
- }
42518
- if (config.type !== "frontend") {
42519
- await createConfigFiles(config, dryRun);
42520
- }
42414
+ await createBackendStructure(config, dryRun);
42415
+ await createConfigFiles(config, dryRun);
42521
42416
  await initializeGit(config, dryRun);
42522
42417
  const summary = [
42523
42418
  source_default.green.bold("Project created successfully!"),
@@ -42525,27 +42420,16 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
42525
42420
  `Location: ${source_default.cyan((0, import_path4.join)(process.cwd(), name))}`,
42526
42421
  "",
42527
42422
  source_default.bold("Next steps:"),
42528
- ""
42529
- ];
42530
- if (config.type !== "frontend") {
42531
- summary.push(
42532
- ` 1. Configure connection string in ${source_default.cyan("appsettings.json")}`,
42533
- ` 2. Create migration: ${source_default.cyan(`dotnet ef migrations add InitialCreate -p src/${name}.Infrastructure -s src/${name}.Api`)}`,
42534
- ` 3. Apply migration: ${source_default.cyan(`dotnet ef database update -p src/${name}.Infrastructure -s src/${name}.Api`)}`,
42535
- ` 4. Run backend: ${source_default.cyan(`dotnet run --project src/${name}.Api`)}`
42536
- );
42537
- }
42538
- if (config.type !== "backend") {
42539
- summary.push(
42540
- ` 5. Run frontend: ${source_default.cyan(`cd web/${name.toLowerCase()}-web && npm run dev`)}`
42541
- );
42542
- }
42543
- summary.push(
42423
+ "",
42424
+ ` 1. Configure connection string in ${source_default.cyan("appsettings.json")}`,
42425
+ ` 2. Create migration: ${source_default.cyan(`dotnet ef migrations add InitialCreate -p src/${name}.Infrastructure -s src/${name}.Api`)}`,
42426
+ ` 3. Apply migration: ${source_default.cyan(`dotnet ef database update -p src/${name}.Infrastructure -s src/${name}.Api`)}`,
42427
+ ` 4. Run the API: ${source_default.cyan(`dotnet run --project src/${name}.Api`)}`,
42544
42428
  "",
42545
42429
  source_default.bold("Documentation:"),
42546
42430
  ` SmartStack: ${source_default.cyan("https://docs.smartstack.app")}`,
42547
42431
  ` API Reference: ${source_default.cyan("https://localhost:5001/scalar")} (when running)`
42548
- );
42432
+ ];
42549
42433
  logger.box(summary, "success");
42550
42434
  } catch (error) {
42551
42435
  logger.error(`Failed to create project: ${error instanceof Error ? error.message : error}`);