@team-supercharge/oasg 14.1.0-feature-csharp-functions-2e109dee.0 → 14.1.0-feature-csharp-functions-win-ffd21d9f.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`);
@@ -550,9 +551,9 @@ function fetchBinary(target) {
550
551
 
551
552
  // download binary
552
553
  console.log(`... downloading ${binary.url} ==> ${binaryPath}`);
553
- exec(`mkdir -p ${BIN_FOLDER}`);
554
- exec(`wget ${binary.url} -q -O ${binaryPath}`);
555
- exec(`chmod +x ${binaryPath}`);
554
+ bash(`mkdir -p ${BIN_FOLDER}`);
555
+ bash(`wget ${binary.url} -q -O ${binaryPath}`);
556
+ bash(`chmod +x ${binaryPath}`);
556
557
  return binaryPath;
557
558
  }
558
559
 
@@ -583,9 +584,9 @@ function fetchFormatter(target) {
583
584
 
584
585
  // download binary
585
586
  console.log(`... downloading ${binary.url} ==> ${binaryPath}`);
586
- exec(`mkdir -p ${BIN_FOLDER}`);
587
- exec(`wget ${binary.url} -q -O ${binaryPath}`);
588
- exec(`chmod +x ${binaryPath}`);
587
+ bash(`mkdir -p ${BIN_FOLDER}`);
588
+ bash(`wget ${binary.url} -q -O ${binaryPath}`);
589
+ bash(`chmod +x ${binaryPath}`);
589
590
  return binaryPath;
590
591
  }
591
592
 
@@ -596,12 +597,12 @@ function customizeTemplates(target) {
596
597
  const targetTemplateDir = `${__dirname}/../targets/${target.type}/templates`;
597
598
 
598
599
  if (fs.existsSync(templateDir)) {
599
- exec(`rm -rf ${templateDir}`);
600
+ bash(`rm -rf ${templateDir}`);
600
601
  }
601
- exec(`mkdir -p ${templateDir}`);
602
+ bash(`mkdir -p ${templateDir}`);
602
603
 
603
604
  if (fs.existsSync(targetTemplateDir)) {
604
- exec(`cp -R ${targetTemplateDir}/* ${templateDir}`);
605
+ bash(`cp -R ${targetTemplateDir}/* ${templateDir}`);
605
606
  }
606
607
 
607
608
  if (target.templateDir) {
@@ -610,7 +611,7 @@ function customizeTemplates(target) {
610
611
  exit(1);
611
612
  }
612
613
 
613
- exec(`cp -R ${target.templateDir}/* ${templateDir}`);
614
+ bash(`cp -R ${target.templateDir}/* ${templateDir}`);
614
615
  }
615
616
 
616
617
  return templateDir;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-supercharge/oasg",
3
- "version": "14.1.0-feature-csharp-functions-2e109dee.0",
3
+ "version": "14.1.0-feature-csharp-functions-win-ffd21d9f.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
@@ -21,10 +23,11 @@ templateDir=$9
21
23
 
22
24
  echo -e "\n=====\n version:\t$version\n binary:\t$binary\n configFile:\t$configFile\n targetId:\t$targetId\n generatorId:\t$generatorId\n openApiFile:\t$openApiFile\n formatter:\t$formatterBinary\n preRelease:\t$preRelease\n templateDir:\t$templateDir\n ---"
23
25
 
24
- for paramName in $(cat $configFile | jq -r ".targets[] | select(.id==\"$targetId\") | del(.id) | del(.type) | del(.source) | del(.generator) | del(.generatorId) | del(.templateDir) | keys | .[]"); do
25
- result=$(cat $configFile | jq -r ".targets[] | select(.id==\"$targetId\") | .$paramName")
26
- echo -e " $paramName:\t$result"
27
- eval $paramName="'$result'"
28
- done
26
+ blacklist='.id, .type, .source, .generator, .generatorId, .templateDir'
27
+
28
+ params=$(jq -r ".targets[] | select(.id == \"$targetId\") | del($blacklist) | to_entries | map(\"\(.key)=\(.value | @sh);\") | .[]" $configFile)
29
+
30
+ echo "$params"
31
+ eval $params
29
32
 
30
33
  echo -e "=====\n"