recurrente-js 1.0.5 → 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.
package/package.json CHANGED
@@ -1,15 +1,22 @@
1
1
  {
2
2
  "name": "recurrente-js",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "main": "./dist/index.js",
5
- "types": "./dist/globals.d.ts",
5
+ "types": "./dist/index.d.ts",
6
6
  "exports": {
7
- ".": "./dist/index.js",
8
- "./webhooks": "./dist/webhooks.js"
7
+ ".": {
8
+ "import": "./dist/index.js",
9
+ "require": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ },
12
+ "./webhooks": {
13
+ "import": "./dist/webhooks.js",
14
+ "require": "./dist/webhooks.js",
15
+ "types": "./dist/webhooks.d.ts"
16
+ }
9
17
  },
10
18
  "files": [
11
- "dist/**/*",
12
- "src/**/*.d.ts"
19
+ "dist/**/*"
13
20
  ],
14
21
  "scripts": {
15
22
  "test": "jest",
@@ -17,11 +24,9 @@
17
24
  "clean": "gts clean",
18
25
  "compile": "tsc",
19
26
  "fix": "gts fix",
20
- "prepare": "npm.cmd run compile",
21
- "pretest": "npm.cmd run compile",
22
- "posttest": "npm.cmd run lint",
23
- "dev": "nodemon -w *.ts -e ts -x ts-node --files -H -T ./src/index.ts",
24
- "context": "ts-node scripts/generate-context.cts"
27
+ "prepare": "npm run compile",
28
+ "pretest": "npm run compile",
29
+ "posttest": "npm run lint"
25
30
  },
26
31
  "author": "Axel Aguilar",
27
32
  "license": "MIT",
@@ -42,3 +47,5 @@
42
47
  "svix": "^1.34.0"
43
48
  }
44
49
  }
50
+
51
+
@@ -1,152 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const node_fs_1 = __importDefault(require("node:fs"));
16
- const node_path_1 = __importDefault(require("node:path"));
17
- // --- Configuration ---
18
- const OUTPUT_DIR = "ai-context";
19
- const ALLOWED_EXTENSIONS = [
20
- ".ts",
21
- ".tsx",
22
- ".js",
23
- ".jsx",
24
- ".json",
25
- ".md",
26
- ".css",
27
- ".prisma",
28
- ".env.example",
29
- ".sql",
30
- ".gitignore",
31
- ];
32
- // CORRECTED: This list is now for both files and directories.
33
- const IGNORED_ITEMS = [
34
- "node_modules",
35
- ".next",
36
- ".vercel",
37
- "dist",
38
- "build",
39
- ".git",
40
- ".cache",
41
- "scripts",
42
- "react-email-starter",
43
- "package-lock.json", // This will now be correctly ignored
44
- ];
45
- // --------------------
46
- /**
47
- * Recursively finds all files in a directory that match the allowed extensions.
48
- */
49
- function getAllFiles(dirPath, arrayOfFiles = []) {
50
- const items = node_fs_1.default.readdirSync(dirPath, { withFileTypes: true });
51
- for (const item of items) {
52
- // *** FIX: Check EVERY item (file or directory) against the ignore list first ***
53
- if (IGNORED_ITEMS.includes(item.name)) {
54
- continue; // Skip this item entirely
55
- }
56
- const fullPath = node_path_1.default.join(dirPath, item.name);
57
- if (item.isDirectory()) {
58
- // The ignore check is already done, so we just recurse.
59
- getAllFiles(fullPath, arrayOfFiles);
60
- }
61
- else {
62
- // It's a file. The ignore check was already done.
63
- // Now, we just check its extension.
64
- if (ALLOWED_EXTENSIONS.includes(node_path_1.default.extname(item.name))) {
65
- arrayOfFiles.push(fullPath);
66
- }
67
- }
68
- }
69
- return arrayOfFiles;
70
- }
71
- /**
72
- * Generates a timestamp string in the format YYYYMMDD_HHMMSS.
73
- */
74
- function getFormattedTimestamp() {
75
- const now = new Date();
76
- const YYYY = now.getFullYear();
77
- const MM = String(now.getMonth() + 1).padStart(2, "0");
78
- const DD = String(now.getDate()).padStart(2, "0");
79
- const HH = String(now.getHours()).padStart(2, "0");
80
- const mm = String(now.getMinutes()).padStart(2, "0");
81
- const ss = String(now.getSeconds()).padStart(2, "0");
82
- return `${YYYY}${MM}${DD}_${HH}${mm}${ss}`;
83
- }
84
- /**
85
- * Main script logic.
86
- */
87
- function main() {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- const targetPath = process.argv[2];
90
- if (!targetPath) {
91
- console.error("❌ Error: Please provide a file or directory path as an argument.");
92
- console.log(" Example: npm run context -- .");
93
- process.exit(1);
94
- }
95
- const fullPath = node_path_1.default.resolve(targetPath);
96
- if (!node_fs_1.default.existsSync(fullPath)) {
97
- console.error(`❌ Error: Path not found: ${fullPath}`);
98
- process.exit(1);
99
- }
100
- let filesToProcess = [];
101
- const stats = node_fs_1.default.statSync(fullPath);
102
- if (stats.isDirectory()) {
103
- console.log(`🔎 Scanning directory: ${targetPath}`);
104
- filesToProcess = getAllFiles(fullPath);
105
- }
106
- else if (stats.isFile()) {
107
- // *** FIX: Also check if a single targeted file is on the ignore list ***
108
- if (IGNORED_ITEMS.includes(node_path_1.default.basename(fullPath))) {
109
- console.log(`🟡 File '${targetPath}' is in the ignore list. Exiting.`);
110
- return;
111
- }
112
- console.log(`🎯 Targeting single file: ${targetPath}`);
113
- if (ALLOWED_EXTENSIONS.includes(node_path_1.default.extname(fullPath))) {
114
- filesToProcess = [fullPath];
115
- }
116
- }
117
- if (filesToProcess.length === 0) {
118
- console.log("🟡 No relevant files found to process. Exiting.");
119
- return;
120
- }
121
- console.log(`📚 Found ${filesToProcess.length} file(s) to process.`);
122
- const outputData = {
123
- metadata: {
124
- sourcePath: targetPath,
125
- timestamp: new Date().toISOString(),
126
- fileCount: filesToProcess.length,
127
- },
128
- files: {},
129
- };
130
- for (const file of filesToProcess) {
131
- const relativePath = node_path_1.default.relative(process.cwd(), file);
132
- try {
133
- const content = node_fs_1.default.readFileSync(file, "utf-8");
134
- outputData.files[relativePath] = content;
135
- }
136
- catch (error) {
137
- console.warn(`⚠️ Could not read file: ${relativePath}`, error);
138
- }
139
- }
140
- // Ensure the output directory exists
141
- if (!node_fs_1.default.existsSync(OUTPUT_DIR)) {
142
- node_fs_1.default.mkdirSync(OUTPUT_DIR);
143
- }
144
- const baseName = node_path_1.default.basename(targetPath).replace(/[.\\/]/g, "_");
145
- const timestamp = getFormattedTimestamp();
146
- const outputFilename = `context-${baseName}-${timestamp}.json`;
147
- const outputFilePath = node_path_1.default.join(OUTPUT_DIR, outputFilename);
148
- node_fs_1.default.writeFileSync(outputFilePath, JSON.stringify(outputData, null, 2));
149
- console.log(`\n✅ Success! Context saved to: ${outputFilePath}`);
150
- });
151
- }
152
- main().catch(console.error);
@@ -1 +0,0 @@
1
- export {};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes