Skip to content

Commit

Permalink
Removed trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Apr 9, 2017
1 parent b2a10d9 commit 038a6fd
Show file tree
Hide file tree
Showing 84 changed files with 201 additions and 201 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"no-template-curly-in-string": "off",
"no-ternary": "off",
"no-throw-literal": "off",
"no-trailing-spaces": "off",
"no-trailing-spaces": "error",
"no-undef-init": "off",
"no-undefined": "off",
"no-undef": "off",
Expand Down
4 changes: 2 additions & 2 deletions client/src/components-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ module.exports = function(config, renderTemplate){
getComponentsData(toDo, options, function(){
renderComponents(toDo, options, function(){
processClientReponses(toDo, options, function(){
const errors = [],
const errors = [],
results = [];
let hasErrors = false;

_.each(toDo, function(action){
if(action.result.error) {
hasErrors = true;
Expand Down
2 changes: 1 addition & 1 deletion client/src/get-compiled-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function(cache){

let ocTemplate;
try {
ocTemplate = requireTemplate(type);
ocTemplate = requireTemplate(type);
} catch (err) {
return callback(err);
}
Expand Down
16 changes: 8 additions & 8 deletions client/src/get-components-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ module.exports = function(config){

if (response && response.error) {
if (errorDetails) {
errorDetails = format('{0} {1}', errorDetails, response.error);
errorDetails = format('{0} {1}', errorDetails, response.error);
} else {
errorDetails = response.error;
}
}

if (!errorDetails) {
errorDetails = settings.emptyResponse;
}
Expand All @@ -33,7 +33,7 @@ module.exports = function(config){
}
});
});

return responses;
};

Expand Down Expand Up @@ -61,7 +61,7 @@ module.exports = function(config){

const performGet = function(endpoint, serverRendering, options, callback) {
const component = serverRendering.components[0];
const requestUrl = hrefBuilder.prepareServerGet(endpoint, component, options);
const requestUrl = hrefBuilder.prepareServerGet(endpoint, component, options);

const requestDetails = {
url: requestUrl,
Expand Down Expand Up @@ -111,24 +111,24 @@ module.exports = function(config){
action.failover = true;
}
});

return cb(serverRenderingFail);
}

const performRequest = (serverRendering.components.length === 1) ? performGet : performPost;

performRequest(serverRenderingEndpoint, serverRendering, options, function(responses) {
_.each(responses, function(response, i){
const action = toDo[serverRendering.positions[i]];

if(action.render === 'server'){
if(response.status !== 200){

let errorDetails;
if(!response.status && response.response.error){
errorDetails = response.response.error;
} else {

let errorDescription = (response.response && response.response.error);
if(errorDescription && response.response.details && response.response.details.originalError){
errorDescription += response.response.details.originalError;
Expand Down
2 changes: 1 addition & 1 deletion client/src/get-components-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = function(config) {
requestedVersion: component.version
});
});

const requestDetails = {
url: serverRenderingEndpoint,
method: 'post',
Expand Down
2 changes: 1 addition & 1 deletion client/src/get-oc-client-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const TryGetCached = require('./try-get-cached');
module.exports = function(cache){

const tryGetCached = new TryGetCached(cache);

return function(callback){
tryGetCached('scripts', 'oc-client', function(cb){
fs.readFile(path.resolve(__dirname, './oc-client.min.js'), 'utf-8', cb);
Expand Down
4 changes: 2 additions & 2 deletions client/src/href-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = function(config){
return {
client: function(component, options){
let clientRenderingEndpoint;

if(!!options && !!options.registries && !!options.registries.clientRendering){
clientRenderingEndpoint = options.registries.clientRendering;
} else if(!!config && !!config.registries && !!config.registries.clientRendering){
Expand Down Expand Up @@ -38,7 +38,7 @@ module.exports = function(config){
registryUrl = clientRenderingEndpoint,
registrySegment = registryUrl.slice(-1) === '/' ? registryUrl : (registryUrl + '/'),
qs = component.parameters ? ('/?' + querystring.stringify(component.parameters)) : '';

return url.resolve(registrySegment, component.name) + versionSegment + qs;
},

Expand Down
2 changes: 1 addition & 1 deletion client/src/html-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
data.html += format(templates.renderInfo, data.name, data.version);
}

if(data.container !== false){
if(data.container !== false){
data.html = format(templates.componentTag, data.href, data.key, data.name || '', data.version, data.html);
}

Expand Down
6 changes: 3 additions & 3 deletions client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function(conf){
return warmup(options, callback);
},
renderComponent: function(componentName, options, callback){
if(_.isFunction(options)){
if(_.isFunction(options)){
callback = options;
options = {};
}
Expand All @@ -45,11 +45,11 @@ module.exports = function(conf){
});
},
renderComponents: function(components, options, callback){
if(_.isFunction(options)){
if(_.isFunction(options)){
callback = options;
options = {};
}

renderComponents(components, options, callback);
},
getComponentsInfo: function(components, callback) {
Expand Down
2 changes: 1 addition & 1 deletion client/src/process-client-responses.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function(cache, config){
action.result.html = '';
return;
}

const unrenderedComponentTag = htmlRenderer.unrenderedComponent(componentClientHref, options);

if(action.failover){
Expand Down
2 changes: 1 addition & 1 deletion client/src/render-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function(cache, renderTemplate){
const data = component.data,
isLocal = component.type === 'oc-component-local',
useCache = !isLocal;

getCompiledTemplate(component.template, useCache, options.timeout, function(err, template){
if(err){ return cb(err); }

Expand Down
4 changes: 2 additions & 2 deletions client/src/template-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ module.exports = function(){

let ocTemplate;
try {
ocTemplate = requireTemplate(type);
ocTemplate = requireTemplate(type);
} catch (err) {
return callback(err);
}

ocTemplate.render(
{
template,
Expand Down
8 changes: 4 additions & 4 deletions client/src/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
module.exports = {

clientScript: '<script class="ocClientScript">{0}</script>{1}',

componentTag: '<oc-component href="{0}" data-hash="{1}" data-name="{2}" data-rendered="true" data-version="{3}">{4}</oc-component>',

componentUnrenderedTag: '<oc-component href="{0}"></oc-component>',
renderInfo: '<script>window.oc=window.oc||{};oc.renderedComponents=oc.renderedComponents||{};' +

renderInfo: '<script>window.oc=window.oc||{};oc.renderedComponents=oc.renderedComponents||{};' +
'oc.renderedComponents["{0}"]="{1}";</script>'
};
2 changes: 1 addition & 1 deletion client/src/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const _ = {
},
eachAsync: function(obj, fn, cb){
let callbacksLeft = obj.length;

const next = function(err){
callbacksLeft--;
if(callbacksLeft === 0 || !!err){
Expand Down
2 changes: 1 addition & 1 deletion client/src/utils/require-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function(template) {
let ocTemplate;
const localTemplate = path.join(__dirname, '../../../', 'node_modules', template);
const relativeTemplate = path.resolve('.', 'node_modules', template);

try {
if (require.cache && !!require.cache[localTemplate]) {
delete require.cache[localTemplate];
Expand Down
4 changes: 2 additions & 2 deletions client/src/warmup.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = function(config, renderComponents){
}

const parameters = componentInfo.oc.parameters,
componentToWarmup = {
componentToWarmup = {
name: componentInfo.name,
version: componentInfo.version,
parameters: {}
Expand All @@ -76,7 +76,7 @@ module.exports = function(config, renderComponents){
_.each(toWarmup, function(component, i){
response[component.name] = results[i];
});

cb(null, response);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/cli/domain/get-missing-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ module.exports = function(dependencies){
const missing = [];

_.forEach(dependencies, function(npmModule){

const index = npmModule.indexOf('@');
let moduleName = npmModule;

if (index > 0) {
moduleName = npmModule.substr(0, index);
}
const pathToModule = path.resolve('node_modules/', moduleName);

try {
if(require.cache[pathToModule]){
delete require.cache[pathToModule];
Expand Down
2 changes: 1 addition & 1 deletion src/cli/domain/get-mocked-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const findPath = function(pathToResolve, fileName) {
return findPath(parentDir, fileName);
}
}

return fileToResolve;
};

Expand Down
2 changes: 1 addition & 1 deletion src/cli/domain/package-static-files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const copyDir = function(params, cb){

nodeDir.paths(staticPath, function(err, res){
_.forEach(res.files, function(filePath){

const fileName = path.basename(filePath),
fileExt = path.extname(filePath).toLowerCase(),
fileRelativePath = path.relative(staticPath, path.dirname(filePath)),
Expand Down
4 changes: 2 additions & 2 deletions src/cli/domain/package-static-files/minify-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ module.exports = function(fileExt, fileContent){

const babelOptions = { presets: [[babelPresetEnv, presetOptions]] },
es5 = babel.transform(fileContent, babelOptions).code;

return uglifyJs.minify(es5, { fromString: true }).code;

} else if(fileExt === '.css'){

return new CleanCss().minify(fileContent).styles;
}
};
4 changes: 2 additions & 2 deletions src/cli/domain/package-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const compileView = function(viewPath, type, cb) {

if (type === 'jade') { type = 'oc-template-jade'; }
if (type === 'handlebars') { type = 'oc-template-handlebars'; }


try {
ocTemplate = requireTemplate(type);
ocTemplate = requireTemplate(type);
} catch (err) {
return cb(err);
}
Expand Down
4 changes: 2 additions & 2 deletions src/cli/domain/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = function(opts){
}

request({
url: registry,
url: registry,
headers: requestsHeaders,
json: true
}, function(err, apiResponse){
Expand Down Expand Up @@ -87,7 +87,7 @@ module.exports = function(opts){
},
getComponentPreviewUrlByUrl: function(componentHref, callback){
request({
url: componentHref,
url: componentHref,
headers: requestsHeaders,
json: true
}, function(err, res){
Expand Down
6 changes: 3 additions & 3 deletions src/cli/facade/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ module.exports = function(dependencies){

const loadDependencies = function(components, cb){
log.warn(strings.messages.cli.CHECKING_DEPENDENCIES, true);

const dependencies = getComponentsDependencies(components),
missing = getMissingDeps(dependencies.withVersions, components);

Expand Down Expand Up @@ -143,7 +143,7 @@ module.exports = function(dependencies){
if(_.isEmpty(components)){
err = format(errors.DEV_FAIL, errors.COMPONENTS_NOT_FOUND);
callback(err);
return log.err(err);
return log.err(err);
}

log.ok('OK');
Expand All @@ -153,7 +153,7 @@ module.exports = function(dependencies){

loadDependencies(components, function(dependencies){
packageComponents(components, function(){

const registry = new oc.Registry({
local: true,
hotReloading: hotReloading,
Expand Down
2 changes: 1 addition & 1 deletion src/cli/facade/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const strings = require('../../resources/index');
const wrapCliCallback = require('../wrap-cli-callback');

module.exports = function(dependencies){

const local = dependencies.local,
logger = dependencies.logger;

Expand Down
2 changes: 1 addition & 1 deletion src/cli/facade/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const strings = require('../../resources/index');
const wrapCliCallback = require('../wrap-cli-callback');

module.exports = function(dependencies){

const local = dependencies.local,
logger = dependencies.logger;

Expand Down
8 changes: 4 additions & 4 deletions src/cli/facade/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ module.exports = function(dependencies) {
};
local.package(packageOptions, function(err, component){
if(err){
log.err(format(strings.errors.cli.PACKAGE_CREATION_FAIL, err));
return callback(err);
log.err(format(strings.errors.cli.PACKAGE_CREATION_FAIL, err));
return callback(err);
}

log.ok(format(strings.messages.cli.PACKAGED, packageDir));
Expand All @@ -40,8 +40,8 @@ module.exports = function(dependencies) {

local.compress(packageDir, compressedPackagePath, function(err){
if(err){
log.err(format(strings.errors.cli.PACKAGE_CREATION_FAIL, err));
return callback(err);
log.err(format(strings.errors.cli.PACKAGE_CREATION_FAIL, err));
return callback(err);
}
log.ok(format(strings.messages.cli.COMPRESSED, compressedPackagePath));
callback(null, component);
Expand Down
Loading

0 comments on commit 038a6fd

Please sign in to comment.