0

function looks like this:

I am using first time nestjs for generators, it seems like i have some issue in collection.json

export function application(options: any) {
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  return (_tree: Tree, _context: SchematicContext) => {
    return chain([
      externalSchematic('@nestjs/schematics', 'application', options),
      generate(options),
    ]);
  };
}
export function generate(_options: any): Rule {
  return (tree: Tree, context: SchematicContext) => {
    return chain([
      addDependencies(tree, _options),
      renderTemplates(_options),
      modifyGeneratedFiles(_options),
    ])(tree, context);
  };
} 

collection.json file looks like this.

  "schematics": {

    "resolver": {

      "description": "Nodejs GraphQL project scaffold",

      "factory": "./resolver-generator/index#application",

      "schema": "./resolver-generator/resolver-schema.json"

    },

    "rest": {

      "description": "Nodejs Rest generator project scaffold",

      "factory": "./rest-generator/index#applicationRest",

      "schema": "./rest-generator/rest-schema.json"

    }
Krish909
  • 77
  • 2
  • 12
  • we don't know which operation triggers that error. Share us more info. – Micael Levi Dec 09 '22 at 20:12
  • @MicaelLevi let me know what more information you need i will modify the files. – Krish909 Dec 09 '22 at 20:14
  • what did you ran to got that error? that's not clear to me. It was a command from nestjs's CLI or what? which command? – Micael Levi Dec 11 '22 at 03:54
  • @MicaelLevi Thank you for help i am able to solve it, it was happening bcoz of wrong function name when we use nestjs/schematics we have to pass application not applictionRest – Krish909 Dec 11 '22 at 04:37
  • @MicaelLevi, just a ignorant question, how can i take the name from the input command and use to generate all the files on that bases, like nest g resource do, Kindly let me know if there is any reference or documentation. thank you! – Krish909 Dec 11 '22 at 05:10

1 Answers1

0

Thank you for help i am able to solve it, it was happening bcoz of wrong function name when we use nestjs/schematics we have to pass application not applictionRest

Krish909
  • 77
  • 2
  • 12