From 9d6cb6ce69f408264cee4fe571195ef423e88222 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Fri, 10 Mar 2023 18:32:45 -0300 Subject: [PATCH] fix generate sample --- test-integration/scripts/12-generate-sample.js | 2 +- .../scripts/lib/copy-jdl-entity-samples.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test-integration/scripts/12-generate-sample.js b/test-integration/scripts/12-generate-sample.js index 34e8906f9d5e..198dae1cec91 100755 --- a/test-integration/scripts/12-generate-sample.js +++ b/test-integration/scripts/12-generate-sample.js @@ -97,7 +97,7 @@ if (sample['app-sample']) { '--skip-jhipster-dependencies', '--skip-install', '--no-insight', - ...(sample['extra-args'] ?? '').split(' '), + ...(sample['extra-args']?.split(' ') ?? []), ], }).catch(done); } diff --git a/test-integration/scripts/lib/copy-jdl-entity-samples.js b/test-integration/scripts/lib/copy-jdl-entity-samples.js index 9ce001932863..7023549147b1 100644 --- a/test-integration/scripts/lib/copy-jdl-entity-samples.js +++ b/test-integration/scripts/lib/copy-jdl-entity-samples.js @@ -5,11 +5,19 @@ import { fileURLToPath } from 'url'; const samplesFolder = join(dirname(fileURLToPath(import.meta.url)), '../../samples'); const jdlEntitiesSamplesFolder = join(samplesFolder, 'jdl-entities'); +const isDirectory = dir => { + try { + return statSync(samplePath).isDirectory(); + } catch (error) { + return false; + } +}; + export default function copyJdlEntitySamples(dest, ...entities) { mkdirSync(dest, { recursive: true }); for (const entity of entities) { const samplePath = join(jdlEntitiesSamplesFolder, entity); - if (statSync(samplePath).isDirectory()) { + if (isDirectory(samplePath)) { cpSync(samplePath, dest, { recursive: true }); } else if (extname(samplePath) === '.jdl') { cpSync(samplePath, join(dest, entity));