Skip to content

Commit

Permalink
fix(API): Ensure config.servicePath is config.serviceDir live alias
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Apr 21, 2021
1 parent aa89357 commit 2967065
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/Serverless.js
Expand Up @@ -33,7 +33,7 @@ class Serverless {

if (configObject.serviceDir != null) {
// Modern intialization way, to be the only supported way with v3
configObject.servicePath = this.serviceDir = path.resolve(
this.serviceDir = path.resolve(
ensureString(configObject.serviceDir, {
name: 'config.serviceDir',
Error: ServerlessError,
Expand Down Expand Up @@ -61,7 +61,7 @@ class Serverless {
Error: ServerlessError,
})
);
this.serviceDir = configObject.servicePath = process.cwd();
this.serviceDir = process.cwd();
this.configurationFilename = configurationPath.slice(this.serviceDir.length + 1);
this.configurationInput = ensurePlainObject(configObject.configuration, {
isOptional: true,
Expand Down Expand Up @@ -156,7 +156,7 @@ class Serverless {
if (this._shouldResolveConfigurationInternally) {
const configurationPath = await resolveConfigurationPath();
if (configurationPath) {
this.serviceDir = this.config.servicePath = process.cwd();
this.serviceDir = process.cwd();
this.configurationFilename = configurationPath.slice(this.serviceDir.length + 1);
}
}
Expand Down
8 changes: 8 additions & 0 deletions lib/classes/Config.js
Expand Up @@ -14,6 +14,14 @@ class Config {
update(config) {
return _.merge(this, config);
}

get servicePath() {
return this.serverless.serviceDir;
}

set servicePath(value) {
this.serverless.serviceDir = value;
}
}

module.exports = Config;
1 change: 0 additions & 1 deletion lib/plugins/create/create.js
Expand Up @@ -163,7 +163,6 @@ class Create {
}

this.serverless.serviceDir = process.cwd();
this.serverless.config.servicePath = process.cwd();

return createFromTemplate(this.options.template, process.cwd(), { name: serviceName }).then(
() => {
Expand Down

0 comments on commit 2967065

Please sign in to comment.