Skip to content

Commit

Permalink
Merge branch 'patch-2' into feature/add-windows-to-build
Browse files Browse the repository at this point in the history
  • Loading branch information
mok-liee committed Mar 5, 2024
2 parents 25fb817 + 8c3eb47 commit 7538ffa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/generator-cli/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,4 @@ yarn add @openapitools/[email protected]

Please leave a star.


6 changes: 4 additions & 2 deletions apps/generator-cli/src/app/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import path from 'path';

const isWin = () => process.platform === 'win32';

/**
Expand All @@ -6,6 +8,6 @@ const isWin = () => process.platform === 'win32';
*/
export const javaCmd: string = process.env['JAVA_HOME']
? isWin()
? `"${process.env['JAVA_HOME']}/bin/java"`
: `${process.env['JAVA_HOME']}/bin/java`
? `"${path.join(process.env['JAVA_HOME'], 'bin', 'java')}"`
: `${path.join(process.env['JAVA_HOME'], 'bin', 'java')}`
: 'java';
10 changes: 9 additions & 1 deletion apps/generator-cli/src/app/services/generator.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,17 @@ export class GeneratorService {
)}" org.openapitools.codegen.OpenAPIGenerator`
: `-jar "${cliPath}"`;

return [javaCmd, process.env['JAVA_OPTS'], subCmd, 'generate', appendix]
const command = [
javaCmd,
process.env['JAVA_OPTS'],
subCmd,
'generate',
appendix,
]
.filter(isString)
.join(' ');

return this.isWin() ? `"${command}"` : command;
};

private isWin = () => process.platform === 'win32';
Expand Down

0 comments on commit 7538ffa

Please sign in to comment.