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

More blueprint adjusts. #23921

Merged
merged 3 commits into from
Oct 20, 2023
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
1 change: 1 addition & 0 deletions generators/app/__snapshots__/generator.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Options:
--enable-translation Enable translation
-l, --language <value...> Language to be added to application (existing languages are not removed)
-n, --native-language [value] Set application native language
--regenerate-languages Regenerate languages
-h, --help display help for command
"
`;
Expand Down
2 changes: 1 addition & 1 deletion generators/common/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ trim_trailing_whitespace = false
",
"stateCleared": "modified",
},
".lintstagedrc.js": {
".lintstagedrc.cjs": {
"contents": "module.exports = {
'{,**/}*.{md,json,yml,html,cjs,mjs,js,ts,tsx,css,scss,java}': ['prettier --write'],
};
Expand Down
2 changes: 1 addition & 1 deletion generators/common/files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const commonFiles = {
commitHooks: [
{
condition: generator => !generator.skipCommitHook,
templates: ['.lintstagedrc.js', '.husky/pre-commit'],
templates: ['.lintstagedrc.cjs', '.husky/pre-commit'],
},
],
};
Expand Down
5 changes: 5 additions & 0 deletions generators/common/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ export default class CommonGenerator extends BaseApplicationGenerator {
this.removeFile('npmw.cmd');
}
}
if (this.isJhipsterVersionLessThan('8.0.0-rc.2')) {
if (!application.skipCommitHook) {
this.removeFile('.lintstagedrc.js');
}
}
},
writePrettierConfig({ application }) {
return this.writeFiles({
Expand Down
2 changes: 1 addition & 1 deletion generators/common/generator.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe(`generator - ${generator}`, () => {
});

it('uses custom prettier formatting to js file', () => {
runResult.assertFileContent('.lintstagedrc.js', / {10}'{/);
runResult.assertFileContent('.lintstagedrc.cjs', / {10}'{/);
});
});
});
Expand Down
1 change: 1 addition & 0 deletions generators/jdl/__snapshots__/generator.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Options:
--enable-translation Enable translation
-l, --language <value...> Language to be added to application (existing languages are not removed)
-n, --native-language [value] Set application native language
--regenerate-languages Regenerate languages
--workspaces-folders <value...> Folders to use as monorepository workspace
--workspaces Generate workspaces for multiples applications
-h, --help display help for command
Expand Down
5 changes: 5 additions & 0 deletions generators/languages/command.mts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ const command: JHipsterCommandDefinition = {
type: String,
required: false,
},
regenerateLanguages: {
description: 'Regenerate languages',
type: Boolean,
scope: 'generator',
},
},
};

Expand Down
3 changes: 2 additions & 1 deletion generators/languages/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default class LanguagesGenerator extends BaseApplicationGenerator {
composedBlueprints;
languageCommand;
writeJavaLanguageFiles;
regenerateLanguages;

constructor(args, options, features) {
super(args, options, features);
Expand Down Expand Up @@ -191,7 +192,7 @@ export default class LanguagesGenerator extends BaseApplicationGenerator {
return this.asPreparingTaskGroup({
prepareForTemplates({ application, source }) {
if (application.enableTranslation) {
if (!this.languageCommand) {
if (!this.languageCommand || this.regenerateLanguages) {
this.languagesToApply = application.languages;
} else {
this.languagesToApply = [...new Set(this.languagesToApply || [])];
Expand Down
2 changes: 1 addition & 1 deletion generators/server/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ exports[`generator - server with entities should match files snapshot 1`] = `
".jhipster/Foo.json": {
"stateCleared": "modified",
},
".lintstagedrc.js": {
".lintstagedrc.cjs": {
"stateCleared": "modified",
},
".mvn/jvm.config": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public class SecurityConfiguration {
// prettier-ignore
authz
<%_ if (!skipClient) { _%>
.requestMatchers(mvc.pattern("/index.html"), mvc.pattern("/*.js"), mvc.pattern("/*.map"), mvc.pattern("/*.css")).permitAll()
.requestMatchers(mvc.pattern("/index.html"), mvc.pattern("/*.js"), mvc.pattern("/*.txt"), mvc.pattern("/*.json"), mvc.pattern("/*.map"), mvc.pattern("/*.css")).permitAll()
.requestMatchers(mvc.pattern("/*.ico"), mvc.pattern("/*.png"), mvc.pattern("/*.svg"), mvc.pattern("/*.webapp")).permitAll()
<%_ if (clientFrameworkVue) { _%>
.requestMatchers(mvc.pattern("/assets/**")).permitAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ public class SecurityConfiguration {
<%_ if (microfrontend) { _%>
// microfrontend resources are loaded by webpack without authentication, they need to be public
.pathMatchers("/services/*/*.js").permitAll()
.pathMatchers("/services/*/*.txt").permitAll()
.pathMatchers("/services/*/*.json").permitAll()
.pathMatchers("/services/*/*.js.map").permitAll()
<%_ } _%>
.pathMatchers("/services/*/management/health/readiness").permitAll()
Expand Down