@team-supercharge/oasg 13.2.0-feature-csharp-functions-953cbbf4.0 → 13.2.0-feature-csharp-functions-68ad1aa3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/exec.js CHANGED
@@ -11,4 +11,15 @@ function exec(command, stdio) {
11
11
  }
12
12
  }
13
13
 
14
+ function bash(command, stdio) {
15
+ try {
16
+ execSync(`bash -e -c "${command}"`, { stdio: stdio || 'inherit' });
17
+ }
18
+ catch (e) {
19
+ console.error(e.message);
20
+ exit(1);
21
+ }
22
+ }
23
+
14
24
  exports.exec = exec;
25
+ exports.bash = bash;
package/bin/oasg CHANGED
@@ -15,6 +15,7 @@ const expressHttpProxy = require('express-http-proxy');
15
15
  const { exit } = require('process');
16
16
 
17
17
  const { exec } = require(`${__dirname}/exec.js`);
18
+ const { bash } = require(`${__dirname}/exec.js`);
18
19
  const { merge } = require(`${__dirname}/merger.js`);
19
20
  const { applyOverrides } = require(`${__dirname}/overrider.js`);
20
21
  const { openApiTarget } = require(`${__dirname}/openapi-target.js`);
@@ -549,9 +550,9 @@ function fetchBinary(target) {
549
550
 
550
551
  // download binary
551
552
  console.log(`... downloading ${binary.url} ==> ${binaryPath}`);
552
- exec(`bash -e -c "mkdir -p ${BIN_FOLDER}"`);
553
- exec(`bash -e -c "wget ${binary.url} -q -O ${binaryPath}"`);
554
- exec(`bash -e -c "chmod +x ${binaryPath}"`);
553
+ bash(`mkdir -p ${BIN_FOLDER}`);
554
+ bash(`wget ${binary.url} -q -O ${binaryPath}`);
555
+ bash(`chmod +x ${binaryPath}`);
555
556
  return binaryPath;
556
557
  }
557
558
 
@@ -582,9 +583,9 @@ function fetchFormatter(target) {
582
583
 
583
584
  // download binary
584
585
  console.log(`... downloading ${binary.url} ==> ${binaryPath}`);
585
- exec(`bash -e -c "mkdir -p ${BIN_FOLDER}"`);
586
- exec(`bash -e -c "wget ${binary.url} -q -O ${binaryPath}"`);
587
- exec(`bash -e -c "chmod +x ${binaryPath}"`);
586
+ bash(`mkdir -p ${BIN_FOLDER}`);
587
+ bash(`wget ${binary.url} -q -O ${binaryPath}`);
588
+ bash(`chmod +x ${binaryPath}`);
588
589
  return binaryPath;
589
590
  }
590
591
 
@@ -595,12 +596,12 @@ function customizeTemplates(target) {
595
596
  const targetTemplateDir = `${__dirname}/../targets/${target.type}/templates`;
596
597
 
597
598
  if (fs.existsSync(templateDir)) {
598
- exec(`bash -e -c "rm -rf ${templateDir}"`);
599
+ bash(`rm -rf ${templateDir}`);
599
600
  }
600
- exec(`bash -e -c "mkdir -p ${templateDir}"`);
601
+ bash(`mkdir -p ${templateDir}`);
601
602
 
602
603
  if (fs.existsSync(targetTemplateDir)) {
603
- exec(`bash -e -c "cp -R ${targetTemplateDir}/* ${templateDir}"`);
604
+ bash(`cp -R ${targetTemplateDir}/* ${templateDir}`);
604
605
  }
605
606
 
606
607
  if (target.templateDir) {
@@ -609,7 +610,7 @@ function customizeTemplates(target) {
609
610
  exit(1);
610
611
  }
611
612
 
612
- exec(`bash -e -c "cp -R ${target.templateDir}/* ${templateDir}`);
613
+ bash(`cp -R ${target.templateDir}/* ${templateDir}`);
613
614
  }
614
615
 
615
616
  return templateDir;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-supercharge/oasg",
3
- "version": "13.2.0-feature-csharp-functions-953cbbf4.0",
3
+ "version": "13.2.0-feature-csharp-functions-68ad1aa3.0",
4
4
  "description": "Node-based tool to lint OpenAPI documents and generate clients, servers and documentation from them",
5
5
  "author": "Supercharge",
6
6
  "license": "MIT",
package/targets/common.sh CHANGED
@@ -1,3 +1,5 @@
1
+ #!/bin/bash
2
+
1
3
  # command line arguments:
2
4
  # 1. version - semantic version string
3
5
  # 2. binary - openapi-generator JAR file