elzoy
elzoy

Reputation: 5435

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 project my-project to be treated as a root for schematics? After creating blank schematic, I'd like to have:

my-project
  node-modules
  src
    schematics (directory for schematics)
    app

I'm, the schematic is supposed to be added to the project instead of creating a new project.

Upvotes: 3

Views: 1006

Answers (1)

Chhirag Kataria
Chhirag Kataria

Reputation: 288

Your schematic would be a separate project — schematics are supposed to be hermetic, and they are created keeping in mind that very fact. So even if you want to use your schematics only for your one project, create a separate folder for your schematics, build it, and use npm link to link this schematic to your project. Else you could publish your schematic and use npm install schematic to your project.

If you need to use your project folder structure, you will have to create that in your schematic project — note: you can use angular schematics to create an app, then use externalSchematic to call the generate app and modify using your own logic :) hope this helps!

Upvotes: 3

Related Questions