Update dependency-resolver.js (#286)
When cloning a project in a Windows environment, Git may automatically convert line endings from `\n` to `\r\n`. This can cause a mismatch in the `yaml` configuration, leading to a build failure. To resolve this, a step has been added to enforce the replacement of `\r` characters, ensuring the build can proceed normally.
This commit is contained in:
@@ -15,7 +15,7 @@ class DependencyResolver {
|
|||||||
const agentContent = await fs.readFile(agentPath, 'utf8');
|
const agentContent = await fs.readFile(agentPath, 'utf8');
|
||||||
|
|
||||||
// Extract YAML from markdown content
|
// Extract YAML from markdown content
|
||||||
const yamlMatch = agentContent.match(/```ya?ml\n([\s\S]*?)\n```/);
|
const yamlMatch = agentContent.replace(/\r/g, "").match(/```ya?ml\n([\s\S]*?)\n```/);
|
||||||
if (!yamlMatch) {
|
if (!yamlMatch) {
|
||||||
throw new Error(`No YAML configuration found in agent ${agentId}`);
|
throw new Error(`No YAML configuration found in agent ${agentId}`);
|
||||||
}
|
}
|
||||||
@@ -191,4 +191,4 @@ class DependencyResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = DependencyResolver;
|
module.exports = DependencyResolver;
|
||||||
|
|||||||
Reference in New Issue
Block a user