@saas-maker/dev-config 1.0.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.
Files changed (2) hide show
  1. package/package.json +8 -0
  2. package/postinstall.js +20 -0
package/package.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@saas-maker/dev-config",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "bin": { "saas-maker-dev-init": "postinstall.js" },
6
+ "scripts": { "postinstall": "node postinstall.js" },
7
+ "dependencies": { "husky": "^9.1.7" }
8
+ }
package/postinstall.js ADDED
@@ -0,0 +1,20 @@
1
+ const { execSync } = require('child_process');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ const root = process.env.INIT_CWD || process.cwd();
6
+ if (root.includes('node_modules')) return;
7
+
8
+ try {
9
+ console.log('Setting up SaaS Maker Dev Config at:', root);
10
+ execSync('npx husky install', { cwd: root });
11
+
12
+ const huskyDir = path.join(root, '.husky');
13
+ if (!fs.existsSync(huskyDir)) fs.mkdirSync(huskyDir);
14
+
15
+ const prePush = '#!/bin/sh\nset -e\nnpm run lint || { echo "Lint failed, fix before pushing"; exit 1; }';
16
+ fs.writeFileSync(path.join(huskyDir, 'pre-push'), prePush, { mode: 0o755 });
17
+ console.log('✓ Husky hooks configured');
18
+ } catch (e) {
19
+ console.error('Failed to setup dev-config:', e.message);
20
+ }