I'm developing a schematic which produces some files. I'd like to have new files in current directory, i.e.
My project root is /src/app
. When I am in folder /src/app/features/f1
, and type
ng g my:some-schemaitc --name=name
I am expecting new file
/src/app/features/f1/name.ts
instead, the result is
/src/app/name.ts
I'd like to achieve same behavior as ng g class --name=name
. When I type ng g class --name=class
in directory /src/app/features/f1
, the result will be
/src/app/features/f1/class.ts
I tried to mimic Angular ng g class
behavior schematics source code, but without satisfying result. My code is almost same.
Have someone made use of current path?
Accidentally I found out a global variable __dirname
which stores current path. For exapmple:
console.log('DIR', __dirname);