angular-architects / nx-ddd-plugin

Nx plugin for structuring a monorepo with domains and layers
313 stars 56 forks source link

Feature Request - Way to Easily Extend Schematics #84

Closed tuckerjt07 closed 2 years ago

tuckerjt07 commented 3 years ago

I'm not even sure if this is possible/feasible but I am looking for a way to add custom build options when creating a new domain, namely stylePreprocessorOptions and extractCss so that my shared styles are automatically included in the new domain. Based on my limited understanding and research it looks like extending the existing schematic is the best way to accomplish this but I am running into an issue tracking down exactly what needs to be extended.

Another nice to have would be being able to add code when generating a feature. In this case just adding '@use variables;' to the features scss file to pull in access to all the shared styles.

manfredsteyer commented 2 years ago

I feel you.

I think, the easiest way is to create a workspace generator (version 2.0.0 will use the generator API) and wrap it:

import { Tree } from '@nrwl/devkit';
import generateFeature from '@angular-architects/ddd/src/generators/feature';

export default async function (tree: Tree, schema: any) {

  generateFeature(tree, { name:'my-feature', domain: 'my-domain' });

  // Do additional stuff with generated feature

}