angularangular-schematics

Angular schematics - how to set a constant name


I'm trying to create schematics to create an Angular service with a constant name that should not be changed by the user.

I've removed all of the references to the 'name' variable but when I try to use it I'm getting an error -

Option "name" is not defined.

enter image description here

schema.json:

{
    "$schema": "http://json-schema.org/schema",
    "$id": "SchematicNgGenerateMyService",
    "title": "ng generate my-service",
    "type": "object",
    "properties": {},
    "required": []
}

Is the name variable mandatory? any suggestion on how to override it?

Thanks


Solution

  • I resolved the issue. The problem was the dist folder was not removed before the build so some files that had already been renamed to a name that did not require the 'name' parameter weren't removed.