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
123
votes
33 answers

Generating Component without spec.ts file in Angular 2+

Is there a way to get rid of the spec.ts file in Angular 2+, whenever I create a new component. I know this is for testing purpose but what if I don't need it. May be there is some setting to disable this specific testing file.
saadeez
  • 1,588
  • 3
  • 11
  • 17
15
votes
5 answers

How to overwrite file with angular schematics?

I want to write a Rule that overwrites a file every time. In the following and have MergeStrategy set to Overwrite: collection.json { "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", "schematics": { "function":…
Wilhelmina Lohan
  • 2,803
  • 2
  • 29
  • 58
13
votes
5 answers

How to run @angular-eslint/schematics:convert-tslint-to-eslint

I'm trying to switch an Angular project from TSLint to ESLint, following the instructions in angular-eslint Github repo. I ran ng add @angular-eslint/schematics which added the following dependencies to my package.json: …
Rene Saarsoo
  • 13,580
  • 8
  • 57
  • 85
12
votes
3 answers

Angular 14: Error: A collection and schematic is required during execution

I am trying to learn angular. I installed the lastest version and created an app called test using ng new test command. Then I opened the app in visual studio code. In the terminal I entered the following command to create a new component: ng g…
Nazir
  • 155
  • 1
  • 2
  • 7
11
votes
2 answers

Empty style (.css/.scss) files

When I create Angular application, I am using CLI for generating components. After certain time of developing app I have style file for every component but major part of them are empty. When I check sonar I have Code smells in empty style…
Gregor Albert
  • 819
  • 1
  • 11
  • 23
10
votes
3 answers

How to modify a HTML file with angular schematics

Let's say we have an existing angular component including menu.component.html : The goal is to add a new link with angular schematics, just after "about"
  • user4649102
    • 463
    • 6
    • 13
  • 10
    votes
    2 answers

    angular-cli custom schematics / collection

    I'm trying to create custom schematics for angular cli. So far I have figured out that "collection" has to be compiled, cli cannot read typescript. Which means you can not just clone…
    fxck
    • 4,898
    • 8
    • 56
    • 94
    8
    votes
    0 answers

    angular schematics generates blank lines in template, how to prevent it?

    I have ng schematics template __name@dasherize__.component.html with content : <% for (let row of getComponents().rows) { %>
    <% for (let field of row.fields) { %> <% if (field.type === 'InputString') { %>
    user1063364
    • 791
    • 6
    • 21
    8
    votes
    1 answer

    Angular schematics conditional property/prompt

    I'm working on creating my own schematics. This schematics will be responsible for creating a component (container) with some code. Template of this component will contain a few other components. One of this component will be banner component that…
    rafcik
    • 81
    • 2
    7
    votes
    1 answer

    How to enter array type value for angular schematics

    I'm learning Angular Schematics and have some problems regarding array type input. When I am prompted to enter a value and press enter the value disappears. What is the correct way of entering an array value? My schema.json is the following: { …
    Andy Zhang
    • 153
    • 5
    7
    votes
    1 answer

    Modules not found in shared code with Nativescript and Angular Schematics

    I'm using Angular with Nativescript Schematics. I have installed the nativescript-ui-sidedrawer. When i run tns run ios --bundle The native version is compiled and deployed to the device but when I run ng serve The web version fails with several…
    Mark Bell
    • 316
    • 5
    • 14
    7
    votes
    4 answers

    nrwl/nx Workspace-Specific Schematics

    I've been investigating the nrwl extensions and they look great. However, when I'm following their tutorial for Workspace Specific Schematics, the last step doesn't show me the command to run. Can you tell me how I run the schematic I created? I'm…
    Steve
    • 141
    • 2
    • 7
    6
    votes
    0 answers

    Custom Angular Schematics: how to modify files and create files in different locations/folders

    I've been creating a custom Angular Schematics following this article: https://medium.com/@tomastrajan/total-guide-to-custom-angular-schematics-5c50cf90cdb4 Now I'm trying to find out how to modify some files (for example app-routing.module.ts, to…
    igogra
    • 415
    • 1
    • 5
    • 18
    5
    votes
    0 answers

    Is there a way to use Nrwl Nx's AST utils for Angular in Nx >13

    I wrote a few generators that were working until I did a recent migration. I was importing and using Nrwl AST utils using import paths like: import { addImportToModule } from '@nrwl/angular/src/utils/nx-devkit/ast-utils'; At the time I think the…
    5
    votes
    0 answers

    How can I extend angular schematic properties?

    My question is it possible to extend schema properties? What I tried: collection.json { "$schema": "http://schema.angular.io/schematics/collection/2", "name": "@my/schematics", "description": "my default collection, containing all schematics…
    1
    2 3
    11 12