Closed rattkin closed 3 years ago
It works for me as long as there are actually any files matching the pattern (./src/shared/api-model/models/*.ts
). If not, bash does not expand *
-- it's a function of bash rather than of ts-interface-builder
. If it works from command-line, there is probably a difference in which shell is used.
You could work around it using xargs, e.g.
find ./src/shared/api-model/models - name '*.ts' | xargs ts-interface-builder -o ./src/shared/api-ts-checker
Thank you for your reply. It is in the * expansion indeed. If I run named file, it works: "generate-ts-interface": "ts-interface-builder \"./src/app/shared/api-model/models/address.ts\" -o ./src/app/shared/api-ts-checker"
I'm on windows unfortunately.
Can the script please work on all files in the specified path? So using glob * would not be necessary..
A good solution to this would be to use the node-glob within ts-interface-builder
, and to quote the glob in the npm-script line. If you want to give it a shot with a PR, I'd be happy to review. Otherwise, I could do it, but it might take me some time to get to it.
Ok this is cleaner commit
I'm trying to run it in npm script and to process all files in a directory:
the script seems to start, but has this error:
Error: Can't process ./src/shared/api-model/models/*.ts: error TS6053: File 'src/shared/api-model/models/*.ts' not found.
however, if I run this in bash, it works:
node_modules/ts-interface-builder/bin/ts-interface-builder src/shared/api-model/models/*.ts -o src/shared/api-ts-checker
how can I set the path?