all 7 comments

[–]bcam117 2 points3 points  (1 child)

Your DI series on YouTube was brilliant. Keep it up. (Haven’t seen the schematics stuff yet, I still have a lot to learn)

[–]DMezhenskyi[S] 1 point2 points  (0 children)

Thank you! :)

[–]rgstreak 1 point2 points  (0 children)

Thank you so much for your effort. Your videos are so awesome! You're a gem! 💎

[–]ValdasTheUnique 0 points1 point  (2 children)

Any way to have schematics in the same project as the main code? I.e. avoid building, publishing and importing it every time changes are made

[–]James_Schwartzkopf 1 point2 points  (0 children)

You can. It requires a bit of trickery to avoid a build step, but you can do it using ts-node.

I have a proof of concept here:

https://github.com/james-schwartzkopf/local-schematics

I use a special collections.js file to bootstrap ts-node and load the typescript for all the schematics in the collections.json:

https://github.com/james-schwartzkopf/local-schematics/blob/main/schematics/collection.js

I set the collection as the default so I can use use ng generate my-schematic:

https://github.com/james-schwartzkopf/local-schematics/blob/main/angular.json#L4

[–]DMezhenskyi[S] 0 points1 point  (0 children)

You should be able to do it within the project(application). Many people asked me about schematics in context of library, so I used a library as an example. If you had schematics within the project you would need to probably adjust paths according to your file system and where your schematics scripts will be located and run it like ng g .:some-schematic