Skip to content

Commit 3261105

Browse files
committed
Update validation messages, and order Set up => validation
1 parent 6c9be4c commit 3261105

File tree

5 files changed

+38
-38
lines changed

5 files changed

+38
-38
lines changed

deploy/scalewayDeploy.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,54 +17,54 @@ class ScalewayDeploy {
1717
this.provider = this.serverless.getProvider('scaleway');
1818

1919
Object.assign(
20-
this,
21-
validate,
22-
setUpDeployment,
23-
createNamespace,
24-
createFunctions,
25-
createContainers,
26-
pushContainers,
27-
uploadCode,
28-
deployFunctions,
29-
deployContainers,
30-
namespaceUtils,
20+
this,
21+
validate,
22+
setUpDeployment,
23+
createNamespace,
24+
createFunctions,
25+
createContainers,
26+
pushContainers,
27+
uploadCode,
28+
deployFunctions,
29+
deployContainers,
30+
namespaceUtils,
3131
);
3232

3333
function chainContainers() {
34-
if (this.provider.serverless.service.custom &&
35-
this.provider.serverless.service.custom.containers &&
36-
Object.keys(this.provider.serverless.service.custom.containers).length !== 0) {
34+
if (this.provider.serverless.service.custom
35+
&& this.provider.serverless.service.custom.containers
36+
&& Object.keys(this.provider.serverless.service.custom.containers).length !== 0) {
3737
return this.createContainers()
38-
.then(this.pushContainers)
39-
.then(this.deployContainers)
38+
.then(this.pushContainers)
39+
.then(this.deployContainers);
4040
}
41-
};
41+
}
4242

4343
function chainFunctions() {
44-
if (this.provider.serverless.service.functions &&
45-
Object.keys(this.provider.serverless.service.functions).length !== 0) {
44+
if (this.provider.serverless.service.functions
45+
&& Object.keys(this.provider.serverless.service.functions).length !== 0) {
4646
return this.createFunctions()
47-
.then(this.uploadCode)
48-
.then(this.deployFunctions)
47+
.then(this.uploadCode)
48+
.then(this.deployFunctions);
4949
}
50-
};
50+
}
5151

5252
this.hooks = {
5353
// Validate serverless.yml, set up default values, configure deployment...
5454
'before:deploy:deploy': () => BbPromise.bind(this)
5555
.then(this.provider.initialize(this.serverless, this.options))
56-
.then(this.validate)
57-
.then(this.setUpDeployment),
56+
.then(this.setUpDeployment)
57+
.then(this.validate),
5858
// Every tasks related to functions deployment:
5959
// - Create a namespace if it does not exist
6060
// - Create each functions in API if it does not exist
6161
// - Zip code - zip each function
6262
// - Get Presigned URL and Push code for each function to S3
6363
// - Deploy each function / container
6464
'deploy:deploy': () => BbPromise.bind(this)
65-
.then(this.createNamespace)
66-
.then(chainContainers)
67-
.then(chainFunctions)
65+
.then(this.createNamespace)
66+
.then(chainContainers)
67+
.then(chainFunctions),
6868
};
6969
}
7070
}

provider/scalewayProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ScalewayProvider {
4343

4444
return new BbPromise((resolve) => {
4545
this.setCredentials(options);
46-
46+
4747
this.apiUrl = 'https://api.scaleway.com/functions/v1alpha2/regions/fr-par';
4848
this.apiManager = axios.create({
4949
baseURL: this.apiUrl,

remove/scalewayRemove.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ class ScalewayDeploy {
1111
this.provider = this.serverless.getProvider('scaleway');
1212

1313
Object.assign(
14-
this,
15-
setUpDeployment,
16-
removeNamespace,
17-
namespaceUtils,
18-
validate,
14+
this,
15+
setUpDeployment,
16+
removeNamespace,
17+
namespaceUtils,
18+
validate,
1919
);
2020

2121
this.hooks = {
2222
// Validate serverless.yml, set up default values, configure deployment...
2323
'before:remove:remove': () => BbPromise.bind(this)
2424
.then(this.provider.initialize(this.serverless, this.options))
25-
.then(this.validate)
26-
.then(this.setUpDeployment),
25+
.then(this.setUpDeployment)
26+
.then(this.validate),
2727
// Every tasks related to space deletion:
2828
// - Delete given space if it exists
2929
'remove:remove': () => BbPromise.bind(this)

shared/setUpDeployment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
setUpDeployment() {
3-
const service = this.provider.serverless.service;
4-
const provider = service.provider;
3+
const { service } = this.provider.serverless;
4+
const { provider } = service;
55
this.namespaceName = service.service;
66
this.namespaceVariables = provider.env || {};
77
this.runtime = provider.runtime;

shared/validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ module.exports = {
103103
throw new Error('File does not exists');
104104
}
105105
} catch (error) {
106-
const message = `Handler defined for function ${functionName} does not exist.`;
106+
const message = `Handler file defined for function ${functionName} does not exist (${func.handler}).`;
107107
functionErrors.push(message);
108108
}
109109
});

0 commit comments

Comments
 (0)