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.


I was able to register an executor, but it is not supported, as I am using a private field. Here is what you need to do:

const host = <NodeModulesEngineHost>(<any>context.engine)._host; // this line is not supported
  name: "your-executor-name",
  create: (opt) => import('../path/to/executor').then(mod => mod.default(opt))

You can see on Github how to create the task executor registration, and then it is later actually registered here.

Answered By – Giovanni Bassi

Answer Checked By – Senaida (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.