@mostfeatured/dbi 0.0.8 → 0.0.9
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.
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Usage: `await recursiveImport("./src", [".js", ".ts"])`
|
|
3
|
+
*/
|
|
4
|
+
export declare function recursiveImport(folderPath: string, exts?: string[]): Promise<any>;
|
|
2
5
|
//# sourceMappingURL=recursiveImport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recursiveImport.d.ts","sourceRoot":"","sources":["../../src/utils/recursiveImport.ts"],"names":[],"mappings":"AAGA,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"recursiveImport.d.ts","sourceRoot":"","sources":["../../src/utils/recursiveImport.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,CAWvG"}
|
|
@@ -4,14 +4,17 @@ exports.recursiveImport = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Usage: `await recursiveImport("./src", [".js", ".ts"])`
|
|
9
|
+
*/
|
|
10
|
+
async function recursiveImport(folderPath, exts = [".js", ".ts"]) {
|
|
8
11
|
let files = await fs_1.default.promises.readdir(folderPath, { withFileTypes: true });
|
|
9
12
|
for (const file of files) {
|
|
10
13
|
let filePath = path_1.default.resolve(folderPath, file.name);
|
|
11
14
|
if (file.isDirectory()) {
|
|
12
|
-
await recursiveImport(filePath);
|
|
15
|
+
await recursiveImport(filePath, exts);
|
|
13
16
|
}
|
|
14
|
-
else if (filePath.endsWith(
|
|
17
|
+
else if (exts.some(i => filePath.endsWith(i))) {
|
|
15
18
|
await Promise.resolve().then(() => tslib_1.__importStar(require(filePath)));
|
|
16
19
|
}
|
|
17
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recursiveImport.js","sourceRoot":"","sources":["../../src/utils/recursiveImport.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AACpB,wDAAwB;
|
|
1
|
+
{"version":3,"file":"recursiveImport.js","sourceRoot":"","sources":["../../src/utils/recursiveImport.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AACpB,wDAAwB;AAExB;;GAEG;AACI,KAAK,UAAU,eAAe,CAAC,UAAkB,EAAE,OAAiB,CAAC,KAAK,EAAE,KAAK,CAAC;IACvF,IAAI,KAAK,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAE3E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACtB,MAAM,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;SACtC;aAAM,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;YAC/C,gEAAa,QAAQ,GAAC,CAAA;SACvB;KACF;AACH,CAAC;AAXD,0CAWC","sourcesContent":["import fs from \"fs\";\r\nimport path from \"path\";\r\n\r\n/**\r\n * Usage: `await recursiveImport(\"./src\", [\".js\", \".ts\"])`\r\n */\r\nexport async function recursiveImport(folderPath: string, exts: string[] = [\".js\", \".ts\"]): Promise<any> {\r\n let files = await fs.promises.readdir(folderPath, { withFileTypes: true });\r\n\r\n for (const file of files) {\r\n let filePath = path.resolve(folderPath, file.name);\r\n if (file.isDirectory()) {\r\n await recursiveImport(filePath, exts)\r\n } else if (exts.some(i => filePath.endsWith(i))) {\r\n await import(filePath)\r\n }\r\n }\r\n}"]}
|
package/package.json
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
"discord-api-types": "^0.37.0",
|
|
5
5
|
"discord-hybrid-sharding": "^1.7.4",
|
|
6
6
|
"discord.js": "^14.1.2",
|
|
7
|
-
"eventemitter3": "^4.0.7",
|
|
8
7
|
"lodash": "^4.17.21",
|
|
9
8
|
"snakecase-keys": "^5.4.2",
|
|
10
9
|
"stuffs": "^0.1.17"
|
|
11
10
|
},
|
|
12
11
|
"name": "@mostfeatured/dbi",
|
|
13
|
-
"version": "0.0.
|
|
12
|
+
"version": "0.0.9",
|
|
14
13
|
"main": "dist/index.js",
|
|
15
14
|
"type": "commonjs",
|
|
16
15
|
"private": false,
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Usage: `await recursiveImport("./src", [".js", ".ts"])`
|
|
6
|
+
*/
|
|
7
|
+
export async function recursiveImport(folderPath: string, exts: string[] = [".js", ".ts"]): Promise<any> {
|
|
5
8
|
let files = await fs.promises.readdir(folderPath, { withFileTypes: true });
|
|
6
9
|
|
|
7
10
|
for (const file of files) {
|
|
8
11
|
let filePath = path.resolve(folderPath, file.name);
|
|
9
12
|
if (file.isDirectory()) {
|
|
10
|
-
await recursiveImport(filePath)
|
|
11
|
-
} else if (filePath.endsWith(
|
|
13
|
+
await recursiveImport(filePath, exts)
|
|
14
|
+
} else if (exts.some(i => filePath.endsWith(i))) {
|
|
12
15
|
await import(filePath)
|
|
13
16
|
}
|
|
14
17
|
}
|