Skip to content

Commit 2ff055c

Browse files
committed
fix(comms): enhance wsdl file writing to support "current" output directory
Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
1 parent 591b0a2 commit 2ff055c

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

packages/comms/utils/index.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,21 @@ wsdlToTs(args.url)
393393
if (printToConsole) {
394394
console.log(lines.join("\n").replace(/\n\n\n/g, "\n"));
395395
} else {
396-
mkdir(finalPath, { recursive: true }).then(() => {
397-
const tsFile = path.join(finalPath, origNS.replace(/^WS/, "Ws") + ".ts");
398-
writeFile(tsFile, lines.join("\n").replace(/\n\n\n/g, "\n")).then(() => {
399-
tsfmt.processFiles([tsFile], tsFmtOpts);
396+
const content = lines.join("\n").replace(/\n\n\n/g, "\n");
397+
const serviceName = origNS.replace(/^WS/, "Ws");
398+
const currentPath = path.join(outDir, serviceName, "current");
399+
const writeToDir = (dir: string) => {
400+
return mkdir(dir, { recursive: true }).then(() => {
401+
const tsFile = path.join(dir, serviceName + ".ts");
402+
return writeFile(tsFile, content).then(() => {
403+
return tsfmt.processFiles([tsFile], tsFmtOpts);
404+
});
400405
});
401-
}).catch(e => {
406+
};
407+
Promise.all([
408+
writeToDir(finalPath),
409+
writeToDir(currentPath)
410+
]).catch(e => {
402411
console.error(e.message ?? e);
403412
if (!keepGoing) {
404413
process.exitCode = -1;

0 commit comments

Comments
 (0)