config: fix imports not working correctly
this patch moves the rootDir of the typescript project up a directory this moves all content in the dist directory inside the new src directory I couldn't find other way
This commit is contained in:
parent
46bb5c867d
commit
18646b9dc6
4 changed files with 15 additions and 7 deletions
|
@ -15,4 +15,4 @@ COPY src ./src
|
|||
RUN npx tsc
|
||||
|
||||
# Run the app
|
||||
CMD ["node", "dist/index.js"]
|
||||
CMD ["node", "dist/src/index.js"]
|
||||
|
|
|
@ -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",
|
||||
|
|
12
src/index.ts
12
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);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"module": "CommonJS",
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist/",
|
||||
"rootDir": "./src/",
|
||||
"rootDir": "./",
|
||||
"strict": true,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
|
|
Loading…
Reference in a new issue