simple structure
This commit is contained in:
+2
-2
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "next-websockets",
|
"name": "next-websockets",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "dist/cli.js",
|
"main": "dist/index.js",
|
||||||
"repository": "[email protected]:selimaj-dev/next-websockets.git",
|
"repository": "[email protected]:selimaj-dev/next-websockets.git",
|
||||||
"author": "Klesti Selimaj <[email protected]>",
|
"author": "Klesti Selimaj <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
"next-websockets": "dist/bin/cli.js"
|
"next-websockets": "dist/index.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
const args = process.argv.slice(2);
|
|
||||||
|
|
||||||
console.log("Dev tool running");
|
|
||||||
console.log("Args:", args);
|
|
||||||
console.log("CWD:", process.cwd());
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
|
||||||
|
console.log("Dev tool running");
|
||||||
|
console.log("Args:", args);
|
||||||
|
console.log("CWD:", process.cwd());
|
||||||
|
|||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
import fs from "fs";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
export async function listWsFiles(dir: string) {
|
||||||
|
const files: string[] = [];
|
||||||
|
|
||||||
|
function walk(currentDir: string) {
|
||||||
|
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
||||||
|
for (const entry of entries) {
|
||||||
|
const fullPath = path.join(currentDir, entry.name);
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
walk(fullPath);
|
||||||
|
} else if (entry.isFile() && entry.name === "ws.ts") {
|
||||||
|
files.push(fullPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
walk(dir);
|
||||||
|
|
||||||
|
const modules = await Promise.all(files.map((file) => import(file)));
|
||||||
|
|
||||||
|
return modules;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user