mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
fix: remove console log in backend
This commit is contained in:
1 parent
82d1004ecf
commit
0d886a686e
3 files changed
+7
-5
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ module.exports = {
|
|||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': 'error',
|
'no-console': 'warn',
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
'import/extensions': 'off',
|
'import/extensions': 'off',
|
||||||
camelcase: ['error', { properties: 'never', ignoreDestructuring: true }],
|
camelcase: ['error', { properties: 'never', ignoreDestructuring: true }],
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import path from 'path'
|
|||||||
import yaml from 'yaml'
|
import yaml from 'yaml'
|
||||||
|
|
||||||
import { Quest } from '@linux-odyssey/models'
|
import { Quest } from '@linux-odyssey/models'
|
||||||
|
import logger from './logger'
|
||||||
|
|
||||||
const questDirectory = path.join(process.cwd(), '..', 'quests')
|
const questDirectory = path.join(process.cwd(), '..', 'quests')
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ export function loadAndUpdateQuests() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error parsing quest ${id}:`, error)
|
logger.error(`Error parsing quest ${id}:`, error)
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { User } from '@linux-odyssey/models'
|
import { User } from '@linux-odyssey/models'
|
||||||
import config from '../config.js'
|
import config from '../config.js'
|
||||||
import { createUser } from '../models/userManager.js'
|
import { createUser } from '../models/userManager.js'
|
||||||
|
import logger from './logger.js'
|
||||||
|
|
||||||
export default async function setupTest() {
|
export default async function setupTest() {
|
||||||
console.log('Setting up test account')
|
logger.info('Setting up test account')
|
||||||
if (!(config.testing.username && config.testing.password)) {
|
if (!(config.testing.username && config.testing.password)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'No testing account found! Please set TESTING_USERNAME and TESTING_PASSWORD in .env'
|
'No testing account found! Please set TESTING_USERNAME and TESTING_PASSWORD in .env'
|
||||||
@@ -13,10 +14,10 @@ export default async function setupTest() {
|
|||||||
const email = `${username}@example.com`
|
const email = `${username}@example.com`
|
||||||
|
|
||||||
if (await User.exists({ username })) {
|
if (await User.exists({ username })) {
|
||||||
console.log('Testing account already exists')
|
logger.info('Testing account already exists')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await createUser(username, email, { password })
|
await createUser(username, email, { password })
|
||||||
console.log('Created testing account')
|
logger.info('Created testing account')
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user