forked from engineering/cloudservices
fix conflict
commit
a5fefbd264
|
@ -1,19 +1,19 @@
|
|||
stages:
|
||||
- build
|
||||
- test
|
||||
|
||||
typescript_build:
|
||||
stage: build
|
||||
script:
|
||||
- cp ../config.json ./src/config.json
|
||||
- yarn install --ignore-engines
|
||||
- tsc -p ./tsconfig.json
|
||||
|
||||
lint:
|
||||
stage: test
|
||||
before_script:
|
||||
- cp ../config.json ./src/config.json
|
||||
- yarn install --ignore-engines
|
||||
script:
|
||||
- yarn run lint-find
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
|
||||
typescript_build:
|
||||
stage: build
|
||||
script:
|
||||
- cp ../config.json ./src/config.json
|
||||
- yarn install --ignore-engines
|
||||
- tsc -p ./tsconfig.json
|
||||
|
||||
lint:
|
||||
stage: test
|
||||
before_script:
|
||||
- cp ../config.json ./src/config.json
|
||||
- yarn install --ignore-engines
|
||||
script:
|
||||
- yarn run lint-find
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
"uuid": "^3.3.3"
|
||||
},
|
||||
"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/helmet": "^0.0.45",
|
||||
"@types/ioredis": "^4.0.18",
|
||||
|
|
|
@ -70,7 +70,7 @@ export default class Security {
|
|||
return req.headers.authorization.split(' ')[1];
|
||||
}
|
||||
if (req.query && req.query.token) {
|
||||
return req.query.token;
|
||||
return req.query.token as string;
|
||||
}
|
||||
return '0000000000';
|
||||
}
|
||||
|
|
|
@ -32,15 +32,25 @@ export default class Util {
|
|||
* @param options childProcess.ExecOptions
|
||||
*/
|
||||
public async exec(command: string, options: childProcess.ExecOptions = {}): Promise<string> {
|
||||
const ex = promisify(childProcess.exec);
|
||||
let result: string;
|
||||
try {
|
||||
const res = await ex(command, options);
|
||||
result = `${res.stdout}${res.stderr}`;
|
||||
} catch (err) {
|
||||
return Promise.reject(new Error(`Command failed: ${err.cmd}\n${err.stderr}${err.stdout}`));
|
||||
}
|
||||
return result;
|
||||
return new Promise((res, rej) => {
|
||||
let error = false;
|
||||
let output = '';
|
||||
const writeFunction = (data: string|Buffer|Error) => {
|
||||
if (data instanceof Error) error = true;
|
||||
output += `${data}`;
|
||||
};
|
||||
const cmd = childProcess.exec(command, options);
|
||||
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/${args[1]}.js`];
|
||||
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]];
|
||||
if (!Cmd) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Could not find file***`);
|
||||
Cmd = require(`${corepath}/commands/${args[1]}`).default;
|
||||
|
|
Loading…
Reference in New Issue