I took this opportunity to look into Angular Schematics.
I have a small "ng-add" schematics, which overwrites the files with my own and installs the needed dependencies.
Since these are all files in the root directory, the schematic rule is as simple as (with all templates in the folder files
like suggested):
import {
Rule,
SchematicContext,
Tree,
apply,
url,
mergeWith,
template,
MergeStrategy,
} from "@angular-devkit/schematics";
export function ngAdd(options: any): Rule {
return (tree: Tree, context: SchematicContext) => {
const templateSource = apply(url("./files"), [template(options)]);
const merged = mergeWith(templateSource, MergeStrategy.Overwrite);
return merged(tree, context);
};
}
So after I created the workspace with npx create-nx-workspace --preset=angular
I can just nx add my-schematics
and it has the shape I need.