rbac-shield 0.1.2 → 0.1.3

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/init.js +12 -2
  2. package/package.json +1 -1
package/bin/init.js CHANGED
@@ -24,8 +24,18 @@ async function init() {
24
24
  console.log(chalk.green(`✓ Detected ${framework} project\n`));
25
25
  }
26
26
 
27
- // Check if rbac-shield is already installed
28
- const isInstalled = fileExists(path.join(process.cwd(), 'node_modules', 'rbac-shield'));
27
+ // Check if rbac-shield is already installed in package.json
28
+ let isInstalled = false;
29
+ try {
30
+ const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));
31
+ const allDeps = { ...packageJson.dependencies, ...packageJson.devDependencies };
32
+ if (allDeps['rbac-shield']) {
33
+ isInstalled = true;
34
+ }
35
+ } catch (e) {
36
+ // If no package.json or error, assume not installed
37
+ isInstalled = false;
38
+ }
29
39
 
30
40
  // Prompt for language
31
41
  const { language } = await prompts({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rbac-shield",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A production-ready, type-safe Role-Based Access Control (RBAC) system for Next.js applications with multi-tenant support",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",