<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Erich Schutz on Medium]]></title>
        <description><![CDATA[Stories by Erich Schutz on Medium]]></description>
        <link>https://medium.com/@erichschutz?source=rss-40bcc431fa21------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Erich Schutz on Medium</title>
            <link>https://medium.com/@erichschutz?source=rss-40bcc431fa21------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 23:19:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@erichschutz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Generating An Enterprise Application Template with the Angular CLI and Schematics]]></title>
            <link>https://medium.com/omnicell-engineering/generating-an-enterprise-application-template-with-the-angular-cli-and-schematics-e59b26b6d828?source=rss-40bcc431fa21------2</link>
            <guid isPermaLink="false">https://medium.com/p/e59b26b6d828</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[schematics]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Erich Schutz]]></dc:creator>
            <pubDate>Tue, 05 Feb 2019 19:05:08 GMT</pubDate>
            <atom:updated>2019-02-05T19:05:08.383Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hehAyv0-DjAWiPCi" /><figcaption>Photo by <a href="https://unsplash.com/@sxoxm?utm_source=medium&amp;utm_medium=referral">Sven Mieke</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This blog post is part of an article series.</p><p><strong>Part 1</strong>: Setting up an enterprise project template.</p><p><strong>Part 2</strong>: Adding common enterprise functionality.</p><p><strong>Part 3</strong>: Distributing the enterprise project template with Artifactory.</p><p>This article assumes some familiarity with Angular Schematics. Here are some good resources to get up to speed.</p><p><a href="https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2"><em>Getting started schematics blog post by Hans</em></a></p><p><a href="https://brianflove.com/2018/12/11/angular-schematics-tutorial/"><em>Brian Love’s Angular Schematics Tutorial</em></a></p><p><a href="https://leanpub.com/angular-schematics"><em>Schematics by Manfred Steyer</em></a></p><p><strong>Goal</strong></p><p>To demonstrate how to write an enterprise application template from scratch, Over a series of posts, we are going to build a project template that include some default project layout and enterprise functionality using Angular Schematics.</p><p><strong>Getting Started</strong></p><p>Before creating a schematic generator it is a good idea to have an existing solution that contains the code you want to generate in all variations. For this post we want to start building our enterprise project template with some common modules we would expect would be needed when starting a typical Angular application. Below is an image of what we will be building towards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*CjuMxo_BbZ_HHtmU9w0KsQ.png" /></figure><p>To start our enterprise project template we are going to create a schematic to generate this project template. We’ll add to this base project template over the course of the next few posts.</p><p>Our first step in building our enterprise template we want to install the schematics CLI via npm.</p><pre>$ npm install -g @angular-devkit/schematics-cli</pre><p>Now that we have the schematics CLI installed, lets generate our enterprise project schematics via:</p><pre>$ schematics blank --name=project-template</pre><p>This command is used to either create a new project or add a blank schematic to an existing project. In this case we are creating a new project.</p><p>The next steps are to $ cd into the project-template folder you just created and $ npm install then open the project in you IDE, i.e. code .</p><pre>$ cd project-template<br>$ npm install<br>$ code .</pre><p>Our first step in creating our schematic is to update the collection.json file. The collection.json file is the schematic’s definition.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8de079591cb6b8ef4d847b0454be73ab/href">https://medium.com/media/8de079591cb6b8ef4d847b0454be73ab/href</a></iframe><p>The next step is to add our schema.json file to the schematic in the src folder add schema.json. The schema.json file is the schematic variable definition.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/32711f088c6cdaf4184251ffb3bd4662/href">https://medium.com/media/32711f088c6cdaf4184251ffb3bd4662/href</a></iframe><p>Once we have our schema in place, let’s add the files we went to copy over when we start a new application. In the src/project-template folder add a files folder. The files we add here will be the template files to replicate. Next we’ll add the Angular modules core, shared and static and a new app.module.ts file that imports the core module. Your project should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*GCO7J44B3u9zntmuotfc7A.png" /></figure><p>Next we will update the index.ts file. The index.ts contains the actual schematic code. This is the logic that will execute adding our enterprise template files to a new project. Before we do this, let add a utils folder to src/utils to hold a few utility items we’ll need. Lets now add a schema.d.ts file in the utils . The schema.d.ts will hold our schematic variables.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d103498032817c20efd0e2628cc2eb30/href">https://medium.com/media/d103498032817c20efd0e2628cc2eb30/href</a></iframe><p>Next we’ll need to install the core Angular schematics. We are going to use this to get our current work space.</p><pre>$npm install @schematics/angular</pre><p>And finally our index.ts file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5e7b78232e79cd90fb110a3c85d4efd/href">https://medium.com/media/d5e7b78232e79cd90fb110a3c85d4efd/href</a></iframe><p>Our rule is pretty simple as this point. We are deleting the default app.module.ts and replacing it with the one we added to our /files folder and we are copying over the modules we added to our /files folder and that’s about it. We’ll add more to this in the next post, but this is a good starting point. Its now time to build our schematic. $ cd into the project-template folder and run</p><pre>$ npm run build</pre><p>With our project now built, it’s time to test it out and link it to a new project. We’ll start by creating a new Angular project:</p><pre>$ ng new my-project</pre><p>Once the CLI is complete setting up the project, let’s link our new schematic to test it out. First $ cd into the new my-project and run</p><pre>$ npm link $PATH_TO_PROJECT_TEMPLATE_SCHEMATIC</pre><p>With our new schematic linked, lets generate our enterprise project template</p><pre>$ ng g project-template:project-template</pre><p>After this completes we should see our new project updated with the core, shared and static modules we added to our schematic along with our app.module.ts update to include our new core module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gERcG3KfyojbJnrS9u92AA.gif" /></figure><p>That’s it, we just applied the first step in building our enterprise project template. In the next post, we’ll update this process a bit and add some common enterprise functionality that we will want to include in all our future applications.</p><p>Schematic on <a href="https://github.com/Steeze/project-template">GitHub</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e59b26b6d828" width="1" height="1" alt=""><hr><p><a href="https://medium.com/omnicell-engineering/generating-an-enterprise-application-template-with-the-angular-cli-and-schematics-e59b26b6d828">Generating An Enterprise Application Template with the Angular CLI and Schematics</a> was originally published in <a href="https://medium.com/omnicell-engineering">Omnicell-Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>