Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issues caused wrong relative paths #620

Merged
merged 4 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
.env
admin.macaroon
tls.cert
tls.cert
dist/
5 changes: 3 additions & 2 deletions bot/modules/community/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ async function findCommunities(currency) {
});
const orderCount = await getOrderCountByCommunity();
return communities.map(comm => {
comm.orders = orderCount[comm.id] || 0;
return comm;
const plainCommunity = comm.toObject();
plainCommunity.orders = orderCount[comm.id] || 0;
return plainCommunity;
});
}

Expand Down
2 changes: 1 addition & 1 deletion bot/modules/language/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { showFlagsMessage } = require('./messages');
exports.setlang = async ctx => {
try {
const flags = [];
fs.readdirSync(path.join(__dirname, '../../../locales')).forEach(file => {
fs.readdirSync(path.join(__dirname, '../../../../locales')).forEach(file => {
const lang = file.split('.')[0];
const flag = getLanguageFlag(lang);
if (flag !== undefined) {
Expand Down
2 changes: 1 addition & 1 deletion bot/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const initialize = (botToken: string, options: Partial<Telegraf.Options<MainCont

bot.command('version', async (ctx: MainContext) => {
try {
const pckg = require('../package.json');
const pckg = require('../../package.json');
await ctx.reply(pckg.version);
} catch (err) {
logger.error(err);
Expand Down
2 changes: 1 addition & 1 deletion bot/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ const isBannedFromCommunity = async (user: UserDocument, communityId: string) =>
}
};

module.exports = {
export {
validateSellOrder,
validateBuyOrder,
validateUser,
Expand Down
1,129 changes: 566 additions & 563 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"version": "0.11.1",
"author": "Francisco Calderón <[email protected]>",
"description": "P2P lightning network telegram bot",
"main": "app.js",
"main": "dist/app.js",
"scripts": {
"prestart": "npx tsc",
"start": "node ./app",
"start": "node ./dist/app",
"predev": "npx tsc",
"dev": "nodemon ./app",
"dev": "nodemon ./dist/app",
"lint": "eslint .",
"format": "prettier --write '**/*.js'",
"pretest": "npx tsc",
"test": "export NODE_ENV=test && mocha --exit tests/**/*.spec.js"
"format": "prettier --write '**/*.{js,ts}'",
"pretest": "tsc -p tsconfig.test.json",
"test": "export NODE_ENV=test && mocha --exit 'dist/tests/**/*.spec.js'"
},
"license": "MIT",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion tests/bot/bot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe('Telegram bot', () => {
flags += flag.length;
});
let langs = 0;
fs.readdirSync(path.join(__dirname, '../../locales')).forEach(file => {
fs.readdirSync(path.join(__dirname, '../../../locales')).forEach(file => {
langs++;
});
expect(flags).to.be.equal(langs);
Expand Down
21 changes: 18 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
{
"compilerOptions": {
"strict": true,
"strict": false,
"esModuleInterop": true,
"resolveJsonModule": true,
"downlevelIteration": true
}
"downlevelIteration": true,
"outDir": "./dist",
"rootDir": ".",
"allowJs": true,
"moduleResolution": "node"
},
"include": [
"app.ts",
"bot/**/*",
"jobs/**/*",
"ln/**/*",
"lnurl/**/*",
"models/**/*",
"util/**/*",
"locales/**/*",
],
"exclude": ["node_modules", "dist", "tests", "locales"]
}
9 changes: 9 additions & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"include": [
"tests/**/*"
],
"exclude": [
"node_modules"
]
}
Loading