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