Skip to content

Commit

Permalink
generated blueprint test should be done with a updated generator-jhip…
Browse files Browse the repository at this point in the history
…ster
  • Loading branch information
mshima committed Aug 30, 2022
1 parent e227105 commit e897b86
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/generator-generate-blueprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
mkdir generator-jhipster-foo
cd generator-jhipster-foo
cp $JHI_INTEG/generate-blueprint-samples/default/.yo-rc.json .
jhipster generate-blueprint --force --skip-jhipster-dependencies --generate-snapshots
jhipster generate-blueprint --force --link-jhipster-dependency --generate-snapshots
npm link generator-jhipster
npm link
- name: 'GENERATION: config'
Expand Down
6 changes: 6 additions & 0 deletions generators/generate-blueprint/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { BASE_PRIORITY_NAMES, ENTITY_PRIORITY_NAMES } from '../../lib/constants/
const prioritiesForSub = subGenerator => (subGenerator.startsWith('entit') ? ENTITY_PRIORITY_NAMES : BASE_PRIORITY_NAMES);

export const GENERATE_SNAPSHOTS = 'generateSnapshots';
export const LINK_JHIPSTER_DEPENDENCY = 'linkJhipsterDependency';
export const GENERATORS = 'generators';
export const SUB_GENERATORS = 'subGenerators';
export const ADDITIONAL_SUB_GENERATORS = 'additionalSubGenerators';
Expand All @@ -44,6 +45,11 @@ export const options = () => ({
desc: 'Generate test snapshots',
type: Boolean,
},
[LINK_JHIPSTER_DEPENDENCY]: {
desc: 'Link JHipster dependency for testing',
type: Boolean,
hide: true,
},
[SUB_GENERATORS]: {
desc: 'Sub generators to generate',
type: Array,
Expand Down
4 changes: 4 additions & 0 deletions generators/generate-blueprint/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
prompts,
subGeneratorPrompts,
GENERATE_SNAPSHOTS,
LINK_JHIPSTER_DEPENDENCY,
ALL_GENERATORS,
GENERATORS,
PRIORITIES,
Expand Down Expand Up @@ -332,6 +333,9 @@ export default class extends BaseBlueprintGenerator {
this.log(`
This is a new blueprint, executing '${chalk.yellow('npm run update-snapshot')}' to generate snapshots and commit to git.`);
try {
if (this.options[LINK_JHIPSTER_DEPENDENCY]) {
await this.spawnCommand('npm', ['link', 'generator-jhipster']);
}
await this.spawnCommand('npm', ['run', 'update-snapshot']);
} catch (error) {
if (generateSnapshots !== undefined) {
Expand Down

0 comments on commit e897b86

Please sign in to comment.