fix conflict
commit
a5fefbd264
|
@ -1,19 +1,19 @@
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
|
||||||
typescript_build:
|
typescript_build:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- cp ../config.json ./src/config.json
|
- cp ../config.json ./src/config.json
|
||||||
- yarn install --ignore-engines
|
- yarn install --ignore-engines
|
||||||
- tsc -p ./tsconfig.json
|
- tsc -p ./tsconfig.json
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
stage: test
|
stage: test
|
||||||
before_script:
|
before_script:
|
||||||
- cp ../config.json ./src/config.json
|
- cp ../config.json ./src/config.json
|
||||||
- yarn install --ignore-engines
|
- yarn install --ignore-engines
|
||||||
script:
|
script:
|
||||||
- yarn run lint-find
|
- yarn run lint-find
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
"uuid": "^3.3.3"
|
"uuid": "^3.3.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.2",
|
"@types/express": "^4.17.6",
|
||||||
|
"@types/express-serve-static-core": "^4.17.5",
|
||||||
"@types/fs-extra": "^8.0.0",
|
"@types/fs-extra": "^8.0.0",
|
||||||
"@types/helmet": "^0.0.45",
|
"@types/helmet": "^0.0.45",
|
||||||
"@types/ioredis": "^4.0.18",
|
"@types/ioredis": "^4.0.18",
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default class Security {
|
||||||
return req.headers.authorization.split(' ')[1];
|
return req.headers.authorization.split(' ')[1];
|
||||||
}
|
}
|
||||||
if (req.query && req.query.token) {
|
if (req.query && req.query.token) {
|
||||||
return req.query.token;
|
return req.query.token as string;
|
||||||
}
|
}
|
||||||
return '0000000000';
|
return '0000000000';
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,15 +32,25 @@ export default class Util {
|
||||||
* @param options childProcess.ExecOptions
|
* @param options childProcess.ExecOptions
|
||||||
*/
|
*/
|
||||||
public async exec(command: string, options: childProcess.ExecOptions = {}): Promise<string> {
|
public async exec(command: string, options: childProcess.ExecOptions = {}): Promise<string> {
|
||||||
const ex = promisify(childProcess.exec);
|
return new Promise((res, rej) => {
|
||||||
let result: string;
|
let error = false;
|
||||||
try {
|
let output = '';
|
||||||
const res = await ex(command, options);
|
const writeFunction = (data: string|Buffer|Error) => {
|
||||||
result = `${res.stdout}${res.stderr}`;
|
if (data instanceof Error) error = true;
|
||||||
} catch (err) {
|
output += `${data}`;
|
||||||
return Promise.reject(new Error(`Command failed: ${err.cmd}\n${err.stderr}${err.stdout}`));
|
};
|
||||||
}
|
const cmd = childProcess.exec(command, options);
|
||||||
return result;
|
cmd.stdout.on('data', writeFunction);
|
||||||
|
cmd.stderr.on('data', writeFunction);
|
||||||
|
cmd.on('error', writeFunction);
|
||||||
|
cmd.once('close', (code, signal) => {
|
||||||
|
cmd.stdout.removeListener('data', writeFunction);
|
||||||
|
cmd.stderr.removeListener('data', writeFunction);
|
||||||
|
cmd.removeListener('error', writeFunction);
|
||||||
|
if (error) rej(output);
|
||||||
|
res(output);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,7 +32,7 @@ export default class Load extends Command {
|
||||||
delete require.cache[`${corepath}/commands/index.js`];
|
delete require.cache[`${corepath}/commands/index.js`];
|
||||||
delete require.cache[`${corepath}/commands/${args[1]}.js`];
|
delete require.cache[`${corepath}/commands/${args[1]}.js`];
|
||||||
Object.keys(require.cache).filter((path) => path.includes(`${args[1]}_`)).forEach((path) => delete require.cache[path]);
|
Object.keys(require.cache).filter((path) => path.includes(`${args[1]}_`)).forEach((path) => delete require.cache[path]);
|
||||||
const cmdIndex = require('../commands');
|
const cmdIndex = require('.');
|
||||||
let Cmd = cmdIndex[args[1]];
|
let Cmd = cmdIndex[args[1]];
|
||||||
if (!Cmd) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Could not find file***`);
|
if (!Cmd) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Could not find file***`);
|
||||||
Cmd = require(`${corepath}/commands/${args[1]}`).default;
|
Cmd = require(`${corepath}/commands/${args[1]}`).default;
|
||||||
|
|
Loading…
Reference in New Issue