elysia-autoload 0.0.1 → 0.0.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.
- package/dist/index.js +3 -2
- package/package.json +3 -2
package/dist/index.js
CHANGED
@@ -7,15 +7,16 @@ const node_path_1 = require("node:path");
|
|
7
7
|
const utils_1 = require("./utils");
|
8
8
|
async function autoload({ pattern, dir, prefix, schema, } = {}) {
|
9
9
|
const directoryPath = (0, utils_1.getPath)(dir || "./routes");
|
10
|
-
if (!node_fs_1.
|
10
|
+
if (!(0, node_fs_1.existsSync)(directoryPath))
|
11
11
|
throw new Error(`Directory ${directoryPath} doesn't exists`);
|
12
|
-
if (!node_fs_1.
|
12
|
+
if (!(0, node_fs_1.statSync)(directoryPath).isDirectory())
|
13
13
|
throw new Error(`${directoryPath} isn't a directory`);
|
14
14
|
const app = new elysia_1.default({
|
15
15
|
name: "elysia-autoload",
|
16
16
|
seed: {
|
17
17
|
pattern,
|
18
18
|
dir,
|
19
|
+
prefix,
|
19
20
|
},
|
20
21
|
});
|
21
22
|
const glob = new Bun.Glob(pattern || "**/*.{ts,js,mjs,cjs}");
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "elysia-autoload",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.3",
|
4
4
|
"author": "kravetsone",
|
5
5
|
"description": "Plugin for Elysia which autoload all routes in directory",
|
6
6
|
"keywords": [
|
@@ -12,8 +12,9 @@
|
|
12
12
|
"filerouter",
|
13
13
|
"autoroutes"
|
14
14
|
],
|
15
|
+
"main": "dist/index.js",
|
15
16
|
"scripts": {
|
16
|
-
"prepublishOnly": "
|
17
|
+
"prepublishOnly": "tsc",
|
17
18
|
"lint": "eslint \"src/**/*.{ts,tsx,js,mjs,cjs}\"",
|
18
19
|
"lint:fix": "eslint \"src/**/*.{ts,tsx,js,mjs,cjs}\" --fix"
|
19
20
|
},
|