feat: prevent downloading empty config
This commit is contained in:
@@ -171,4 +171,22 @@ export class Config {
|
||||
cloned.template = this.template;
|
||||
return cloned;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if config is empty (no environments or only DEFAULT with no params and empty template)
|
||||
*/
|
||||
public isEmpty(): boolean {
|
||||
if (this.envs.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if only DEFAULT exists with no params
|
||||
if (this.envs.length === 1 && this.envs[0].name === 'DEFAULT') {
|
||||
const hasParams = this.envs[0].params.length > 0;
|
||||
const hasTemplate = this.template.content.trim() && this.template.content !== '{}';
|
||||
return !hasParams && !hasTemplate;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user