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

refactor(client-common): remove ClientsModulesFactory that was only containing lintstaged configuration #10450

Merged
merged 1 commit into from
Jul 29, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static tech.jhipster.lite.module.domain.packagejson.VersionSource.ANGULAR;
import static tech.jhipster.lite.module.domain.packagejson.VersionSource.COMMON;

import tech.jhipster.lite.generator.client.common.domain.ClientsModulesFactory;
import tech.jhipster.lite.module.domain.Indentation;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.file.JHipsterSource;
Expand All @@ -22,7 +21,12 @@ public class AngularModuleFactory {

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
//@formatter:off
return ClientsModulesFactory.clientModuleBuilder(properties)
return moduleBuilder(properties)
.optionalReplacements()
.in(path(".lintstagedrc.cjs"))
.add(lineBeforeRegex("\\['prettier --write'\\]"), " '{src/**/,}*.ts': ['eslint --fix'],")
.and()
.and()
.gitIgnore()
.comment("Angular")
.pattern(".angular/")
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static tech.jhipster.lite.module.domain.packagejson.VersionSource.COMMON;
import static tech.jhipster.lite.module.domain.packagejson.VersionSource.REACT;

import tech.jhipster.lite.generator.client.common.domain.ClientsModulesFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.file.JHipsterDestination;
import tech.jhipster.lite.module.domain.file.JHipsterSource;
Expand All @@ -31,7 +30,12 @@ public class ReactCoreModulesFactory {

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
//@formatter:off
return ClientsModulesFactory.clientModuleBuilder(properties)
return moduleBuilder(properties)
.optionalReplacements()
.in(path(".lintstagedrc.cjs"))
.add(lineBeforeRegex("\\['prettier --write'\\]"), " '{src/**/,}*.{ts,tsx}': ['eslint --fix'],")
.and()
.and()
.packageJson()
.addDevDependency(packageName("@testing-library/dom"), REACT)
.addDevDependency(packageName("@testing-library/react"), REACT)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package tech.jhipster.lite.generator.client.svelte.core.domain;

import static tech.jhipster.lite.generator.client.common.domain.ClientsModulesFactory.clientModuleBuilder;
import static tech.jhipster.lite.module.domain.JHipsterModule.*;
import static tech.jhipster.lite.module.domain.packagejson.VersionSource.SVELTE;

Expand Down Expand Up @@ -28,7 +27,12 @@ public JHipsterModule buildSvelteModule(JHipsterModuleProperties properties) {
Assert.notNull("properties", properties);

//@formatter:off
return clientModuleBuilder(properties)
return moduleBuilder(properties)
.optionalReplacements()
.in(path(".lintstagedrc.cjs"))
.add(lineBeforeRegex("\\['prettier --write'\\]"), " '{src/**/,}*.ts': ['eslint --fix'],")
.and()
.and()
.gitIgnore()
.comment("Svelte")
.pattern(".svelte-kit/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static tech.jhipster.lite.module.domain.packagejson.VersionSource.COMMON;
import static tech.jhipster.lite.module.domain.packagejson.VersionSource.VUE;

import tech.jhipster.lite.generator.client.common.domain.ClientsModulesFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.file.JHipsterDestination;
import tech.jhipster.lite.module.domain.file.JHipsterSource;
Expand Down Expand Up @@ -42,7 +41,12 @@ public class VueModulesFactory {

public JHipsterModule buildVueModule(JHipsterModuleProperties properties) {
//@formatter:off
return ClientsModulesFactory.clientModuleBuilder(properties)
return moduleBuilder(properties)
.optionalReplacements()
.in(path(".lintstagedrc.cjs"))
.add(lineBeforeRegex("\\['prettier --write'\\]"), " '{src/**/,}*.{ts,vue}': ['eslint --fix'],")
.and()
.and()
.documentation(documentationTitle("Vue"), DOCUMENTATION_SOURCE.file("vue.md"))
.packageJson()
.addType("module")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static tech.jhipster.lite.module.domain.packagejson.VersionSource.COMMON;

import java.util.regex.Pattern;
import tech.jhipster.lite.generator.client.common.domain.ClientsModulesFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.JHipsterProjectFilePath;
import tech.jhipster.lite.module.domain.file.JHipsterDestination;
Expand Down Expand Up @@ -83,7 +82,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
Assert.notNull(PROPERTIES, properties);

//@formatter:off
return ClientsModulesFactory.clientModuleBuilder(properties)
return moduleBuilder(properties)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@renanfranca : I don't think this was useful for Thymeleaf, since eslint is not even a dependency, so it could be missing.
WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my first issue adding the "frontend" module. I remember using lint in the generated project to help me format the template code, but I am not sure if the Client.... class helped me. However, there is a Prettier configuration in the deleted Client.... class.

Maybe I copied and pasted 🤔 and learned while doing...

.documentation(documentationTitle("Thymeleaf"), DOCUMENTATION_SOURCE.template("thymeleaf.md"))
.packageJson()
.addDevDependency(packageName("@babel/cli"), COMMON)
Expand Down Expand Up @@ -128,7 +127,7 @@ public JHipsterModule buildTailwindcssModule(JHipsterModuleProperties properties
Assert.notNull(PROPERTIES, properties);

//@formatter:off
return ClientsModulesFactory.clientModuleBuilder(properties)
return moduleBuilder(properties)
.packageJson()
.addDevDependency(packageName("tailwindcss"), COMMON)
.addScript(scriptKey("watch:html"), scriptCommand("onchange 'src/main/resources/templates/**/*.html' -- npm-run-all --serial build:css build:html"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void shouldCreateAngularModule() {
.containing(
"""
module.exports = {
'{src/**/,}*.{js,ts,tsx,vue}': ['eslint --fix'],
'{src/**/,}*.ts': ['eslint --fix'],
'*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
};
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void shouldBuildModuleWithStyle() {
.containing(
"""
module.exports = {
'{src/**/,}*.{js,ts,tsx,vue}': ['eslint --fix'],
'{src/**/,}*.{ts,tsx}': ['eslint --fix'],
'*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
};
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void shouldCreateVueModule() {
.containing(
"""
module.exports = {
'{src/**/,}*.{js,ts,tsx,vue}': ['eslint --fix'],
'{src/**/,}*.{ts,vue}': ['eslint --fix'],
'*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
};
"""
Expand Down