@team-supercharge/oasg 13.2.0-feature-csharp-functions-22a33fb4.0 → 13.2.0-feature-csharp-functions-36681406.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.
Files changed (3) hide show
  1. package/bin/exec.js +10 -8
  2. package/bin/oasg +130 -162
  3. package/package.json +1 -1
package/bin/exec.js CHANGED
@@ -1,23 +1,25 @@
1
1
  const { exit } = require('process');
2
2
  const { execSync } = require('child_process');
3
3
 
4
- function execCommand(command, stdio) {
4
+ function exec(command, stdio) {
5
5
  try {
6
- execSync(`bash -e -c "${command}"`, { stdio: stdio || 'inherit' });
7
- } catch (e) {
6
+ execSync(command, { stdio: stdio || 'inherit' });
7
+ }
8
+ catch (e) {
8
9
  console.error(e.message);
9
10
  exit(1);
10
11
  }
11
12
  }
12
13
 
13
- function execScript(script, stdio) {
14
+ function bash(command, stdio) {
14
15
  try {
15
- execSync(`bash -e ${script}`, { stdio: stdio || 'inherit' });
16
- } catch (e) {
16
+ execSync(`bash -e -c "${command}"`, { stdio: stdio || 'inherit' });
17
+ }
18
+ catch (e) {
17
19
  console.error(e.message);
18
20
  exit(1);
19
21
  }
20
22
  }
21
23
 
22
- exports.exec = execCommand;
23
- exports.execScript = execScript;
24
+ exports.exec = exec;
25
+ exports.bash = bash;
package/bin/oasg CHANGED
@@ -3,7 +3,7 @@
3
3
  const fs = require('fs');
4
4
  const crypto = require('crypto');
5
5
  const ajv = new (require('ajv'))({
6
- strict: 'log',
6
+ strict: 'log'
7
7
  });
8
8
  const YAML = require('yamljs');
9
9
  const refParser = require('@apidevtools/json-schema-ref-parser');
@@ -15,7 +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 { execScript } = require(`${__dirname}/exec.js`);
18
+ const { bash } = require(`${__dirname}/exec.js`);
19
19
  const { merge } = require(`${__dirname}/merger.js`);
20
20
  const { applyOverrides } = require(`${__dirname}/overrider.js`);
21
21
  const { openApiTarget } = require(`${__dirname}/openapi-target.js`);
@@ -34,23 +34,23 @@ const PROXY_PORT = '9999';
34
34
 
35
35
  const DEFAULT_GENERATOR_MAPPING = {
36
36
  // client targets
37
- android: { version: '7.0.1', generator: 'kotlin' },
38
- angular: { version: '7.0.1', generator: 'typescript-angular' },
39
- feign: { version: '7.0.1', generator: 'spring' },
40
- 'feign-kotlin': { version: '7.0.1', generator: 'kotlin-spring' },
41
- flutter: { version: '7.0.1', generator: 'dart-dio' },
42
- ios: { version: '7.0.1', generator: 'swift5' },
43
- python: { version: '7.0.1', generator: 'python' },
44
- react: { version: '7.0.1', generator: 'typescript-fetch' },
37
+ "android": { version: '7.0.1', generator: 'kotlin' },
38
+ "angular": { version: '7.0.1', generator: 'typescript-angular' },
39
+ "feign": { version: '7.0.1', generator: 'spring' },
40
+ "feign-kotlin": { version: '7.0.1', generator: 'kotlin-spring' },
41
+ "flutter": { version: '7.0.1', generator: 'dart-dio' },
42
+ "ios": { version: '7.0.1', generator: 'swift5' },
43
+ "python": { version: '7.0.1', generator: 'python' },
44
+ "react": { version: '7.0.1', generator: 'typescript-fetch' },
45
45
  // server targets
46
- nestjs: { version: '7.0.1', generator: 'typescript-angular' },
47
- spring: { version: '7.0.1', generator: 'spring' },
48
- 'spring-kotlin': { version: '7.0.1', generator: 'kotlin-spring' },
49
- 'csharp-functions': { version: '7.0.1', generator: 'csharp-functions' },
46
+ "nestjs": { version: '7.0.1', generator: 'typescript-angular' },
47
+ "spring": { version: '7.0.1', generator: 'spring' },
48
+ "spring-kotlin": { version: '7.0.1', generator: 'kotlin-spring' },
49
+ "csharp-functions": { version: '7.0.1', generator: 'csharp-functions' },
50
50
  // misc targets
51
- 'contract-testing': { version: '4.3.1', generator: 'typescript-node' },
52
- openapi: { version: undefined, generator: undefined },
53
- stubby: { version: '4.3.1', generator: 'stubby' },
51
+ "contract-testing": { version: '4.3.1', generator: 'typescript-node' },
52
+ "openapi": { version: undefined, generator: undefined },
53
+ "stubby": { version: '4.3.1', generator: 'stubby' },
54
54
  };
55
55
  const DEFAULT_KTLINT_VERSION = '1.0.0';
56
56
  const BIN_FOLDER = 'out/.bin';
@@ -60,8 +60,8 @@ const CONFIG_FILE_NAME = 'config.json';
60
60
  const DEFAULT_SOURCE = {
61
61
  id: 'default',
62
62
  type: 'simple',
63
- input: 'api/openapi.yaml',
64
- };
63
+ input: 'api/openapi.yaml'
64
+ }
65
65
 
66
66
  let config;
67
67
 
@@ -77,93 +77,71 @@ async function run() {
77
77
  // handle command line
78
78
  require('yargs')
79
79
  // lint
80
- .command(
81
- ['lint [source]', 'l'],
82
- 'lint definitions',
83
- (yargs) => {
84
- yargs.positional('source', {
80
+ .command(['lint [source]', 'l'], 'lint definitions', (yargs) => {
81
+ yargs
82
+ .positional('source', {
85
83
  describe: 'specify a source (optional)',
86
- default: undefined,
87
- });
88
- },
89
- (argv) => lint(argv)
90
- )
84
+ default: undefined
85
+ })
86
+ }, (argv) => lint(argv))
91
87
 
92
88
  // serve
93
- .command(
94
- ['serve [source]', 's'],
95
- 'serve definition',
96
- (yargs) => {
97
- yargs.positional('source', {
89
+ .command(['serve [source]', 's'], 'serve definition', (yargs) => {
90
+ yargs
91
+ .positional('source', {
98
92
  describe: 'specify a source',
99
- default: 'default',
100
- });
101
- },
102
- (argv) => serve(argv)
103
- )
93
+ default: 'default'
94
+ })
95
+ }, (argv) => serve(argv))
104
96
 
105
97
  // proxy
106
- .command(
107
- ['proxy [source]', 'p'],
108
- 'serve definition',
109
- (yargs) => {
110
- yargs
111
- .positional('source', {
112
- describe: 'specify a source',
113
- default: 'default',
114
- })
115
- .option('server', {
116
- describe: 'specify a server (from "servers" array)',
117
- alias: 's',
118
- demandOption: true,
119
- });
120
- },
121
- (argv) => proxy(argv)
122
- )
98
+ .command(['proxy [source]', 'p'], 'serve definition', (yargs) => {
99
+ yargs
100
+ .positional('source', {
101
+ describe: 'specify a source',
102
+ default: 'default'
103
+ })
104
+ .option('server', {
105
+ describe: 'specify a server (from "servers" array)',
106
+ alias: 's',
107
+ demandOption: true
108
+ })
109
+ }, (argv) => proxy(argv))
123
110
 
124
111
  // generate
125
- .command(
126
- ['generate [target]', 'g'],
127
- 'generate packages',
128
- (yargs) => {
129
- yargs
130
- .positional('target', {
131
- describe: 'specify a target (optional)',
132
- default: undefined,
133
- })
134
- .option('artifactVersion', {
135
- describe: "Specify an artifactVersion (optional). \nIf you do not specify it, the tool uses the root package.json's version field.",
136
- default: undefined,
137
- })
138
- .option('preRelease', {
139
- describe: 'Generate as pre-release (optional). \nHow a pre-release is handled varies between different target types.',
140
- type: 'boolean',
141
- });
142
- },
143
- (argv) => generate(argv)
144
- )
112
+ .command(['generate [target]', 'g'], 'generate packages', (yargs) => {
113
+ yargs
114
+ .positional('target', {
115
+ describe: 'specify a target (optional)',
116
+ default: undefined
117
+ })
118
+ .option('artifactVersion', {
119
+ describe: 'Specify an artifactVersion (optional). \nIf you do not specify it, the tool uses the root package.json\'s version field.',
120
+ default: undefined
121
+ })
122
+ .option('preRelease', {
123
+ describe: 'Generate as pre-release (optional). \nHow a pre-release is handled varies between different target types.',
124
+ type: 'boolean'
125
+ })
126
+ }, (argv) => generate(argv))
145
127
 
146
128
  // publish
147
- .command(
148
- ['publish [target]', 'p'],
149
- 'publish packages',
150
- (yargs) => {
151
- yargs
152
- .positional('target', {
153
- describe: 'specifiy a target (optional)',
154
- default: undefined,
155
- })
156
- .option('preRelease', {
157
- describe: 'Publish as pre-release (optional). \nHow a pre-release is handled varies between different target types.',
158
- type: 'boolean',
159
- });
160
- },
161
- (argv) => publish(argv)
162
- )
129
+ .command(['publish [target]', 'p'], 'publish packages', (yargs) => {
130
+ yargs
131
+ .positional('target', {
132
+ describe: 'specifiy a target (optional)',
133
+ default: undefined
134
+ })
135
+ .option('preRelease', {
136
+ describe: 'Publish as pre-release (optional). \nHow a pre-release is handled varies between different target types.',
137
+ type: 'boolean'
138
+ })
139
+ }, (argv) => publish(argv))
163
140
 
164
141
  // options
165
142
  .demandCommand(1, 'You need to specify a command!')
166
- .strict().argv;
143
+ .strict()
144
+ .argv
167
145
  }
168
146
 
169
147
  function checkVersionMismatch() {
@@ -183,7 +161,7 @@ function checkVersionMismatch() {
183
161
  function checkRequiredCommands() {
184
162
  const missing = [];
185
163
 
186
- REQUIRED_COMMANDS.forEach((command) => {
164
+ REQUIRED_COMMANDS.forEach(command => {
187
165
  if (!commandExistsSync(command)) {
188
166
  missing.push(command);
189
167
  }
@@ -214,10 +192,10 @@ async function parseConfig() {
214
192
  }
215
193
 
216
194
  // validate config schema
217
- let schema = YAML.load(`${__dirname}/../config.schema.yml`);
195
+ let schema = YAML.load(`${__dirname}/../config.schema.yml`)
218
196
  schema = await refParser.dereference(schema);
219
197
  schema = mergeAllOf(schema, { ignoreAdditionalProperties: true });
220
- ajv.addVocabulary(['sources', 'targets']);
198
+ ajv.addVocabulary(["sources", "targets"]);
221
199
  const valid = ajv.validate(schema, config);
222
200
 
223
201
  if (!valid) {
@@ -231,7 +209,7 @@ async function parseConfig() {
231
209
  }
232
210
 
233
211
  // set default source values
234
- config.sources.forEach((s) => {
212
+ config.sources.forEach(s => {
235
213
  if (s.bundle === undefined) {
236
214
  s.bundle = true;
237
215
  }
@@ -250,14 +228,14 @@ async function parseConfig() {
250
228
  });
251
229
 
252
230
  // set default source to targets with undefined
253
- config.targets.forEach((t) => {
231
+ config.targets.forEach(t => {
254
232
  if (!t.source) {
255
233
  t.source = 'default';
256
234
  }
257
235
  });
258
236
 
259
237
  // set default generator values to targets with undefined
260
- config.targets.forEach((t) => {
238
+ config.targets.forEach(t => {
261
239
  if (!t.generator) {
262
240
  t.generator = DEFAULT_GENERATOR_MAPPING[t.type].version;
263
241
  }
@@ -269,20 +247,20 @@ async function parseConfig() {
269
247
  exit(1);
270
248
  }
271
249
  }
272
- });
250
+ })
273
251
 
274
252
  // set default ktlint to android targets with undefined
275
- config.targets.forEach((t) => {
253
+ config.targets.forEach(t => {
276
254
  //TODO: handle different types of platform
277
255
  if (t.type === 'android') {
278
256
  if (!t.formatter) {
279
257
  t.formatter = DEFAULT_KTLINT_VERSION;
280
258
  }
281
259
  }
282
- });
260
+ })
283
261
 
284
262
  // validate uniqueness of source IDs
285
- const sourceIds = config.sources.map((s) => s.id);
263
+ const sourceIds = config.sources.map(s => s.id);
286
264
  const duplicateSourceIds = findDuplicates(sourceIds);
287
265
 
288
266
  if (duplicateSourceIds.length > 0) {
@@ -291,7 +269,7 @@ async function parseConfig() {
291
269
  }
292
270
 
293
271
  // validate uniqueness of target IDs
294
- const targetIds = config.targets.map((t) => t.id);
272
+ const targetIds = config.targets.map(t => t.id);
295
273
  const duplicateTargetIds = findDuplicates(targetIds);
296
274
 
297
275
  if (duplicateTargetIds.length > 0) {
@@ -300,7 +278,7 @@ async function parseConfig() {
300
278
  }
301
279
 
302
280
  // validate targets have valid sources
303
- config.targets.forEach((t) => {
281
+ config.targets.forEach(t => {
304
282
  if (!sourceIds.includes(t.source)) {
305
283
  console.error(`source: ${t.source} not found for target: ${t.id}`);
306
284
  exit(1);
@@ -308,8 +286,8 @@ async function parseConfig() {
308
286
  });
309
287
 
310
288
  // validate unused sources
311
- const usedSources = config.targets.map((t) => t.source);
312
- config.sources.forEach((s) => {
289
+ const usedSources = config.targets.map(t => t.source);
290
+ config.sources.forEach(s => {
313
291
  if (!usedSources.includes(s.id)) {
314
292
  console.error(`source: ${s.id} is not used in any of the targets`);
315
293
  exit(1);
@@ -317,7 +295,7 @@ async function parseConfig() {
317
295
  });
318
296
 
319
297
  // validate source inputs exists
320
- config.sources.forEach((s) => {
298
+ config.sources.forEach(s => {
321
299
  switch (s.type) {
322
300
  case 'simple':
323
301
  if (!fs.existsSync(s.input)) {
@@ -328,12 +306,12 @@ async function parseConfig() {
328
306
  break;
329
307
 
330
308
  case 'merged':
331
- s.inputs.forEach((i) => {
309
+ s.inputs.forEach(i => {
332
310
  if (fs.existsSync(i)) {
333
311
  return;
334
312
  }
335
313
  const matches = globSync(i);
336
- if (matches.every((m) => fs.existsSync(m))) {
314
+ if (matches.every(m => fs.existsSync(m))) {
337
315
  return;
338
316
  }
339
317
  console.error(`input file: ${i} not found for source: ${s.id}`);
@@ -358,11 +336,7 @@ async function buildSources(sourceIds) {
358
336
  continue;
359
337
  }
360
338
 
361
- console.log(
362
- `\n=====\n id:\t\t${source.id}\n type:\t\t${source.type}\n bundle:\t${source.bundle}\n sortSchemas:\t${
363
- source.sortSchemas
364
- }\n decorators: \t${JSON.stringify(source.decorators)}\n cleanup:\t${source.cleanup}\n---\n`
365
- );
339
+ console.log(`\n=====\n id:\t\t${source.id}\n type:\t\t${source.type}\n bundle:\t${source.bundle}\n sortSchemas:\t${source.sortSchemas}\n decorators: \t${JSON.stringify(source.decorators)}\n cleanup:\t${source.cleanup}\n---\n`);
366
340
 
367
341
  let file;
368
342
 
@@ -393,8 +367,8 @@ async function lint(argv) {
393
367
 
394
368
  // gather and deduplicate input files
395
369
  let inputs = [];
396
- sourceIds.forEach((sourceId) => {
397
- const source = config.sources.find((s) => s.id === sourceId);
370
+ sourceIds.forEach(sourceId => {
371
+ const source = config.sources.find(s => s.id === sourceId);
398
372
 
399
373
  switch (source.type) {
400
374
  case 'simple':
@@ -402,9 +376,9 @@ async function lint(argv) {
402
376
  break;
403
377
 
404
378
  case 'merged':
405
- source.inputs.forEach((i) => inputs.push(i));
379
+ source.inputs.forEach(i => inputs.push(i));
406
380
  }
407
- });
381
+ })
408
382
  inputs = Array.from(new Set(inputs));
409
383
 
410
384
  exec(`npx spectral lint --fail-severity warn ${inputs.join(' ')}`);
@@ -422,16 +396,16 @@ async function serve(argv) {
422
396
  const app = express();
423
397
 
424
398
  // configure proxying
425
- const proxyHost = function (request) {
399
+ const proxyHost = function(request) {
426
400
  const url = new URL(request.query.u);
427
401
  return url.origin;
428
402
  };
429
403
 
430
404
  const proxyOptions = {
431
- proxyReqPathResolver: function (request) {
405
+ proxyReqPathResolver: function(request) {
432
406
  const url = new URL(request.query.u);
433
407
  return `${url.pathname}${url.search}${url.hash}`;
434
- },
408
+ }
435
409
  };
436
410
  app.use('/proxy', expressHttpProxy(proxyHost, proxyOptions));
437
411
 
@@ -439,15 +413,15 @@ async function serve(argv) {
439
413
  var swaggerOptions = {
440
414
  swaggerOptions: {
441
415
  showMutatedRequest: false,
442
- requestInterceptor: function (request) {
416
+ requestInterceptor: function(request) {
443
417
  if (request.url.startsWith('http://localhost')) {
444
418
  return request;
445
419
  }
446
420
 
447
421
  request.url = '/proxy?u=' + encodeURIComponent(request.url);
448
422
  return request;
449
- },
450
- },
423
+ }
424
+ }
451
425
  };
452
426
  app.use('/', swaggerUi.serve, swaggerUi.setup(document, swaggerOptions));
453
427
 
@@ -467,7 +441,7 @@ async function proxy(argv) {
467
441
  const document = YAML.load(input);
468
442
 
469
443
  // validate server name
470
- const validServerNames = document.servers.map((s) => s.description);
444
+ const validServerNames = document.servers.map(s => s.description);
471
445
  const serverName = argv.server;
472
446
 
473
447
  if (!validServerNames.includes(serverName)) {
@@ -476,7 +450,7 @@ async function proxy(argv) {
476
450
  }
477
451
 
478
452
  // validate server url
479
- const server = document.servers.find((s) => s.description === serverName);
453
+ const server = document.servers.find(s => s.description === serverName);
480
454
  if (!server.url) {
481
455
  console.error(`url must be defined for server ${server.description}`);
482
456
  exit(1);
@@ -497,8 +471,8 @@ async function generate(argv) {
497
471
 
498
472
  console.log(`generate targets: ${targetIds}`);
499
473
 
500
- targetIds.forEach((targetId) => {
501
- const target = config.targets.find((t) => t.id === targetId);
474
+ targetIds.forEach(targetId => {
475
+ const target = config.targets.find(t => t.id === targetId);
502
476
 
503
477
  // handle docs target
504
478
  if (target.type === 'openapi') {
@@ -518,11 +492,7 @@ async function generate(argv) {
518
492
  const templateDir = customizeTemplates(target);
519
493
 
520
494
  // run generation
521
- execScript(
522
- `${__dirname}/../targets/${target.type}/generate.sh ${VERSION} ${binary} ${CONFIG_FILE_NAME} ${target.id} ${
523
- sources[target.source]
524
- } ${formatter} ${target.generatorId} ${preRelease.toString()} ${templateDir}`
525
- );
495
+ exec(`bash -e ${__dirname}/../targets/${target.type}/generate.sh ${VERSION} ${binary} ${CONFIG_FILE_NAME} ${target.id} ${sources[target.source]} ${formatter} ${target.generatorId} ${preRelease.toString()} ${templateDir}`);
526
496
  });
527
497
  }
528
498
 
@@ -534,8 +504,8 @@ async function publish(argv) {
534
504
 
535
505
  console.log(`publish targets: ${targetIds}`);
536
506
 
537
- targetIds.forEach((targetId) => {
538
- const target = config.targets.find((t) => t.id === targetId);
507
+ targetIds.forEach(targetId => {
508
+ const target = config.targets.find(t => t.id === targetId);
539
509
 
540
510
  // handle docs target
541
511
  if (target.type === 'openapi') {
@@ -551,17 +521,13 @@ async function publish(argv) {
551
521
  formatter = fetchFormatter(target);
552
522
  }
553
523
 
554
- execScript(
555
- `${__dirname}/../targets/${target.type}/publish.sh ${VERSION} ${binary} ${CONFIG_FILE_NAME} ${target.id} ${
556
- sources[target.source]
557
- } ${formatter} ${target.generatorId} ${preRelease.toString()}`
558
- );
524
+ exec(`bash -e ${__dirname}/../targets/${target.type}/publish.sh ${VERSION} ${binary} ${CONFIG_FILE_NAME} ${target.id} ${sources[target.source]} ${formatter} ${target.generatorId} ${preRelease.toString()}`);
559
525
  });
560
526
  }
561
527
 
562
528
  function fetchBinary(target) {
563
529
  // determine binary
564
- const generator = target.generator;
530
+ const generator = target.generator
565
531
  const binary = {};
566
532
 
567
533
  if (generator.startsWith('http')) {
@@ -569,7 +535,8 @@ function fetchBinary(target) {
569
535
 
570
536
  const hash = crypto.createHash('sha256').update(binary.url).digest('hex').substring(0, 8);
571
537
  binary.name = `openapi-generator-cli-${hash}.jar`;
572
- } else {
538
+ }
539
+ else {
573
540
  binary.url = `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${generator}/openapi-generator-cli-${generator}.jar`;
574
541
  binary.name = `openapi-generator-cli-${generator}.jar`;
575
542
  }
@@ -583,24 +550,26 @@ function fetchBinary(target) {
583
550
 
584
551
  // download binary
585
552
  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}`);
553
+ bash(`mkdir -p ${BIN_FOLDER}`);
554
+ bash(`wget ${binary.url} -q -O ${binaryPath}`);
555
+ bash(`chmod +x ${binaryPath}`);
589
556
  return binaryPath;
590
557
  }
591
558
 
592
559
  function fetchFormatter(target) {
593
560
  // determine binary
594
- const formatter = target.formatter;
561
+ const formatter = target.formatter
595
562
  const binary = {};
596
563
 
564
+
597
565
  //TODO: handle different types of platforms
598
566
  if (formatter.startsWith('http')) {
599
567
  binary.url = formatter;
600
568
 
601
569
  const hash = crypto.createHash('sha256').update(binary.url).digest('hex').substring(0, 8);
602
570
  binary.name = `ktlint-${hash}`;
603
- } else {
571
+ }
572
+ else {
604
573
  binary.url = `https://github.com/pinterest/ktlint/releases/download/${formatter}/ktlint`;
605
574
  binary.name = `ktlint-${formatter}`;
606
575
  }
@@ -614,9 +583,9 @@ function fetchFormatter(target) {
614
583
 
615
584
  // download binary
616
585
  console.log(`... downloading ${binary.url} ==> ${binaryPath}`);
617
- exec(`mkdir -p ${BIN_FOLDER}`);
618
- exec(`wget ${binary.url} -q -O ${binaryPath}`);
619
- exec(`chmod +x ${binaryPath}`);
586
+ bash(`mkdir -p ${BIN_FOLDER}`);
587
+ bash(`wget ${binary.url} -q -O ${binaryPath}`);
588
+ bash(`chmod +x ${binaryPath}`);
620
589
  return binaryPath;
621
590
  }
622
591
 
@@ -627,12 +596,12 @@ function customizeTemplates(target) {
627
596
  const targetTemplateDir = `${__dirname}/../targets/${target.type}/templates`;
628
597
 
629
598
  if (fs.existsSync(templateDir)) {
630
- exec(`rm -rf ${templateDir}`);
599
+ bash(`rm -rf ${templateDir}`);
631
600
  }
632
- exec(`mkdir -p ${templateDir}`);
601
+ bash(`mkdir -p ${templateDir}`);
633
602
 
634
603
  if (fs.existsSync(targetTemplateDir)) {
635
- exec(`cp -R ${targetTemplateDir}/* ${templateDir}`);
604
+ bash(`cp -R ${targetTemplateDir}/* ${templateDir}`);
636
605
  }
637
606
 
638
607
  if (target.templateDir) {
@@ -641,7 +610,7 @@ function customizeTemplates(target) {
641
610
  exit(1);
642
611
  }
643
612
 
644
- exec(`cp -R ${target.templateDir}/* ${templateDir}`);
613
+ bash(`cp -R ${target.templateDir}/* ${templateDir}`);
645
614
  }
646
615
 
647
616
  return templateDir;
@@ -660,7 +629,7 @@ function determineSourceIds(argv) {
660
629
  }
661
630
 
662
631
  function validSourceIds() {
663
- return config.sources.map((s) => s.id);
632
+ return config.sources.map(s => s.id);
664
633
  }
665
634
 
666
635
  function checkSourceId(sourceId) {
@@ -684,8 +653,8 @@ function determineTargetIds(argv) {
684
653
 
685
654
  function sourceIdsFromTargetIds(targetIds) {
686
655
  const sourceIds = [];
687
- targetIds.forEach((targetId) => {
688
- const target = config.targets.find((t) => t.id === targetId);
656
+ targetIds.forEach(targetId => {
657
+ const target = config.targets.find(t => t.id === targetId);
689
658
  if (target.source) {
690
659
  sourceIds.push(target.source);
691
660
  }
@@ -694,7 +663,7 @@ function sourceIdsFromTargetIds(targetIds) {
694
663
  }
695
664
 
696
665
  function validTargetIds() {
697
- return config.targets.map((t) => t.id);
666
+ return config.targets.map(t => t.id);
698
667
  }
699
668
 
700
669
  function checkTargetId(targetId) {
@@ -706,9 +675,8 @@ function checkTargetId(targetId) {
706
675
 
707
676
  // find duplicates
708
677
  function findDuplicates(arr) {
709
- return arr.reduce(function (acc, el, i, arr) {
710
- if (arr.indexOf(el) !== i && acc.indexOf(el) < 0) acc.push(el);
711
- return acc;
678
+ return arr.reduce(function(acc, el, i, arr) {
679
+ if (arr.indexOf(el) !== i && acc.indexOf(el) < 0) acc.push(el); return acc;
712
680
  }, []);
713
681
  }
714
682
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-supercharge/oasg",
3
- "version": "13.2.0-feature-csharp-functions-22a33fb4.0",
3
+ "version": "13.2.0-feature-csharp-functions-36681406.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",