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

How to extend an existing angular schematic

I'd like to customize the ng g app schematic so that calling ng g app myapp will create myapp/src/environments/environment.ts file like so: import { environment as baseEnvironment } from '@myworkspace/environments/environment'; export const…
galki
  • 8,149
  • 7
  • 50
  • 62
2
votes
3 answers

Angular Schematics: Not found : my-schematic error

I build a simple Angular Schematics called: my-schematics. I able to add (using angular cli) my-schematics to some project. The problem when I run ng update my-schematics I got an error says: Not found : my-schematic. I'm not sure why. this is my…
jack bauer
  • 21
  • 5
2
votes
1 answer

Angular(7) extending schematics

I have several components for which I wrote some schematics for installing that components. For maintainability my schematics are in a separate package. After merging my schematics from Angular6 to Angular7 my schematics cannot be found. So in my…
2
votes
2 answers

How can I create a task for schematics?

Angular schematics has some tasks. I want to create my own task to run with the script executor. An example of how angular does this. At the moment I just spawn predefined tasks at the end of the schematic.
teabagp
  • 33
  • 3
2
votes
1 answer

Install angular schematics on mac: command not found

I'm trying to install the schematics-cli for angular on a mac (sierra 10.12.6) but I get command not found errors when I try to run it in the command line. I install it globally with: npm install -g @angular-devkit/schematics-cli and can see it…
braaannigan
  • 594
  • 4
  • 12
2
votes
2 answers

How to target filepath in custom Angular Schematics?

I am currently trying to create my own custom Angular Schematics. I have the following: import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; // You don't have to export the function as default. You can also have more than…
Charlie-Greenman
  • 1,469
  • 1
  • 16
  • 36
2
votes
3 answers

Print custom schematics logs in angular-cli

I'm writing custum angular upgrade schematics. The SchematicContext contains a logger object which can be usefull to debug. context.logger.debug('This logger seems to be usefull!'); Running angular-cli, my code is executed but I can't see the…
antoine
  • 93
  • 7
1
vote
0 answers

In angular, does ng generate keep path info?

This question is more about how deep inside ng generate command works. I am using Visual Studio Code to develop an Angular project. I am generating components and services using the terminal section of the IDE itself. So, I created a service using…
sanjeev
  • 458
  • 1
  • 6
  • 15
1
vote
0 answers

Can an Angular schematic execute logic outside of the directory from where it ran

I've created an Angular schematic that needs to create a bunch of files outside of the root directory i.e. ../../root. when trying to run the schematic locally I keep getting a CLI warning: The 'path' option in…
Jnr
  • 1,504
  • 2
  • 21
  • 36
1
vote
0 answers

How to print help form Schematics?

Is there a built-in method for printing formatted CLI help message using Angular Schematics. I'm thinking of something something like Yargs would produce, for example. schematics @my-schematic --help The "--help" option just prints the help of the…
user2297996
  • 1,382
  • 3
  • 18
  • 28
1
vote
0 answers

Problem with Angular Schematics Tree persisting in local file system before executing command

I'm using @angular-devkit/schematics to create a schematic for my NodeJS projects. The schematic is really simple. It just needs to add husky to the devDependencies of the project along with the script prepare: husky install, and then run the…
1
vote
0 answers

How to add a dev dependency with angular schematics extending from ng-new

I need to add dev dependencies when i use ng-new external schematic I tried many things but right now the most successful one is the this: context.addTask( new NodePackageInstallTask({ workingDirectory: `./${options.name}`, …
1
vote
0 answers

Add to bootstrapApplication in Angular 14 schematic

With Angular 14 and standalone components, the app.module.ts can go away and instead something like this goes in main.ts instead: bootstrapApplication(AppComponent, { providers: [ importProvidersFrom(HttpClientModule) ] }) I'm trying to…
Gargoyle
  • 9,590
  • 16
  • 80
  • 145
1
vote
3 answers

Angular schematics exception: "NOT SUPPORTED: keyword "id", use "$id" for schema ID"

I have a custom schematic that won't apply to a new project... I also looked at this question but I couldn't make it work... My main workspace runs with this configuration: Angular CLI: 13.2.3 Node: 16.13.0 Package Manager: npm 7.24.2 OS: win32…
1
vote
0 answers

Upgrading to Angular 13 with NX monorepo broke custom ng schematics

I'm extending @nrwl/schematics to create a custom Angular component schematic. After running nx migrate latest, npm i, then nx migrate --run-migrations=migrations.json, I get the following error when attempting to generate a new component: NOT…