I'm submitting a ...
I confirm that I
Running tsoa routes does not throw errors if the target directory doesn't exist.
$ tsoa routes
Generate routes error.
Error: ENOENT: no such file or directory, lstat 'tsoa-package'
at Object.lstatSync (fs.js:924:3)
at RouteGenerator.<anonymous> ([...]/node_modules/tsoa/dist/routeGeneration/routeGenerator.js:81:33)
Running tsoa spec-and-routes if the spec outputDirectory is the same as the routesDir doesn't have this issue - it creates the folder if not present already.
I'm guessing the spec part is creating a folder but not the routes - just copy that behaviour across to the routes command.
tsoa.config{
"spec": {
"outputDirectory": "tsoa-spec",
"specVersion": 3
},
"routes": {
"routesDir": "tsoa-routes"
}
}
$ rm -rf tsoa-routes && tsoa routes or $ rm -rf tsoa-routes && tsoa spec-and-routesVersion of the library: 3.2.1
Version of NodeJS: 12.16.2
I'm using npm.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
This issue isn't stale
This issue also happens occasionally if the folder is the same for routes and spec. This is due to a race condition as spec and route generation run concurrently: https://github.com/lukeautry/tsoa/blob/1b74e4545096dce76df9a1dcefa68b334fe4f6e5/packages/cli/src/cli.ts#L357
Any updates on this? We are not committing the routes.ts file due to conflicts on each PR and wanting to build the latest routes during deployment phase.
It fails in github since an empty directory can't be committed.
If you also don't commit your routes.ts file a work around for us is to add any file to the routes/ directory.
The tradition, to keep a directory around in git is to add an empty .gitkeep file inside the folder.
This is purely a convention, and really it could just be any file.
@tsimbalar Thanks this is exactly what I was looking for.
Most helpful comment
The tradition, to keep a directory around in
gitis to add an empty.gitkeepfile inside the folder.This is purely a convention, and really it could just be any file.
see https://stackoverflow.com/a/7229996/474763