Skip to content

Commit a40730b

Browse files
authored
Merge branch 'master' into jh9499
2 parents afa07eb + 75dfd62 commit a40730b

File tree

214 files changed

+1264
-932
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+1264
-932
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Support this project by becoming a sponsor! [Become a sponsor](https://opencolle
3030

3131
[![Blokt][blokt-image]][blokt-url]
3232

33+
[![Clay][clay-image]][clay-url]
34+
3335
**Thank you to all our backers!**
3436

3537
[![Backers][backers-image]][backers-url]
@@ -101,6 +103,8 @@ Additional builds at [hipster-labs/jhipster-daily-builds](https://github.com/hip
101103
[codefirst-url]: https://www.codefirst.co.uk
102104
[blokt-image]: https://www.jhipster.tech/images/open-collective/blokt.png
103105
[blokt-url]: https://blokt.com/
106+
[clay-image]: https://www.jhipster.tech/images/open-collective/clay.png
107+
[clay-url]: https://clay.global/
104108
[issue-template]: https://github.com/jhipster/generator-jhipster/issues/new?template=BUG_REPORT.md
105109
[feature-template]: https://github.com/jhipster/generator-jhipster/issues/new?template=FEATURE_REQUEST.md
106110
[npmcharts-image]: https://img.shields.io/npm/dm/generator-jhipster.svg?label=Downloads&style=flat

cli/commands.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@
1717
* limitations under the License.
1818
*/
1919
const chalk = require('chalk');
20+
const jhipsterUtils = require('../generators/utils');
2021

2122
let customCommands = {};
2223
const indexOfBlueprintArgv = process.argv.indexOf('--blueprint');
2324
if (indexOfBlueprintArgv > -1) {
2425
/* eslint-disable import/no-dynamic-require */
2526
/* eslint-disable global-require */
2627

27-
const blueprint = process.argv[indexOfBlueprintArgv + 1];
28+
const blueprint = jhipsterUtils.normalizeBlueprintName(process.argv[indexOfBlueprintArgv + 1]);
2829
try {
29-
customCommands = require(`generator-jhipster-${blueprint}/cli/commands`);
30+
customCommands = require(`${blueprint}/cli/commands`);
3031
} catch (e) {
31-
const msg = `No custom command found within blueprint: generator-jhipster-${blueprint}`;
32+
const msg = `No custom command found within blueprint: ${blueprint}`;
3233
/* eslint-disable no-console */
3334
console.info(`${chalk.green.bold('INFO!')} ${msg}`);
3435
}

cli/utils.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const log = function(msg) {
4242
};
4343

4444
const error = function(msg, trace) {
45-
console.error(`${chalk.red.bold('ERROR!')} ${chalk.red(msg)}`);
45+
console.error(`${chalk.red(msg)}`);
4646
if (trace) {
4747
console.log(trace);
4848
}
@@ -178,8 +178,12 @@ const getCommandOptions = (pkg, argv) => {
178178
return { 'from-cli': true };
179179
};
180180

181-
const done = () => {
182-
logger.info(chalk.green.bold('Congratulations, JHipster execution is complete!'));
181+
const done = errorMsg => {
182+
if (errorMsg) {
183+
logger.error(`${chalk.red.bold('ERROR!')} ${errorMsg}`);
184+
} else {
185+
logger.info(chalk.green.bold('Congratulations, JHipster execution is complete!'));
186+
}
183187
};
184188

185189
const createYeomanEnv = () => {

generators/app/index.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const cleanup = require('../cleanup');
2323
const prompts = require('./prompts');
2424
const packagejs = require('../../package.json');
2525
const statistics = require('../statistics');
26+
const jhipsterUtils = require('../utils');
2627

2728
module.exports = class extends BaseGenerator {
2829
constructor(args, opts) {
@@ -157,7 +158,7 @@ module.exports = class extends BaseGenerator {
157158

158159
// This adds support for a `--blueprint` flag which can be used to specify a blueprint to use for generation
159160
this.option('blueprint', {
160-
desc: '[BETA] Specify a generator blueprint to use for the sub generators',
161+
desc: 'Specify a generator blueprint to use for the sub generators',
161162
type: String
162163
});
163164

@@ -188,7 +189,7 @@ module.exports = class extends BaseGenerator {
188189

189190
this.withEntities = this.options['with-entities'];
190191
this.skipChecks = this.options['skip-checks'];
191-
const blueprint = this.normalizeBlueprintName(this.options.blueprint || this.config.get('blueprint'));
192+
const blueprint = jhipsterUtils.normalizeBlueprintName(this.options.blueprint || this.config.get('blueprint'));
192193
this.blueprint = this.configOptions.blueprint = blueprint;
193194
this.useNpm = this.configOptions.useNpm = !this.options.yarn;
194195
this.useYarn = !this.useNpm;
@@ -238,9 +239,7 @@ module.exports = class extends BaseGenerator {
238239

239240
validate() {
240241
if (this.skipServer && this.skipClient) {
241-
this.error(
242-
chalk.red(`You can not pass both ${chalk.yellow('--skip-client')} and ${chalk.yellow('--skip-server')} together`)
243-
);
242+
this.error(`You can not pass both ${chalk.yellow('--skip-client')} and ${chalk.yellow('--skip-server')} together`);
244243
}
245244
},
246245

@@ -288,8 +287,6 @@ module.exports = class extends BaseGenerator {
288287
get prompting() {
289288
return {
290289
askForInsightOptIn: prompts.askForInsightOptIn,
291-
// TODO : enable this. It's a bit messy for now, it need better sync.
292-
// askForAccountLinking: prompts.askForAccountLinking,
293290
askForApplicationType: prompts.askForApplicationType,
294291
askForModuleName: prompts.askForModuleName
295292
};
@@ -334,12 +331,6 @@ module.exports = class extends BaseGenerator {
334331
this.configOptions.clientPackageManager = this.clientPackageManager;
335332
},
336333

337-
// composeAccountLinking() {
338-
// if (!this.linkAccount) return;
339-
340-
// this.composeWith(require.resolve('../link-account'));
341-
// },
342-
343334
composeServer() {
344335
if (this.skipServer) return;
345336
const options = this.options;

generators/app/prompts.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const statistics = require('../statistics');
2222
module.exports = {
2323
askForInsightOptIn,
2424
askForApplicationType,
25-
askForAccountLinking,
2625
askForModuleName,
2726
askFori18n,
2827
askForTestOpts,
@@ -46,21 +45,6 @@ function askForInsightOptIn() {
4645
});
4746
}
4847

49-
function askForAccountLinking() {
50-
const done = this.async();
51-
52-
this.prompt({
53-
when: () => !statistics.isLinked && !statistics.optOut,
54-
type: 'confirm',
55-
name: 'linkAccount',
56-
message: `Would you like to link your ${chalk.cyan('JHipster Online')} account, to get access to and manage your own stats?`,
57-
default: false
58-
}).then(prompt => {
59-
this.linkAccount = true;
60-
done();
61-
});
62-
}
63-
6448
function askForApplicationType(meta) {
6549
if (!meta && this.existingProject) return;
6650

generators/aws/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module.exports = class extends BaseGenerator {
7474
this.dbEngine = 'postgres';
7575
break;
7676
default:
77-
this.error(chalk.red('Sorry deployment for this database is not possible'));
77+
this.error('Sorry deployment for this database is not possible');
7878
}
7979
}
8080
};
@@ -116,7 +116,7 @@ module.exports = class extends BaseGenerator {
116116

117117
const child = this.buildApplication(this.buildTool, 'prod', err => {
118118
if (err) {
119-
this.error(chalk.red(err));
119+
this.error(err);
120120
} else {
121121
cb();
122122
}
@@ -136,9 +136,9 @@ module.exports = class extends BaseGenerator {
136136
s3.createBucket({ bucket: this.bucketName }, (err, data) => {
137137
if (err) {
138138
if (err.message == null) {
139-
this.error(chalk.red('The S3 bucket could not be created. Are you sure its name is not already used?'));
139+
this.error('The S3 bucket could not be created. Are you sure its name is not already used?');
140140
} else {
141-
this.error(chalk.red(err.message));
141+
this.error(err.message);
142142
}
143143
} else {
144144
this.log(data.message);
@@ -160,7 +160,7 @@ module.exports = class extends BaseGenerator {
160160

161161
s3.uploadJar(params, (err, data) => {
162162
if (err) {
163-
this.error(chalk.red(err.message));
163+
this.error(err.message);
164164
} else {
165165
this.jarKey = data.jarKey;
166166
this.log(data.message);
@@ -185,7 +185,7 @@ module.exports = class extends BaseGenerator {
185185

186186
rds.createDatabase(params, (err, data) => {
187187
if (err) {
188-
this.error(chalk.red(err.message));
188+
this.error(err.message);
189189
} else {
190190
this.log(data.message);
191191
cb();
@@ -210,7 +210,7 @@ module.exports = class extends BaseGenerator {
210210

211211
rds.createDatabaseUrl(params, (err, data) => {
212212
if (err) {
213-
this.error(chalk.red(err.message));
213+
this.error(err.message);
214214
} else {
215215
this.dbUrl = data.dbUrl;
216216
this.log(data.message);
@@ -225,7 +225,7 @@ module.exports = class extends BaseGenerator {
225225
const iam = this.awsFactory.getIam();
226226
iam.verifyRoles({}, err => {
227227
if (err) {
228-
this.error(chalk.red(err.message));
228+
this.error(err.message);
229229
} else {
230230
cb();
231231
}
@@ -251,7 +251,7 @@ module.exports = class extends BaseGenerator {
251251

252252
eb.createApplication(params, (err, data) => {
253253
if (err) {
254-
this.error(chalk.red(err.message));
254+
this.error(err.message);
255255
} else {
256256
this.log(data.message);
257257
cb();

generators/ci-cd/templates/.gitlab-ci.yml.ejs

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -116,28 +116,19 @@ gradle-package:
116116
artifacts:
117117
paths:
118118
- build/libs/*.jar
119+
- build/classes
119120
expire_in: 1 day
120121
121122
# Uncomment the following line to use gitlabs container registry. You need to adapt the REGISTRY_URL in case you are not using gitlab.com
122123
#docker-push:
123-
# image: docker:latest
124-
# services:
125-
# - docker:dind
124+
# stage: release
126125
# variables:
127126
# REGISTRY_URL: registry.gitlab.com
128-
# DOCKER_HOST: tcp://docker:2375
129-
# DOCKER_DRIVER: overlay2
130127
# IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
131-
# stage: release
132128
# dependencies:
133129
# - gradle-package
134-
# before_script:
135-
# - docker info
136-
# - cp build/libs/*.jar src/main/docker
137130
# script:
138-
# - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $REGISTRY_URL
139-
# - docker build -f src/main/docker/Dockerfile -t $IMAGE_TAG src/main/docker
140-
# - docker push $IMAGE_TAG
131+
# - ./gradlew jib -Djib.to.image="$IMAGE_TAG" -Djib.to.auth.username="gitlab-ci-token" -Djib.to.auth.password="$CI_BUILD_TOKEN"
141132
142133
<%_ if (cicdIntegrations.includes('heroku')) { _%>
143134
deploy-to-production:
@@ -218,28 +209,20 @@ maven-package:
218209
artifacts:
219210
paths:
220211
- target/*.jar
212+
- target/classes
221213
expire_in: 1 day
222214
223215
# Uncomment the following line to use gitlabs container registry. You need to adapt the REGISTRY_URL in case you are not using gitlab.com
224216
#docker-push:
225-
# image: docker:latest
226-
# services:
227-
# - docker:dind
217+
# stage: release
228218
# variables:
229219
# REGISTRY_URL: registry.gitlab.com
230-
# DOCKER_HOST: tcp://docker:2375
231-
# DOCKER_DRIVER: overlay2
232220
# IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
233-
# stage: release
234221
# dependencies:
235222
# - maven-package
236-
# before_script:
237-
# - docker info
238-
# - cp target/*.jar src/main/docker
239223
# script:
240-
# - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $REGISTRY_URL
241-
# - docker build -f src/main/docker/Dockerfile -t $IMAGE_TAG src/main/docker
242-
# - docker push $IMAGE_TAG
224+
# - ./mvnw jib:build -Djib.to.image=$IMAGE_TAG -Djib.to.auth.username=gitlab-ci-token -Djib.to.auth.password=$CI_BUILD_TOKEN
225+
243226
<%_ if (cicdIntegrations.includes('heroku')) { _%>
244227
deploy-to-production:
245228
stage: deploy

generators/ci-cd/templates/jenkins/Jenkinsfile.ejs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,16 @@ node {
154154
<%_ if (cicdIntegrations.includes('publishDocker')) { _%>
155155
156156
<%= gitLabIndent %> def dockerImage
157-
<%= gitLabIndent %> stage('build docker') {
157+
<%= gitLabIndent %> stage('publish docker') {
158+
<%= gitLabIndent %> // A pre-requisite to this step is to setup authentication to the docker registry
158159
<%_ if (buildTool === 'maven') { _%>
159-
<%= gitLabIndent %> sh "cp -R src/main/docker target/"
160-
<%= gitLabIndent %> sh "cp target/*.jar target/docker/"
161-
<%= gitLabIndent %> dockerImage = docker.build('<%= dockerRegistryOrganizationName %>/<%= baseName.toLowerCase() %>', 'target/docker')
160+
<%= gitLabIndent %> // https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#authentication-methods
161+
<%= gitLabIndent %> sh "./mvnw jib:build"
162162
<%_ } else if (buildTool === 'gradle' ) { _%>
163-
<%= gitLabIndent %> sh "cp -R src/main/docker build/"
164-
<%= gitLabIndent %> sh "cp build/libs/*.jar build/docker/"
165-
<%= gitLabIndent %> dockerImage = docker.build('<%= dockerRegistryOrganizationName %>/<%= baseName.toLowerCase() %>', 'build/docker')
163+
<%= gitLabIndent %> // https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin#authentication-methods
164+
<%= gitLabIndent %> sh "./gradlew jib"
166165
<%_ } _%>
167166
<%= gitLabIndent %> }
168-
169-
<%= gitLabIndent %> stage('publish docker') {
170-
<%= gitLabIndent %> docker.withRegistry('<%= dockerRegistryURL %>', '<%= dockerRegistryCredentialsId %>') {
171-
<%= gitLabIndent %> dockerImage.push 'latest'
172-
<%= gitLabIndent %> }
173-
<%= gitLabIndent %> }
174167
<%_ } _%>
175168
<%_ if (sendBuildToGitlab) { _%>
176169
}

generators/client/files-angular.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ const files = {
176176
angularAccountModule: [
177177
{
178178
path: ANGULAR_DIR,
179-
condition: generator => generator.authenticationType !== 'oauth2',
179+
condition: generator => !generator.skipUserManagement,
180180
templates: [
181181
'account/index.ts',
182182
{ file: 'account/account.route.ts', method: 'processJs' },
@@ -208,7 +208,7 @@ const files = {
208208
]
209209
},
210210
{
211-
condition: generator => generator.authenticationType === 'session',
211+
condition: generator => generator.authenticationType === 'session' && !generator.skipUserManagement,
212212
path: ANGULAR_DIR,
213213
templates: [
214214
{ file: 'account/sessions/sessions.route.ts', method: 'processJs' },
@@ -219,7 +219,7 @@ const files = {
219219
]
220220
},
221221
{
222-
condition: generator => generator.authenticationType !== 'oauth2',
222+
condition: generator => !generator.skipUserManagement,
223223
path: ANGULAR_DIR,
224224
templates: ['account/password/password-strength-bar.scss']
225225
}
@@ -419,7 +419,7 @@ const files = {
419419
]
420420
},
421421
{
422-
condition: generator => generator.authenticationType !== 'oauth2',
422+
condition: generator => !generator.skipUserManagement,
423423
path: TEST_SRC_DIR,
424424
templates: [
425425
'spec/app/account/activate/activate.component.spec.ts',
@@ -428,12 +428,14 @@ const files = {
428428
'spec/app/account/password-reset/init/password-reset-init.component.spec.ts',
429429
'spec/app/account/password-reset/finish/password-reset-finish.component.spec.ts',
430430
'spec/app/account/register/register.component.spec.ts',
431-
'spec/app/account/settings/settings.component.spec.ts',
432-
// login component tests
433-
'spec/app/shared/login/login.component.spec.ts',
434-
'spec/app/shared/alert/alert-error.component.spec.ts'
431+
'spec/app/account/settings/settings.component.spec.ts'
435432
]
436433
},
434+
{
435+
condition: generator => generator.authenticationType !== 'oauth2',
436+
path: TEST_SRC_DIR,
437+
templates: ['spec/app/shared/login/login.component.spec.ts', 'spec/app/shared/alert/alert-error.component.spec.ts']
438+
},
437439
{
438440
condition: generator => generator.databaseType !== 'no' && generator.databaseType !== 'cassandra',
439441
path: TEST_SRC_DIR,
@@ -452,7 +454,7 @@ const files = {
452454
]
453455
},
454456
{
455-
condition: generator => generator.authenticationType === 'session',
457+
condition: generator => generator.authenticationType === 'session' && !generator.skipUserManagement,
456458
path: TEST_SRC_DIR,
457459
templates: ['spec/app/account/sessions/sessions.component.spec.ts']
458460
},

0 commit comments

Comments
 (0)