I'd like to customize the ng g app
schematic so that calling ng g app myapp
will create myapp/src/environments/environment.ts
file like so:
import { environment as baseEnvironment } from '@myworkspace/environments/environment';
export const environment = Object.assign(
{ production: false },
baseEnvironment
);
The Nx docs show how to set things up but do not show any code examples, which would be greatly appreciated.
You can create a custom schematic to do this in your Nx workspace.
This will create a new schematic under
tools/schematics
. You can edit theindex.ts
file that's created to insert your own code.You can then run this with this command: