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 npx tsc
|
||||||
|
|
||||||
# Run the app
|
# Run the app
|
||||||
CMD ["node", "dist/index.js"]
|
CMD ["node", "dist/src/index.js"]
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
"name": "gptcord",
|
"name": "gptcord",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "tsc && node dist/index.js",
|
"start": "tsc && node dist/src/index.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"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",
|
"author": "Wroclaw",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
12
src/index.ts
12
src/index.ts
|
@ -23,9 +23,17 @@ function getConfig() {
|
||||||
["./config.ts"],
|
["./config.ts"],
|
||||||
{outDir: "./dist"}
|
{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
|
// 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) {
|
} catch (e) {
|
||||||
//FIXME: make errors more descriptive to the enduser
|
//FIXME: make errors more descriptive to the enduser
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"module": "CommonJS",
|
"module": "CommonJS",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "./dist/",
|
"outDir": "./dist/",
|
||||||
"rootDir": "./src/",
|
"rootDir": "./",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
|
Loading…
Reference in a new issue