Skip to content

Instantly share code, notes, and snippets.

@philipjfulcher
Last active November 4, 2021 16:50
Show Gist options
  • Save philipjfulcher/2d23902a4ee535a8153cfe2f63f73d28 to your computer and use it in GitHub Desktop.
Save philipjfulcher/2d23902a4ee535a8153cfe2f63f73d28 to your computer and use it in GitHub Desktop.
generator-with-lint
import {
Tree,
formatFiles,
generateFiles,
joinPathFragments,
} from '@nrwl/devkit';
import { libraryGenerator } from '@nrwl/workspace/generators';
import { execSync } from 'child_process';
export default async function (tree: Tree, schema: any) {
await libraryGenerator(tree, { name: schema.name });
generateFiles(
tree,
joinPathFragments(__dirname, './files'),
joinPathFragments('libs', schema.name, 'src/lib'),
{
tmpl: '',
moduleName: schema.name,
}
);
await formatFiles(tree);
return async () => {
execSync(`nx lint --fix=true --project=${schema.name}`);
await formatFiles(tree);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment