Skip to content

Commit

Permalink
update conditional copy
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuss committed Feb 19, 2024
1 parent 6d452e5 commit 161b002
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,6 @@ class ServerlessTsoa {
const workdirSpecFile = path.join(workDir, this.specFile);
spec.outputDirectory = path.join(workDir, spec.outputDirectory);

openApiDestinations.push(this.specFile);

console.log("!!! openApiDestinations", openApiDestinations);

try {
await generateTsoaSpec(spec);
} catch (e) {
Expand All @@ -261,6 +257,8 @@ class ServerlessTsoa {
this.specHash = newSpecHash;
}

await this.conditionalCopy(workdirSpecFile, this.specFile);

// Using .then becuse the following functions are not dependent on each other
generateTsoaRoutes({ ...routes, noWriteIfUnchanged: true })
.then(() => {
Expand All @@ -281,10 +279,7 @@ class ServerlessTsoa {
});

openApiDestinations.map((destination) =>
this.conditionalCopy(
workdirSpecFile,
path.join(destination, this.specFile)
)
this.conditionalCopy(this.specFile, path.join(destination, this.specFile))
.then((dest) => {
if (dest) {
this.log.verbose(`Copied OpenAPI Spec to: ${dest}`);
Expand Down

0 comments on commit 161b002

Please sign in to comment.