Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Jun 9, 2020
1 parent 3e0d022 commit 3ba2fbc
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 30 deletions.
7 changes: 4 additions & 3 deletions packages/cubejs-cli/DeployDir.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DeployDir {
}

filter(file) {
let baseName = path.basename(file);
const baseName = path.basename(file);
return baseName !== 'node_modules' && baseName !== '.git' && baseName !== '.env';
}

Expand All @@ -21,6 +21,7 @@ class DeployDir {
for (const file of files) {
const filePath = path.resolve(directory, file);
if (!this.filter(filePath)) {
// eslint-disable-next-line no-continue
continue;
}
const stat = await fs.stat(filePath);
Expand All @@ -41,12 +42,12 @@ class DeployDir {
return fs.createReadStream(file)
.pipe(hash.setEncoding('hex'))
.on('finish', () => {
resolve(hash.digest('hex'))
resolve(hash.digest('hex'));
})
.on('error', (err) => {
reject(err);
});
})
});
}
}

Expand Down
24 changes: 12 additions & 12 deletions packages/cubejs-cli/cubejsCli.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ const createApp = async (projectName, options) => {
event('Create App', createAppOptions);
if (!options.dbType) {
await displayError([
"You must pass an application name and a database type (-d).",
"",
"Example: ",
" $ cubejs create hello-world -d postgres"
'You must pass an application name and a database type (-d).',
'',
'Example: ',
' $ cubejs create hello-world -d postgres'
], createAppOptions);
}
if (await fs.pathExists(projectName)) {
Expand All @@ -83,7 +83,7 @@ const createApp = async (projectName, options) => {
version: '0.0.1',
private: true,
scripts: {
dev: template === 'express' ? 'node index.js' : "./node_modules/.bin/cubejs-dev-server"
dev: template === 'express' ? 'node index.js' : './node_modules/.bin/cubejs-dev-server'
}
});

Expand Down Expand Up @@ -153,10 +153,10 @@ const createApp = async (projectName, options) => {
logStage(`${chalk.green(projectName)} app has been created 🎉`);

console.log();
console.log(`📊 Next step: run dev server`);
console.log('📊 Next step: run dev server');
console.log();
console.log(` $ cd ${projectName}`);
console.log(` $ npm run dev`);
console.log(' $ npm run dev');
console.log();
};

Expand All @@ -165,15 +165,15 @@ const generateSchema = async (options) => {
event('Generate Schema', generateSchemaOptions);
if (!options.tables) {
await displayError([
"You must pass table names to generate schema from (-t).",
"",
"Example: ",
" $ cubejs generate -t orders,customers"
'You must pass table names to generate schema from (-t).',
'',
'Example: ',
' $ cubejs generate -t orders,customers'
], generateSchemaOptions);
}
if (!(await fs.pathExists(path.join(process.cwd(), 'node_modules', '@cubejs-backend/server')))) {
await displayError(
"@cubejs-backend/server dependency not found. Please run generate command from project directory.",
'@cubejs-backend/server dependency not found. Please run generate command from project directory.',
generateSchemaOptions
);
}
Expand Down
10 changes: 5 additions & 5 deletions packages/cubejs-cli/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const rp = require('request-promise');
const jwt = require('jsonwebtoken');
const fs = require('fs-extra');
const path = require('path');
const DeployDir = require('./DeployDir');
const cliProgress = require('cli-progress');
const DeployDir = require('./DeployDir');
const { logStage } = require('./utils');

const cloudReq = (options) => {
Expand Down Expand Up @@ -44,7 +44,7 @@ exports.deploy = async ({ directory, auth }) => {
auth
});

await logStage(`Deploying ${deploymentName}...`, `Cube Cloud CLI Deploy`);
await logStage(`Deploying ${deploymentName}...`, 'Cube Cloud CLI Deploy');

const files = Object.keys(fileHashes);
bar.start(files.length, 0, {
Expand All @@ -71,7 +71,7 @@ exports.deploy = async ({ directory, auth }) => {
}
},
auth
})
});
}
}
bar.update(files.length, { file: 'Post processing...' });
Expand All @@ -87,5 +87,5 @@ exports.deploy = async ({ directory, auth }) => {
} finally {
bar.stop();
}
await logStage(`Done 🎉`, `Cube Cloud CLI Deploy Success`);
};
await logStage('Done 🎉', 'Cube Cloud CLI Deploy Success');
};
2 changes: 1 addition & 1 deletion packages/cubejs-cli/templates.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
global test expect
*/
const { express } = require("./templates");
const { express } = require('./templates');

const dotEnv = express.files['.env'];

Expand Down
12 changes: 6 additions & 6 deletions packages/cubejs-cli/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ const token = async (options = {}) => {
if (!secret) throw new Error('No app secret found').message;

const extraOptions = {};
if (expiry !== "0") extraOptions.expiresIn = expiry;
if (expiry !== '0') extraOptions.expiresIn = expiry;

const payload = parsePayload(options.payload);

console.log(`Generating Cube.js JWT token`);
console.log(``);
console.log('Generating Cube.js JWT token');
console.log('');
console.log(`${chalk.yellow('-----------------------------------------------------------------------------------------')}`);
console.log(` ${chalk.yellow(`Use these manually generated tokens in production with caution.`)}`);
console.log(` ${chalk.yellow('Use these manually generated tokens in production with caution.')}`);
console.log(` ${chalk.yellow(`Please refer to ${chalk.cyan('https://cube.dev/docs/security')} for production security best practices.`)}`);
console.log(`${chalk.yellow('-----------------------------------------------------------------------------------------')}`);
console.log(``);
console.log('');
console.log(`Expires in: ${chalk.green(expiry)}`);
console.log(`Payload: ${chalk.green(JSON.stringify(payload))}`);
console.log(``);
console.log('');

const signedToken = jwt.sign(payload, secret, extraOptions);
console.log(`Token: ${chalk.green(signedToken)}`);
Expand Down
6 changes: 3 additions & 3 deletions packages/cubejs-cli/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const displayError = async (text, options = {}) => {
console.error(chalk.yellow('Need some help? -------------------------------------'));
await event('Error', { error: Array.isArray(text) ? text.join('\n') : text.toString(), ...options });
console.error('');
console.error(`${chalk.yellow(` Ask this question in Cube.js Slack:`)} https://slack.cube.dev`);
console.error(`${chalk.yellow(` Post an issue:`)} https://github.com/cube-js/cube.js/issues`);
console.error(`${chalk.yellow(' Ask this question in Cube.js Slack:')} https://slack.cube.dev`);
console.error(`${chalk.yellow(' Post an issue:')} https://github.com/cube-js/cube.js/issues`);
console.error('');
process.exit(1);
};
Expand All @@ -58,7 +58,7 @@ exports.requireFromPackage = async (module) => {
const logStage = async (stage, eventName, props) => {
console.log(`- ${stage}`);
if (eventName) {
await event(eventName, props)
await event(eventName, props);
}
};

Expand Down

0 comments on commit 3ba2fbc

Please sign in to comment.