Questions tagged [angular-schematics]

Schematics is a workflow tool for the modern web; it can apply transforms to your project, such as create a new component, or updating your code to fix breaking changes in a dependency. Or maybe you want to add a new configuration option or framework to an existing project. Angular schematics are part of angular-cli and are used to generate components, modules, pipes, etc.

179 questions
2
votes
2 answers

Angular Schematics Skip "implements OnInit"

I've found plenty about how to setup my schematic file to skip certain things (like the spec file) when creating a component using ng generate but what I can't find anywhere is how to not include the implements OnInit when I use ng generate…
Brad
  • 722
  • 2
  • 8
  • 24
2
votes
0 answers

Angular asynchronous Schematics stop working after migrating to Angular 9: A rule can't return a Tree or an Observable anymore

I have a function with the ability to call out to a service and use the resulting data object response from the service to be used to generate the CRUD code necessary to interact with that endpoint. So I created an asynchronous Schematic that would…
igogra
  • 415
  • 1
  • 5
  • 18
2
votes
0 answers

How to run schematics migration manually (from node_modules)

We have multiple long living branches (per team) next to develop. Now, if a team runs the schematics migrations from a library and update their code, it's possible that a different team (on a different branch) has new features that aren't updated by…
sandrooco
  • 8,016
  • 9
  • 48
  • 86
2
votes
0 answers

Using `ng add @ngrx/store` on Angular 10 gives error and adds Old version of ngrx

On using the command ng add @ngrx/store, I am getting the below attached error. However, the @ngrx package that gets installed is an old one "@ngrx/store": "^1.5.0",. My package.json is: // ...other packages "dependencies": { …
RICHARD ABRAHAM
  • 2,218
  • 20
  • 26
2
votes
1 answer

Angular Schematics: Error when running unit test in library

This is my first time working in the world of schematics, so it's quite possible I just don't have this set up correctly. But I've been following the guide on angular.io and some additional blog walkthroughs. I'm wanting to package ng-add and…
mfaith
  • 115
  • 3
  • 11
2
votes
1 answer

Create a custom Angular schematics that generates a file starting with underscore?

I have the following problem related to the custom Angular schematics file name. I want to create a theme scss file that starts with underscore and immediately after it I want to use a double underscore as a delimiter which separates name variable…
2
votes
2 answers

Angular Schematics - add library to NgModule imports

When using Schematics to generate components in Angular, it will attempt to import the newly generated component into the NgModule, this is mandatory in order for the component to work and saves time. However, when creating my own schematics, I am…
anderio Moga
  • 425
  • 7
  • 11
2
votes
4 answers

Angular schematic is not creating files from templates

I've created an angular schematic for the purposes of creating boilerplate code with an ng generate command, however despite all the articles I've read through and messing about, I cannot get the files to create. I've the following code in my…
2
votes
0 answers

How format html code in angular schematic?

I created a custom schematics, everything is working perfectly, but the html code is not formatted.
<% for (let formObject of htmlData) { %>
user3516604
  • 347
  • 3
  • 9
2
votes
0 answers

how to add a node import statement to a file with angular schematics?

I want a custom schematic that will create a page in my application. To do this, I want to use the existing core schematics to create a routing module, then create a component in that module to display my page content, and finally wire everything…
Nathaniel
  • 21
  • 2
2
votes
4 answers

Angular Schematics relative path

I would like to create a custom schematic for Angular that will create a file in the same directory as the schematic was executed from. I followed this article, but I'm not sure how I would get the new file to be added in the desired directory.…
efarley
  • 8,371
  • 12
  • 42
  • 65
2
votes
0 answers

Can Angular schematics read files outside the main directory?

I want to create a file outside of the directory where the dependency for a custom schematics is (probably write a file there also) For example: / /directory_1/package.json => has the schematics dependency /other_dir/file_to_read.txt => this is…
Ricardo Daniel
  • 421
  • 7
  • 15
2
votes
2 answers

How to create a custom schematic to build a new angular project

I'm trying to create a new schematic that can run without first doing an "ng new project-name" and then running "ng g my-schematic" When I even run my schematic locally, I have to first set my defaultCollection of my CLI to my schematic, which…
2
votes
0 answers

Testing Angular Schematic Changes

I am trying to test my schematic, which requires some initial setup of other schematics (creating a workspace and application) and I want to see only the changes that my schematic makes (not the changes to everything) Setup: // Create the…
jamesthollowell
  • 1,550
  • 15
  • 21
2
votes
0 answers

Why does the Angular CLI prompt stopped working when initializing a new project?

I have just installed Angular CLI. When I run ng new project-name on my command line, I get a prompt asking about installations of angular-router and CSS setup. However when I run the same command to create other projects, I no longer have the…