Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add features parameter to the constructor of every generator. #15949

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions generators/add/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const { GENERATOR_ADD } = require('../generator-list');
* @experimental
*/
module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts, { unique: 'namespace' });
constructor(args, options, features) {
super(args, options, { unique: 'namespace', ...features });

this.argument('generators', {
type: Array,
Expand Down
4 changes: 2 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const {
let useBlueprints;

module.exports = class JHipsterAppGenerator extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts, { unique: 'namespace' });
constructor(args, options, features) {
super(args, options, { unique: 'namespace', ...features });

this.option('defaults', {
desc: 'Execute jhipster with default config',
Expand Down
2 changes: 1 addition & 1 deletion generators/app/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function askForApplicationType() {
}

function askForModuleName() {
if (this.existingProject) return undefined;
if (this.existingProject || this.jhipsterConfig.baseName) return undefined;
return this.askModuleName(this);
}

Expand Down
4 changes: 2 additions & 2 deletions generators/aws/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const { MYSQL, POSTGRESQL, MARIADB } = require('../../jdl/jhipster/database-type
let useBlueprints;
/* eslint-disable consistent-return */
module.exports = class extends BaseBlueprintGenerator {
constructor(args, options) {
super(args, options);
constructor(args, options, features) {
super(args, options, features);
useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_AWS);
}

Expand Down
4 changes: 2 additions & 2 deletions generators/azure-app-service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const AZURE_APP_INSIGHTS_STARTER_VERSION = '2.5.1';
let useBlueprints;
/* eslint-disable consistent-return */
module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts);
constructor(args, options, features) {
super(args, options, features);

this.option('skip-build', {
desc: 'Skips building the application',
Expand Down
4 changes: 2 additions & 2 deletions generators/azure-spring-cloud/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const { GENERATOR_AZURE_SPRING_CLOUD } = require('../generator-list');
let useBlueprints;
/* eslint-disable consistent-return */
module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts);
constructor(args, options, features) {
super(args, options, features);

this.option('skip-build', {
desc: 'Skips building the application',
Expand Down
4 changes: 2 additions & 2 deletions generators/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const { CommonDBTypes } = require('../../jdl/jhipster/field-types');
const { STRING: TYPE_STRING, LONG: TYPE_LONG } = CommonDBTypes;

module.exports = class extends BaseGenerator {
constructor(args, options) {
super(args, options, { unique: 'namespace', customCommitTask: true });
constructor(args, options, features) {
super(args, options, { unique: 'namespace', customCommitTask: true, ...features });

/*
* When testing a generator with yeoman-test using 'withLocalConfig(localConfig)', it instantiates the
Expand Down
4 changes: 2 additions & 2 deletions generators/ci-cd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const REACT = constants.SUPPORTED_CLIENT_FRAMEWORKS.REACT;
let useBlueprints;

module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts);
constructor(args, options, features) {
super(args, options, features);

// Automatically configure Travis
this.option('autoconfigure-travis', {
Expand Down
4 changes: 2 additions & 2 deletions generators/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const TYPE_UUID = CommonDBTypes.UUID;
let useBlueprints;

module.exports = class JHipsterClientGenerator extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts, { unique: 'namespace' });
constructor(args, options, features) {
super(args, options, { unique: 'namespace', ...features });

// This adds support for a `--auth` flag
this.option('auth', {
Expand Down
4 changes: 2 additions & 2 deletions generators/cloudfoundry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const exec = childProcess.exec;
let useBlueprints;
/* eslint-disable consistent-return */
module.exports = class extends BaseBlueprintGenerator {
constructor(args, options) {
super(args, options);
constructor(args, options, features) {
super(args, options, features);
useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_CLOUDFOUNDRY);
}

Expand Down
4 changes: 2 additions & 2 deletions generators/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const packageJson = require('../../package.json');
let useBlueprints;

module.exports = class JHipsterCommonGenerator extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts, { unique: 'namespace' });
constructor(args, options, features) {
super(args, options, { unique: 'namespace', ...features });

if (this.options.help) {
return;
Expand Down
4 changes: 2 additions & 2 deletions generators/cypress/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const { CYPRESS } = require('../../jdl/jhipster/test-framework-types');
let useBlueprints;
/* eslint-disable consistent-return */
module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts, { unique: 'namespace' });
constructor(args, options, features) {
super(args, options, { unique: 'namespace', ...features });

if (this.options.help) {
return;
Expand Down
4 changes: 2 additions & 2 deletions generators/database-changelog-liquibase/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const { prepareFieldForLiquibaseTemplates } = require('../../utils/liquibase');
let useBlueprints;
/* eslint-disable consistent-return */
module.exports = class extends BaseBlueprintGenerator {
constructor(args, options) {
super(args, options);
constructor(args, options, features) {
super(args, options, features);

assert(this.options.databaseChangelog, 'Changelog is required');
this.databaseChangelog = this.options.databaseChangelog;
Expand Down
4 changes: 2 additions & 2 deletions generators/database-changelog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const BASE_CHANGELOG = {
let useBlueprints;
/* eslint-disable consistent-return */
module.exports = class extends BaseBlueprintGenerator {
constructor(args, options) {
super(args, options, { unique: 'namespace' });
constructor(args, options, features) {
super(args, options, { unique: 'namespace', ...features });

this.argument('entities', {
desc: 'Which entities to generate a new changelog',
Expand Down
4 changes: 2 additions & 2 deletions generators/docker-compose/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ let useBlueprints;

/* eslint-disable consistent-return */
module.exports = class extends BaseDockerGenerator {
constructor(args, options) {
super(args, options);
constructor(args, options, features) {
super(args, options, features);
useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_DOCKER_COMPOSE);
}

Expand Down
4 changes: 2 additions & 2 deletions generators/entities-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const { GENERATOR_ENTITIES_CLIENT } = require('../generator-list');
let useBlueprints;

module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts);
constructor(args, options, features) {
super(args, options, features);
if (this.options.help) return;
this.clientEntities = this.options.clientEntities;
useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_ENTITIES_CLIENT);
Expand Down
4 changes: 2 additions & 2 deletions generators/entities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const { GENERATOR_ENTITIES, GENERATOR_ENTITIES_CLIENT, GENERATOR_ENTITY, GENERAT
let useBlueprints;

module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts, { unique: 'namespace' });
constructor(args, options, features) {
super(args, options, { unique: 'namespace', ...features });

// This makes `name` a required argument.
this.argument('entities', {
Expand Down
10 changes: 5 additions & 5 deletions generators/entity-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ const { GENERATOR_ENTITY_CLIENT } = require('../generator-list');
let useBlueprints;

module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts);
this.entity = opts.context;
constructor(args, options, features) {
super(args, options, features);

this.jhipsterContext = opts.jhipsterContext || opts.context;
this.entity = this.options.context;
this.jhipsterContext = this.options.jhipsterContext || this.options.context;

useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_ENTITY_CLIENT, { context: opts.context });
useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_ENTITY_CLIENT, { context: this.options.context });
}

// Public API method used by the getter and also by Blueprints
Expand Down
10 changes: 5 additions & 5 deletions generators/entity-i18n/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ const BaseBlueprintGenerator = require('../generator-base-blueprint');
let useBlueprints;

module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts);
constructor(args, options, features) {
super(args, options, features);

this.entity = opts.context;
this.jhipsterContext = opts.jhipsterContext || opts.context;
this.entity = this.options.context;
this.jhipsterContext = this.options.jhipsterContext || this.options.context;

useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_ENTITY_I18N, { context: opts.context });
useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_ENTITY_I18N, { context: this.options.context });
}

// Public API method used by the getter and also by Blueprints
Expand Down
10 changes: 5 additions & 5 deletions generators/entity-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ const { isReservedTableName } = require('../../jdl/jhipster/reserved-keywords');
let useBlueprints;

module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts);
constructor(args, options, features) {
super(args, options, features);

this.entity = opts.context;
this.entity = this.options.context;

this.jhipsterContext = opts.jhipsterContext || opts.context;
this.jhipsterContext = this.options.jhipsterContext || this.options.context;

useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_ENTITY_SERVER, { context: opts.context });
useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_ENTITY_SERVER, { context: this.options.context });
}

// Public API method used by the getter and also by Blueprints
Expand Down
4 changes: 2 additions & 2 deletions generators/entity/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const JHIPSTER_CONFIG_DIR = constants.JHIPSTER_CONFIG_DIR;
let useBlueprints;

class EntityGenerator extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts, { unique: 'argument' });
constructor(args, options, features) {
super(args, options, { unique: 'argument', ...features });

// This makes `name` a required argument.
this.argument('name', {
Expand Down
4 changes: 2 additions & 2 deletions generators/export-jdl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const JSONToJDLConverter = require('../../jdl/converters/json-to-jdl-converter')
const { BASE_NAME } = OptionNames;

module.exports = class extends BaseGenerator {
constructor(args, opts) {
super(args, opts);
constructor(args, options, features) {
super(args, options, features);

this.argument('jdlFile', { type: String, required: false });

Expand Down
4 changes: 2 additions & 2 deletions generators/gae/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const NO_CACHE_PROVIDER = cacheProviders.NO;

let useBlueprints;
module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts);
constructor(args, options, features) {
super(args, options, features);
useBlueprints = !this.fromBlueprint && this.instantiateBlueprints(GENERATOR_GAE);
}

Expand Down
6 changes: 3 additions & 3 deletions generators/generator-base-blueprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const { mergeBlueprints, parseBluePrints, loadBlueprintsFromConfiguration, norma
* The method signatures in public API should not be changed without a major version change
*/
module.exports = class JHipsterBaseBlueprintGenerator extends BaseGenerator {
constructor(args, opts, features) {
super(args, opts, features);
constructor(args, options, features) {
super(args, options, features);

if (this.options.help) {
return;
Expand All @@ -49,7 +49,7 @@ module.exports = class JHipsterBaseBlueprintGenerator extends BaseGenerator {
this.blueprintConfig = this.blueprintStorage.createProxy();

// jhipsterContext is the original generator
this.jhipsterContext = opts.jhipsterContext;
this.jhipsterContext = this.options.jhipsterContext;

if (this.jhipsterContext) {
// Fallback to the original generator if the file does not exists in the blueprint.
Expand Down
4 changes: 2 additions & 2 deletions generators/generator-base-docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const { Options: DeploymentOptions } = require('../jdl/jhipster/deployment-optio
const { JWT_SECRET_KEY } = OptionNames;

module.exports = class extends BlueprintBaseGenerator {
constructor(args, opts, features) {
super(args, opts, features);
constructor(args, options, features) {
super(args, options, features);

// This adds support for a `--skip-checks` flag
this.option('skip-checks', {
Expand Down
4 changes: 2 additions & 2 deletions generators/generator-base-private.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const { SPRING_WEBSOCKET } = require('../jdl/jhipster/websocket-types');
* The method signatures in private API can be changed without a major version change.
*/
module.exports = class JHipsterBasePrivateGenerator extends Generator {
constructor(args, opts, features) {
super(args, opts, features);
constructor(args, options, features) {
super(args, options, features);
// expose lodash to templates
this._ = _;
}
Expand Down
4 changes: 2 additions & 2 deletions generators/generator-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ const NO_WEBSOCKET = websocketTypes.FALSE;
* The method signatures in public API should not be changed without a major version change
*/
module.exports = class JHipsterBaseGenerator extends PrivateBase {
constructor(args, opts, features) {
super(args, opts, features);
constructor(args, options, features) {
super(args, options, features);

if (!this.features.jhipsterModular) {
// This adds support for a `--from-cli` flag
Expand Down
1 change: 1 addition & 0 deletions generators/generator-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

const Generators = {
GENERATOR_ADD: 'add',
GENERATOR_APP: 'app',
GENERATOR_AWS: 'aws',
GENERATOR_BOOTSTRAP: 'bootstrap',
GENERATOR_AZURE_APP_SERVICE: 'azure-app-service',
Expand Down
4 changes: 2 additions & 2 deletions generators/gradle/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const { BUILD_TOOL, BUILD_DESTINATION } = require('../java/constants.cjs');
const MixedChain = generateMixedChain(GENERATOR_JAVA);

module.exports = class extends MixedChain {
constructor(args, opts, features) {
super(args, opts, { jhipsterModular: true, unique: 'namespace', ...features });
constructor(args, options, features) {
super(args, options, { jhipsterModular: true, unique: 'namespace', ...features });

// Register options available to cli.
if (!this.fromBlueprint) {
Expand Down
4 changes: 2 additions & 2 deletions generators/heroku/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const execCmd = util.promisify(ChildProcess.exec);
let useBlueprints;

module.exports = class extends BaseBlueprintGenerator {
constructor(args, opts) {
super(args, opts);
constructor(args, options, features) {
super(args, options, features);

this.option('skip-build', {
desc: 'Skips building the application',
Expand Down
4 changes: 2 additions & 2 deletions generators/info/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const BaseGenerator = require('../generator-base');
// stderr unlike yeoman's log() so that user can easily redirect output to a file.
/* eslint-disable no-console */
module.exports = class extends BaseGenerator {
constructor(args, options) {
super(args, options, { unique: 'namespace' });
constructor(args, options, features) {
super(args, options, { unique: 'namespace', ...features });

this.option('skipCommit', {
desc: 'Skip commit',
Expand Down
4 changes: 2 additions & 2 deletions generators/init/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const { dependencyChain } = require('./mixin.cjs');
const MixedChain = generateMixedChain(GENERATOR_INIT);

module.exports = class extends MixedChain {
constructor(args, opts, features) {
super(args, opts, { jhipsterModular: true, unique: 'namespace', ...features });
constructor(args, options, features) {
super(args, options, { jhipsterModular: true, unique: 'namespace', ...features });

// Register options available to cli.
if (!this.fromBlueprint) {
Expand Down
4 changes: 2 additions & 2 deletions generators/java/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const { dependencyChain } = require('./mixin.cjs');
const MixedChain = generateMixedChain(GENERATOR_JAVA);

module.exports = class extends MixedChain {
constructor(args, opts, features) {
super(args, opts, { jhipsterModular: true, unique: 'namespace', ...features });
constructor(args, options, features) {
super(args, options, { jhipsterModular: true, unique: 'namespace', ...features });

// Register options available to cli.
if (!this.fromBlueprint) {
Expand Down
Loading