Skip to content

Commit

Permalink
generate-blueprint: test using folder install
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Oct 28, 2024
1 parent e45d393 commit 75fad7d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/generator-generate-blueprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ jobs:
mkdir generator-jhipster-foo
cd generator-jhipster-foo
cp $JHI_INTEG/generate-blueprint-samples/default/.yo-rc.json .
jhipster generate-blueprint --force --link-jhipster-dependency --generate-snapshots --skip-install
npm link generator-jhipster
jhipster generate-blueprint --force --install-jhipster-dependency-folder --generate-snapshots --skip-install
npm link
- name: 'GENERATION: config'
run: $JHI_SCRIPTS/11-generate-config.sh
Expand Down
7 changes: 7 additions & 0 deletions generators/generate-blueprint/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ const command = {
},
scope: 'storage',
},
installJhipsterDependencyFolder: {
cli: {
description: 'Install JHipster dependency folder',
type: Boolean,
},
scope: 'generator',
},
},
options: {
[GENERATE_SNAPSHOTS]: {
Expand Down
5 changes: 4 additions & 1 deletion generators/generate-blueprint/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import BaseGenerator from '../base-application/index.js';
import { PRIORITY_NAMES_LIST as BASE_PRIORITY_NAMES_LIST } from '../base/priorities.js';

import * as GENERATOR_LIST from '../generator-list.js';
import { packageJson } from '../../lib/index.js';
import { getPackageRoot, packageJson } from '../../lib/index.js';
import { BLUEPRINT_API_VERSION, NODE_VERSION } from '../generator-constants.js';
import { files, generatorFiles } from './files.js';
import {
Expand Down Expand Up @@ -57,6 +57,7 @@ export default class extends BaseGenerator {
recreatePackageLock!: boolean;
skipWorkflows!: boolean;
ignoreExistingGenerators!: boolean;
installJhipsterDependencyFolder!: boolean;

async _beforeQueue() {
if (!this.fromBlueprint) {
Expand Down Expand Up @@ -402,6 +403,8 @@ export default class extends BaseGenerator {
if (this.options[LINK_JHIPSTER_DEPENDENCY]) {
this.log.verboseInfo('Linking generator-jhipster');
await this.spawnCommand('npm', ['link', 'generator-jhipster'], { stdio: 'inherit' });
} else if (this.installJhipsterDependencyFolder) {
await this.spawnCommand('npm', ['install', getPackageRoot()], { stdio: 'inherit' });
}

// Generate snapshots to add to git.
Expand Down

0 comments on commit 75fad7d

Please sign in to comment.