Skip to content

Commit

Permalink
Merge pull request #10450 from murdos/remove-common-client
Browse files Browse the repository at this point in the history
refactor(client-common): remove ClientsModulesFactory that was only containing lintstaged configuration
  • Loading branch information
murdos authored Jul 29, 2024
2 parents 37b3de5 + 5366cd5 commit 361a1e8
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 40 deletions.
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)
.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

0 comments on commit 361a1e8

Please sign in to comment.