diff --git a/Dockerfile b/Dockerfile index d288a6a..4b9f015 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,4 @@ COPY src ./src RUN npx tsc # Run the app -CMD ["node", "dist/index.js"] +CMD ["node", "dist/src/index.js"] diff --git a/package.json b/package.json index 27b96fb..16a5e24 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,11 @@ "name": "gptcord", "version": "0.1.0", "description": "", - "main": "./dist/index.js", + "main": "./dist/src/index.js", "scripts": { - "start": "tsc && node dist/index.js", + "start": "tsc && node dist/src/index.js", "test": "echo \"Error: no test specified\" && exit 1", - "publishCommands": "tsc && node dist/scripts/pushCommands.js" + "publishCommands": "tsc && node dist/src/scripts/pushCommands.js" }, "author": "Wroclaw", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index ac2a2a7..66a2ceb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,9 +23,17 @@ function getConfig() { ["./config.ts"], {outDir: "./dist"} ); - program.emit(program.getSourceFile("./config.ts")); + + program.getSourceFiles() + .filter(e => { + if (!e.fileName.match(`^${process.cwd()}`)) return true; + if (e.fileName.match(`${process.cwd()}/node_modules`)) return false; + if (e.fileName.match(`${process.cwd()}/src/`)) return false; + return true; + }) + .forEach(e => program.emit(e)); // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access - fileConfig = require("./config").default as IConfig; + fileConfig = require("../config").default as IConfig; } catch (e) { //FIXME: make errors more descriptive to the enduser console.log(e); diff --git a/tsconfig.json b/tsconfig.json index 66df360..77c5666 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "module": "CommonJS", "sourceMap": true, "outDir": "./dist/", - "rootDir": "./src/", + "rootDir": "./", "strict": true, "moduleResolution": "node", "esModuleInterop": true,