exguard-backend 1.0.5 → 1.0.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exguard-backend",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"README.md"
|
|
24
24
|
],
|
|
25
25
|
"bin": {
|
|
26
|
-
"exguard-backend": "scripts/setup-nestjs.
|
|
26
|
+
"exguard-backend": "scripts/setup-nestjs.cjs"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"exguard",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"test:watch": "node --test --watch",
|
|
52
52
|
"clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
|
|
53
53
|
"prebuild": "npm run clean",
|
|
54
|
-
"setup-nestjs": "node scripts/setup-nestjs.
|
|
55
|
-
"create-example": "node scripts/create-example.
|
|
54
|
+
"setup-nestjs": "node scripts/setup-nestjs.cjs",
|
|
55
|
+
"create-example": "node scripts/create-example.cjs"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -413,19 +413,19 @@ function updateAppModule() {
|
|
|
413
413
|
const importMatch = appModuleContent.match(/import\s*\{[^}]*\}\s*from\s*['"][^'"]*['"];?\s*/m);
|
|
414
414
|
if (importMatch) {
|
|
415
415
|
const lastImport = importMatch[0];
|
|
416
|
-
const newImport = lastImport.replace(/;?\s*$/, '') + '
|
|
416
|
+
const newImport = lastImport.replace(/;?\s*$/, '') + ',\n ExGuardModule from \'./exguard/exguard.module\';\n';
|
|
417
417
|
appModuleContent = appModuleContent.replace(lastImport, newImport);
|
|
418
418
|
} else {
|
|
419
419
|
// Add import at the top
|
|
420
|
-
appModuleContent = `import { ExGuardModule } from './exguard/exguard.module'
|
|
420
|
+
appModuleContent = `import { ExGuardModule } from './exguard/exguard.module';\n\n${appModuleContent}`;
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
// Add to imports array
|
|
424
424
|
const importsMatch = appModuleContent.match(/@Module\s*\(\s*\{\s*imports:\s*\[([^\]]*)\]/m);
|
|
425
425
|
if (importsMatch) {
|
|
426
426
|
const importsContent = importsMatch[1];
|
|
427
|
-
const newImportsContent = importsContent.trim() + '
|
|
428
|
-
appModuleContent = appModuleContent.replace(importsMatch[0], `@Module({
|
|
427
|
+
const newImportsContent = importsContent.trim() + ',\n ExGuardModule';
|
|
428
|
+
appModuleContent = appModuleContent.replace(importsMatch[0], `@Module({\n imports: [${newImportsContent}]`);
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
fs.writeFileSync(appModulePath, appModuleContent);
|
|
@@ -453,7 +453,7 @@ EXGUARD_SERVICE_TOKEN=your-service-jwt-token
|
|
|
453
453
|
// Append if not already present
|
|
454
454
|
const existingEnv = fs.readFileSync(envPath, 'utf8');
|
|
455
455
|
if (!existingEnv.includes('EXGUARD_API_URL')) {
|
|
456
|
-
fs.appendFileSync(envPath, '
|
|
456
|
+
fs.appendFileSync(envPath, '\n\n# ExGuard Configuration\n' + envContent);
|
|
457
457
|
logSuccess('Appended ExGuard configuration to .env');
|
|
458
458
|
} else {
|
|
459
459
|
logWarning('ExGuard configuration already exists in .env');
|
|
@@ -496,7 +496,7 @@ function updatePackageScripts() {
|
|
|
496
496
|
// Main setup function
|
|
497
497
|
async function setupExGuard() {
|
|
498
498
|
log('🚀 ExGuard NestJS Automatic Setup', 'bright');
|
|
499
|
-
log('This script will automatically set up ExGuard in your NestJS project
|
|
499
|
+
log('This script will automatically set up ExGuard in your NestJS project.\n');
|
|
500
500
|
|
|
501
501
|
try {
|
|
502
502
|
checkNestJSProject();
|
|
@@ -509,15 +509,15 @@ async function setupExGuard() {
|
|
|
509
509
|
createEnvironmentFile();
|
|
510
510
|
updatePackageScripts();
|
|
511
511
|
|
|
512
|
-
log('
|
|
513
|
-
log('
|
|
512
|
+
log('\n🎉 ExGuard setup completed successfully!', 'green');
|
|
513
|
+
log('\n📋 Next steps:', 'cyan');
|
|
514
514
|
log('1. Review the generated files in src/exguard/', 'blue');
|
|
515
515
|
log('2. Check the example controller in src/events/', 'blue');
|
|
516
516
|
log('3. Update your .env file with your ExGuard API URL', 'blue');
|
|
517
517
|
log('4. Start your application: npm run start:dev', 'blue');
|
|
518
518
|
log('5. Test the protected endpoints', 'blue');
|
|
519
519
|
|
|
520
|
-
log('
|
|
520
|
+
log('\n📚 Documentation:', 'cyan');
|
|
521
521
|
log('- Main README: node_modules/exguard-backend/README.md', 'blue');
|
|
522
522
|
log('- NestJS Guide: node_modules/exguard-backend/examples/NESTJS-SETUP.md', 'blue');
|
|
523
523
|
|
|
File without changes
|