mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
32 lines
655 B
JavaScript
32 lines
655 B
JavaScript
import _ from 'lodash';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
let __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
class Config {
|
|
constructor(serverless, config) {
|
|
if (__dirname.endsWith('dist')) {
|
|
__dirname = path.join(__dirname, '../lib/classes');
|
|
}
|
|
this.serverless = serverless;
|
|
this.serverlessPath = path.join(__dirname, '..');
|
|
|
|
if (config) this.update(config);
|
|
}
|
|
|
|
update(config) {
|
|
return _.merge(this, config);
|
|
}
|
|
|
|
get servicePath() {
|
|
return this.serverless.serviceDir;
|
|
}
|
|
|
|
set servicePath(value) {
|
|
this.serverless.serviceDir = value;
|
|
}
|
|
}
|
|
|
|
export default Config;
|