Dinghy is a robust library designed to generate Abstract Syntax Trees (ASTs) for both shell scripts and Dockerfiles. It offers developers a solution for parsing and analyzing these files, facilitating advanced automation and analysis tasks.
For detailed documentation, please visit https://durieux.me/Dinghy/.
npm install @tdurieux/dinghy
import dinghy from "@tdurieux/dinghy";
// Parse Dockerfile
const dockerAST = dinghy.parseDocker(/* file path or file content */);
dockerAST.traverse((node) => {
if (node instanceof dinghy.AbstractValueNode) {
console.log(node.value);
}
});
// Parse Shell Script
const shellAST = dinghy.parseShell(/* file path or file content */);
shellAST.traverse((node) => {
if (node instanceof dinghy.AbstractValueNode) {
console.log(node.value);
}
});
Additional examples are available in the library's test suite.
Contributions to Dinghy are welcome! Whether it's bug fixes, new features, or documentation improvements, feel free to submit pull requests on our GitHub repository.
Dinghy is licensed under the MIT License. See the LICENSE file for details.
Happy Coding with Dinghy!
Generated using TypeDoc