October 2018 Summaries
2 posts from Humanitec
Filter
Month:
Year:
Post Summaries
Back to Blog
Angular schematics is a powerful tool for auto-generating code and automating repetitive developer tasks in Angular applications. The lack of official documentation is the main challenge, but the author has compiled their findings to help others. The goal of this article is to simplify the concept of using schematics to add auto-generated code to TypeScript, HTML, and JSON files. By leveraging the TypeScript compiler API, the author demonstrates how to create a rule that modifies an existing TypeScript file by generating a new object in an array. The process involves creating a context, defining changes, and applying them to the tree. The author provides code examples and guidance on how to use schematics to automate tasks such as auto-generating code for Angular applications.
Oct 30, 2018
1,187 words in the original blog post.
Angular schematics provide a powerful way to modify and add auto-generated code to existing files in TypeScript, HTML, and JSON formats by leveraging the power of Angular's internal developer platform capabilities. By utilizing Angular's utility functions and tools such as cheerio for parsing HTML elements, developers can create custom rules to update these files efficiently. The process involves creating a new rule to generate code into an existing HTML file using an HTML parser like cheerio, and updating JSON files by leveraging Angular's built-in utility functions. With schematics, developers can automate repetitive tasks and streamline their development workflow, ultimately improving productivity and reducing errors.
Oct 30, 2018
672 words in the original blog post.