@kipicore/dbcore 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/dist/index.d.ts +415 -415
- package/dist/index.js +418 -446
- package/package.json +3 -3
- package/dist/generate-index.d.ts +0 -1
- package/dist/generate-index.js +0 -47
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kipicore/dbcore",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
+
"prebuild": "node scripts/generate-index.js",
|
|
8
9
|
"build": "tsc -p tsconfig.json",
|
|
9
|
-
"clean": "rm -rf dist"
|
|
10
|
-
"prepare": "npm run build"
|
|
10
|
+
"clean": "rm -rf dist"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"postgres",
|
package/dist/generate-index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateIndex(dirPaths: string[]): Promise<void>;
|
package/dist/generate-index.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateIndex = generateIndex;
|
|
7
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
async function generateIndex(dirPaths) {
|
|
10
|
-
try {
|
|
11
|
-
const indexFilePath = path_1.default.join(process.cwd(), "index.ts");
|
|
12
|
-
await promises_1.default.writeFile(indexFilePath, "");
|
|
13
|
-
let allExportLines = [];
|
|
14
|
-
for (const dirPath of dirPaths) {
|
|
15
|
-
const resolvedDir = path_1.default.join(process.cwd(), dirPath);
|
|
16
|
-
const files = await promises_1.default.readdir(resolvedDir);
|
|
17
|
-
const tsFiles = files.filter((file) => file.endsWith(".ts") && file !== "index.ts" && !file.endsWith(".d.ts"));
|
|
18
|
-
const exportLines = tsFiles.map((file) => {
|
|
19
|
-
const fileName = file.replace(".ts", "");
|
|
20
|
-
return `export * as ${fileName} from './${dirPath}/${fileName}';`;
|
|
21
|
-
});
|
|
22
|
-
allExportLines.push(...exportLines);
|
|
23
|
-
console.log(`✅ Found ${tsFiles.length} exports in "${resolvedDir}".`);
|
|
24
|
-
}
|
|
25
|
-
const finalContent = allExportLines.join("\n") + "\n";
|
|
26
|
-
await promises_1.default.writeFile(indexFilePath, finalContent);
|
|
27
|
-
console.log(`🚀 index.ts generated with ${allExportLines.length} exports.`);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
console.error("❌ Error generating index.ts:", error);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// Example usage: Pass directories here
|
|
34
|
-
const dirsToProcess = [
|
|
35
|
-
"interfaces",
|
|
36
|
-
"helpers",
|
|
37
|
-
"services/Concrete",
|
|
38
|
-
"services/Contracts",
|
|
39
|
-
"types",
|
|
40
|
-
"configs",
|
|
41
|
-
"constants",
|
|
42
|
-
"models/mongodb",
|
|
43
|
-
"models/psql",
|
|
44
|
-
];
|
|
45
|
-
(async () => {
|
|
46
|
-
await generateIndex(dirsToProcess);
|
|
47
|
-
})();
|