@ifecodes/backend-template 1.0.6 → 1.0.7

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.
Files changed (2) hide show
  1. package/bin/cli.js +20 -6
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import { execSync } from "child_process";
@@ -205,12 +205,26 @@ if (!isInMicroserviceProject) {
205
205
  // Install husky and setup at root level
206
206
  if (config.projectType === "microservice") {
207
207
  console.log("\n📦 Installing Husky at root level...\n");
208
- execSync("npm install", { cwd: target, stdio: "inherit" });
209
- console.log("\n🔧 Setting up Husky...\n");
210
- execSync("npm run prepare", { cwd: target, stdio: "inherit" });
208
+ try {
209
+ execSync("npm install", { cwd: target, stdio: "inherit" });
210
+ console.log("\n🔧 Setting up Husky...\n");
211
+ execSync("npm run prepare", { cwd: target, stdio: "inherit" });
212
+ } catch (error) {
213
+ console.log("\n⚠️ Husky setup skipped (dependencies not installed)\n");
214
+ }
211
215
  } else if (config.projectType === "monolith") {
212
- console.log("\n🔧 Setting up Husky...\n");
213
- execSync("npm run prepare", { cwd: target, stdio: "inherit" });
216
+ // Only setup Husky if node_modules exists (dependencies installed successfully)
217
+ const nodeModulesPath = path.join(target, "node_modules");
218
+ if (fs.existsSync(nodeModulesPath)) {
219
+ console.log("\n🔧 Setting up Husky...\n");
220
+ try {
221
+ execSync("npm run prepare", { cwd: target, stdio: "inherit" });
222
+ } catch (error) {
223
+ console.log("\n⚠️ Husky setup failed (run 'npm run prepare' manually after fixing dependencies)\n");
224
+ }
225
+ } else {
226
+ console.log("\n⚠️ Husky setup skipped (run 'npm install && npm run prepare' to set up git hooks)\n");
227
+ }
214
228
  }
215
229
  }
216
230
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ifecodes/backend-template",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Production-ready Express + TypeScript backend generator with optional features and microservice support",
5
5
  "bin": {
6
6
  "ifecodes-template": "bin/cli.js"