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
4
votes
1 answer

Custom schematics in Angular/CLI 6.x builds without errors but I cannot use it to generate files

I've created a few schematics before, before Angular 6.0. The same steps I did in Angular 5.x now always leads to the error schematic 'my-schematic' not found in collection @schematics/angular when I try to generate some code on a hosting…
Mickael Caruso
  • 8,721
  • 11
  • 40
  • 72
3
votes
1 answer

How to remove empty folders or delete directories in a tree using Angular Schematics?

I am trying to delete a folder with files using Tree.delete. Unfortunately there's an error if you're trying to delete a directory. So, I created a function that recursively removes the files using Tree.getDir and the underlying APIs. In the end, I…
JB Reyes
  • 31
  • 1
3
votes
1 answer

Angular Schematics - Apply thounsand of change on tree cause error Maximum call stack size exceeded

I try to migrate a big AngularJs project to Angular. I found the Angular Schematics to be a good way to automate some tasks. My first task is to create components for each folder and I have about 1200 components to create. My function look like…
FatAl
  • 859
  • 1
  • 6
  • 20
3
votes
0 answers

Angular 9 and @ngrx/store schematics

Trying to use the schematics install for @ngrx/store but the installation keeps failing saying: The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to…
Nicholas Pesa
  • 2,156
  • 2
  • 24
  • 45
3
votes
0 answers

Angular Schematics - Could not find (undefined) at Object.getWorkspace

i am trying to create a simple Schematics that read all template-files in my "./files/xxx" and copy the parsed ones into my angular app. I am struggling with the following error: Error: Could not find (undefined) at Object.getWorkspace…
markus988
  • 31
  • 1
3
votes
2 answers

How to use current path in Angular schematics

I'm developing a schematic which produces some files. I'd like to have new files in current directory, i.e. My project root is /src/app. When I am in folder /src/app/features/f1, and type ng g my:some-schemaitc --name=name I am expecting new…
Walter Luszczyk
  • 1,369
  • 2
  • 19
  • 36
3
votes
2 answers

How to call ng add from an external schematic

I need assistance in calling an ng add for an external angular schematic. (I'm trying to add ng-momentum: https://github.com/BottleRocketStudios/ng-momentum) I am trying to call "ng add ng-momentum" from a custom CLI, but I've run into issues where…
TrevorR
  • 31
  • 4
3
votes
1 answer

How to extend default angular schematics "ng generate component"

I need to generate additional stub-* file for each generated component for usage during testing. How can I do that? I understand that I can create my own schematics by copying default one, buy can I avoid that and gracefully extend default one with…
Konstantin Vahrushev
  • 1,110
  • 2
  • 11
  • 20
3
votes
2 answers

Custom Angular Schematic: Pipe "dasherize" is not defined. when run on angular project

I created a simple new schematic using the angular schematics cli. This schematic takes as input a name, and generates a file in the tree. My files/ directory looks like: src/ app/ __name@dasherize__.ts I've built it, and then created a new…
MarkD
  • 4,864
  • 5
  • 36
  • 67
3
votes
1 answer

Angular schematics - existing project

I've created a project long time ago using angular cli. If I wan't to create a schematic inside, it is being created as a new project so it looks like: my-project node-modules simple-schematic node-modules How could I integrate my existing…
elzoy
  • 5,237
  • 11
  • 40
  • 65
3
votes
2 answers

Angular Schematics: trustedSubscriber._addParentTeardownLogic

I'm trying to build an Angular Schematics to help me and my team create NgRx actions fast. This is the schematics function, most of it is copied from various tutorials: export default (options: CCSchematicsAction): Rule => { return (tree: Tree,…
Giacomo Voß
  • 997
  • 8
  • 17
3
votes
5 answers

How to create a mono-repo project structure with angular-cli (6.x)

I'd like to use the angular-cli to generate a new workspace The only way to do this at the moment is to run: ng new asdf cd asdf ng g application whatever but then all of the src/ files remain (and the original angular.json info for a project that…
martzcodes
  • 404
  • 5
  • 16
2
votes
1 answer

How to perform standalone migration in multi-workspace (with Angular schematics)

In a multi-project Angular repo, I could not manage to get the @angular/core:standalone-schematics to work (this allows an automatic conversion of module-based components to standalone components). client projects proj1 proj2 When I run…
hoeni
  • 3,031
  • 30
  • 45
2
votes
0 answers

Angular Schematic - Change execution scope or directory after calling the ng-new schematic

I have an angular schematic where I create a new project, then call ng-add to add a package to that new project. It looks like this: export function createProject(options) { return () => { return chain([ …
mccow002
  • 6,754
  • 3
  • 26
  • 36
2
votes
0 answers

Error: Schematic input does not validate against the Schema: {...}, Data path "" must NOT have additional properties(...)

I am creating custom schematics, which I want to use to generate component files in a separate Angular project. For this purpose I am using conditional templates relying on optional parameters declared in my schema.json file. The problem is that…
koilami
  • 21
  • 1
  • 3
1 2
3
11 12