Skip to content

Commit 9f56386

Browse files
committed
style: Prettify (v2)
1 parent faa610f commit 9f56386

26 files changed

+60
-93
lines changed

deploy/googleDeploy.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ class GoogleDeploy {
3030
);
3131

3232
this.hooks = {
33-
'before:deploy:deploy': () =>
34-
BbPromise.bind(this)
35-
.then(this.validate)
36-
.then(this.setDefaults),
33+
'before:deploy:deploy': () => BbPromise.bind(this).then(this.validate).then(this.setDefaults),
3734

3835
'deploy:deploy': () =>
3936
BbPromise.bind(this)

deploy/lib/cleanupDeploymentBucket.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ const _ = require('lodash');
55

66
module.exports = {
77
cleanupDeploymentBucket() {
8-
return BbPromise.bind(this)
9-
.then(this.getObjectsToRemove)
10-
.then(this.removeObjects);
8+
return BbPromise.bind(this).then(this.getObjectsToRemove).then(this.removeObjects);
119
},
1210

1311
getObjectsToRemove() {
1412
const params = {
1513
bucket: this.serverless.service.provider.deploymentBucketName,
1614
};
1715

18-
return this.provider.request('storage', 'objects', 'list', params).then(response => {
16+
return this.provider.request('storage', 'objects', 'list', params).then((response) => {
1917
if (!response.items.length) return BbPromise.resolve([]);
2018

2119
const files = response.items;
@@ -25,7 +23,7 @@ module.exports = {
2523

2624
const orderedObjects = _.orderBy(
2725
files,
28-
file => {
26+
(file) => {
2927
const timestamp = file.name.match(/(serverless)\/(.+)\/(.+)\/(\d+)-(.+)\/(.+\.zip)/)[4];
3028
return timestamp;
3129
},
@@ -48,7 +46,7 @@ module.exports = {
4846

4947
this.serverless.cli.log('Removing old artifacts...');
5048

51-
const removePromises = objectsToRemove.map(object => {
49+
const removePromises = objectsToRemove.map((object) => {
5250
const params = {
5351
bucket: object.bucket,
5452
object: object.name,

deploy/lib/cleanupDeploymentBucket.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe('CleanupDeploymentBucket', () => {
9494
};
9595
requestStub.returns(BbPromise.resolve(response));
9696

97-
return googleDeploy.getObjectsToRemove().then(objects => {
97+
return googleDeploy.getObjectsToRemove().then((objects) => {
9898
expect(objects.length).toEqual(2);
9999
expect(objects).not.toContainEqual({
100100
bucket: 'sls-my-service-dev-12345678',
@@ -143,7 +143,7 @@ describe('CleanupDeploymentBucket', () => {
143143
};
144144
requestStub.returns(BbPromise.resolve(response));
145145

146-
return googleDeploy.getObjectsToRemove().then(objects => {
146+
return googleDeploy.getObjectsToRemove().then((objects) => {
147147
expect(objects.length).toEqual(0);
148148
expect(objects).toEqual([]);
149149
expect(
@@ -160,7 +160,7 @@ describe('CleanupDeploymentBucket', () => {
160160
};
161161
requestStub.returns(BbPromise.resolve(response));
162162

163-
return googleDeploy.getObjectsToRemove().then(objects => {
163+
return googleDeploy.getObjectsToRemove().then((objects) => {
164164
expect(objects.length).toEqual(0);
165165
expect(objects).toEqual([]);
166166
expect(
@@ -217,7 +217,7 @@ describe('CleanupDeploymentBucket', () => {
217217

218218
requestStub.returns(BbPromise.resolve('removePromise'));
219219

220-
return googleDeploy.removeObjects(objectsToRemove).then(removePromises => {
220+
return googleDeploy.removeObjects(objectsToRemove).then((removePromises) => {
221221
expect(requestStub.called).toEqual(true);
222222
expect(consoleLogStub.calledOnce).toEqual(true);
223223
expect(removePromises).toEqual([

deploy/lib/createDeployment.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ const BbPromise = require('bluebird');
77

88
module.exports = {
99
createDeployment() {
10-
return BbPromise.bind(this)
11-
.then(this.checkForExistingDeployment)
12-
.then(this.createIfNotExists);
10+
return BbPromise.bind(this).then(this.checkForExistingDeployment).then(this.createIfNotExists);
1311
},
1412

1513
checkForExistingDeployment() {
@@ -19,11 +17,11 @@ module.exports = {
1917

2018
return this.provider
2119
.request('deploymentmanager', 'deployments', 'list', params)
22-
.then(response => {
20+
.then((response) => {
2321
let foundDeployment;
2422

2523
if (response && response.deployments) {
26-
foundDeployment = response.deployments.find(deployment => {
24+
foundDeployment = response.deployments.find((deployment) => {
2725
const name = `sls-${this.serverless.service.service}-${this.options.stage}`;
2826
return deployment.name === name;
2927
});

deploy/lib/createDeployment.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('CreateDeployment', () => {
7272
it('should return "undefined" if no deployments are found', () => {
7373
requestStub.returns(BbPromise.resolve([]));
7474

75-
return googleDeploy.checkForExistingDeployment().then(foundDeployment => {
75+
return googleDeploy.checkForExistingDeployment().then((foundDeployment) => {
7676
expect(foundDeployment).toEqual(undefined);
7777
expect(
7878
requestStub.calledWithExactly('deploymentmanager', 'deployments', 'list', {
@@ -88,7 +88,7 @@ describe('CreateDeployment', () => {
8888
};
8989
requestStub.returns(BbPromise.resolve(response));
9090

91-
return googleDeploy.checkForExistingDeployment().then(foundDeployment => {
91+
return googleDeploy.checkForExistingDeployment().then((foundDeployment) => {
9292
expect(foundDeployment).toEqual(undefined);
9393
expect(
9494
requestStub.calledWithExactly('deploymentmanager', 'deployments', 'list', {
@@ -104,7 +104,7 @@ describe('CreateDeployment', () => {
104104
};
105105
requestStub.returns(BbPromise.resolve(response));
106106

107-
return googleDeploy.checkForExistingDeployment().then(foundDeployment => {
107+
return googleDeploy.checkForExistingDeployment().then((foundDeployment) => {
108108
expect(foundDeployment).toEqual(response.deployments[0]);
109109
expect(
110110
requestStub.calledWithExactly('deploymentmanager', 'deployments', 'list', {

deploy/lib/updateDeployment.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ const BbPromise = require('bluebird');
77

88
module.exports = {
99
updateDeployment() {
10-
return BbPromise.bind(this)
11-
.then(this.getDeployment)
12-
.then(this.update);
10+
return BbPromise.bind(this).then(this.getDeployment).then(this.update);
1311
},
1412

1513
getDeployment() {
@@ -19,8 +17,8 @@ module.exports = {
1917

2018
return this.provider
2119
.request('deploymentmanager', 'deployments', 'list', params)
22-
.then(response => {
23-
const deployment = response.deployments.find(dep => {
20+
.then((response) => {
21+
const deployment = response.deployments.find((dep) => {
2422
const name = `sls-${this.serverless.service.service}-${this.options.stage}`;
2523
return dep.name === name;
2624
});

deploy/lib/updateDeployment.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('UpdateDeployment', () => {
7171
};
7272
requestStub.returns(BbPromise.resolve(response));
7373

74-
return googleDeploy.getDeployment().then(foundDeployment => {
74+
return googleDeploy.getDeployment().then((foundDeployment) => {
7575
expect(foundDeployment).toEqual(undefined);
7676
expect(
7777
requestStub.calledWithExactly('deploymentmanager', 'deployments', 'list', {
@@ -87,7 +87,7 @@ describe('UpdateDeployment', () => {
8787
};
8888
requestStub.returns(BbPromise.resolve(response));
8989

90-
return googleDeploy.getDeployment().then(foundDeployment => {
90+
return googleDeploy.getDeployment().then((foundDeployment) => {
9191
expect(foundDeployment).toEqual(response.deployments[0]);
9292
expect(
9393
requestStub.calledWithExactly('deploymentmanager', 'deployments', 'list', {

info/googleInfo.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ class GoogleInfo {
1515
Object.assign(this, validate, setDefaults, displayServiceInfo);
1616

1717
this.hooks = {
18-
'before:info:info': () =>
19-
BbPromise.bind(this)
20-
.then(this.validate)
21-
.then(this.setDefaults),
18+
'before:info:info': () => BbPromise.bind(this).then(this.validate).then(this.setDefaults),
2219

2320
'deploy:deploy': () => BbPromise.bind(this).then(this.displayServiceInfo),
2421

info/lib/displayServiceInfo.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ const _ = require('lodash');
88

99
module.exports = {
1010
displayServiceInfo() {
11-
return BbPromise.bind(this)
12-
.then(this.getResources)
13-
.then(this.gatherData)
14-
.then(this.printInfo);
11+
return BbPromise.bind(this).then(this.getResources).then(this.gatherData).then(this.printInfo);
1512
},
1613

1714
getResources() {
@@ -36,7 +33,7 @@ module.exports = {
3633
functions: [],
3734
};
3835

39-
_.forEach(resources.resources, resource => {
36+
_.forEach(resources.resources, (resource) => {
4037
if (resource.type === 'gcp-types/cloudfunctions-v1:projects.locations.functions') {
4138
const serviceFuncName = getFunctionNameInService(
4239
resource.name,
@@ -83,7 +80,7 @@ module.exports = {
8380
// get all the functions
8481
message += `${chalk.yellow.underline('Deployed functions')}\n`;
8582
if (data.resources.functions.length) {
86-
data.resources.functions.forEach(func => {
83+
data.resources.functions.forEach((func) => {
8784
message += `${chalk.yellow(func.name)}\n`;
8885
message += ` ${func.resource}\n`;
8986
});

info/lib/displayServiceInfo.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('DisplayServiceInfo', () => {
126126
},
127127
};
128128

129-
return googleInfo.gatherData(resources).then(data => {
129+
return googleInfo.gatherData(resources).then((data) => {
130130
expect(data).toEqual(expectedData);
131131
});
132132
});
@@ -146,7 +146,7 @@ describe('DisplayServiceInfo', () => {
146146
},
147147
};
148148

149-
return googleInfo.gatherData(resources).then(data => {
149+
return googleInfo.gatherData(resources).then((data) => {
150150
expect(data).toEqual(expectedData);
151151
});
152152
});

invoke/googleInvoke.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ class GoogleInvoke {
1515
Object.assign(this, validate, setDefaults, invokeFunction);
1616

1717
this.hooks = {
18-
'before:invoke:invoke': () =>
19-
BbPromise.bind(this)
20-
.then(this.validate)
21-
.then(this.setDefaults),
18+
'before:invoke:invoke': () => BbPromise.bind(this).then(this.validate).then(this.setDefaults),
2219

2320
'invoke:invoke': () => BbPromise.bind(this).then(this.invokeFunction),
2421
};

invoke/lib/invokeFunction.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ const chalk = require('chalk');
77

88
module.exports = {
99
invokeFunction() {
10-
return BbPromise.bind(this)
11-
.then(this.invoke)
12-
.then(this.printResult);
10+
return BbPromise.bind(this).then(this.invoke).then(this.printResult);
1311
},
1412

1513
invoke() {

logs/googleLogs.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ class GoogleLogs {
2727
Object.assign(this, validate, setDefaults, retrieveLogs);
2828

2929
this.hooks = {
30-
'before:logs:logs': () =>
31-
BbPromise.bind(this)
32-
.then(this.validate)
33-
.then(this.setDefaults),
30+
'before:logs:logs': () => BbPromise.bind(this).then(this.validate).then(this.setDefaults),
3431

3532
'logs:logs': () => BbPromise.bind(this).then(this.retrieveLogs),
3633
};

logs/lib/retrieveLogs.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ const chalk = require('chalk');
77

88
module.exports = {
99
retrieveLogs() {
10-
return BbPromise.bind(this)
11-
.then(this.getLogs)
12-
.then(this.printLogs);
10+
return BbPromise.bind(this).then(this.getLogs).then(this.printLogs);
1311
},
1412

1513
getLogs() {

package/googlePackage.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ class GooglePackage {
3737
'package:cleanup': () => BbPromise.bind(this).then(this.cleanupServerlessDir),
3838

3939
'before:package:initialize': () =>
40-
BbPromise.bind(this)
41-
.then(this.validate)
42-
.then(this.setDefaults),
40+
BbPromise.bind(this).then(this.validate).then(this.setDefaults),
4341

4442
'package:initialize': () =>
4543
BbPromise.bind(this)
@@ -53,9 +51,7 @@ class GooglePackage {
5351
'package:compileFunctions': () => BbPromise.bind(this).then(this.compileFunctions),
5452

5553
'package:finalize': () =>
56-
BbPromise.bind(this)
57-
.then(this.mergeServiceResources)
58-
.then(this.saveUpdateTemplateFile),
54+
BbPromise.bind(this).then(this.mergeServiceResources).then(this.saveUpdateTemplateFile),
5955
};
6056
}
6157
}

package/lib/compileFunctions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
this.serverless.service.provider.region || 'us-central1';
1717
this.serverless.service.package.artifactFilePath = `${this.serverless.service.package.artifactDirectoryName}/${fileName}`;
1818

19-
this.serverless.service.getAllFunctions().forEach(functionName => {
19+
this.serverless.service.getAllFunctions().forEach((functionName) => {
2020
const funcObject = this.serverless.service.getFunction(functionName);
2121

2222
this.serverless.cli.log(`Compiling function "${functionName}"...`);

package/lib/prepareDeployment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const updateBucketName = (bucket, name) => {
3636
return newBucket;
3737
};
3838

39-
const findDeploymentBucket = resource => {
39+
const findDeploymentBucket = (resource) => {
4040
const type = 'storage.v1.bucket';
4141
const name = 'will-be-replaced-by-serverless';
4242

provider/googleProvider.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class GoogleProvider {
5959
object,
6060
alt: 'media',
6161
})
62-
.catch(err => {
62+
.catch((err) => {
6363
throw new Error(`Error getting value for ${variableString}. ${err.message}`);
6464
});
6565
}
@@ -68,7 +68,7 @@ class GoogleProvider {
6868
// grab necessary stuff from arguments array
6969
const lastArg = arguments[Object.keys(arguments).pop()]; //eslint-disable-line
7070
const hasParams = typeof lastArg === 'object';
71-
const filArgs = _.filter(arguments, v => typeof v === 'string'); //eslint-disable-line
71+
const filArgs = _.filter(arguments, (v) => typeof v === 'string'); //eslint-disable-line
7272
const params = hasParams ? lastArg : {};
7373

7474
const service = filArgs[0];
@@ -86,8 +86,8 @@ class GoogleProvider {
8686
return filArgs
8787
.reduce((p, c) => p[c], this.sdk)
8888
.bind(serviceInstance)(requestParams)
89-
.then(result => result.data)
90-
.catch(error => {
89+
.then((result) => result.data)
90+
.catch((error) => {
9191
if (
9292
error &&
9393
error.errors &&

provider/googleProvider.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe('GoogleProvider', () => {
109109
googleProvider.sdk.service.resource.method.bind = () =>
110110
sinon.stub().resolves({ data: 'result' });
111111

112-
return googleProvider.request('service', 'resource', 'method', {}).then(result => {
112+
return googleProvider.request('service', 'resource', 'method', {}).then((result) => {
113113
expect(result).toEqual('result');
114114
});
115115
});

remove/googleRemove.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ class GoogleRemove {
3333
.then(this.setDeploymentBucketName),
3434

3535
'remove:remove': () =>
36-
BbPromise.bind(this)
37-
.then(this.emptyDeploymentBucket)
38-
.then(this.removeDeployment),
36+
BbPromise.bind(this).then(this.emptyDeploymentBucket).then(this.removeDeployment),
3937
};
4038
}
4139
}

0 commit comments

Comments
 (0)