Skip to content

Commit

Permalink
chore: replace explicit creation of TextReplacer with text() shortcut…
Browse files Browse the repository at this point in the history
…, now using notContainingReplacement() strategy
  • Loading branch information
murdos committed Sep 19, 2024
1 parent 203007a commit c596226
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static tech.jhipster.lite.module.domain.JHipsterModule.*;
import static tech.jhipster.lite.module.domain.npm.JHLiteNpmVersionSource.COMMON;
import static tech.jhipster.lite.module.domain.npm.JHLiteNpmVersionSource.VUE;
import static tech.jhipster.lite.module.domain.replacement.ReplacementCondition.notContainingReplacement;

import java.util.function.Consumer;
import tech.jhipster.lite.module.domain.Indentation;
Expand All @@ -12,7 +11,6 @@
import tech.jhipster.lite.module.domain.file.JHipsterSource;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;
import tech.jhipster.lite.module.domain.replacement.MandatoryReplacer;
import tech.jhipster.lite.module.domain.replacement.TextReplacer;
import tech.jhipster.lite.shared.error.domain.Assert;

public class VueModulesFactory {
Expand Down Expand Up @@ -142,7 +140,7 @@ private Consumer<JHipsterModuleBuilder> patchTsConfig(JHipsterModuleProperties p
.add(text("@tsconfig/recommended/tsconfig.json"), "@vue/tsconfig/tsconfig.dom.json")
.add(tsConfigCompilerOption("sourceMap", true, properties.indentation()))
.add(tsConfigCompilerOption("allowJs", true, properties.indentation()))
.add(new TextReplacer(notContainingReplacement(), "\"types\": ["), "\"types\": [\"vite/client\", ")
.add(text("\"types\": ["), "\"types\": [\"vite/client\", ")
.and()
.and();
//@formatter:on
Expand All @@ -159,7 +157,7 @@ private Consumer<JHipsterModuleBuilder> patchVitestConfig(JHipsterModuleProperti
.mandatoryReplacements()
.in(path("vitest.config.ts"))
.add(lineAfterRegex("from 'vitest/config';"), "import vue from '@vitejs/plugin-vue';")
.add(new TextReplacer(notContainingReplacement(), "plugins: ["), "plugins: [vue(), ")
.add(text("plugins: ["), "plugins: [vue(), ")
.add(text("environment: 'node',"), "environment: 'jsdom',")
.add(vitestCoverageExclusion(properties,"src/main/webapp/**/*.component.ts"))
.add(vitestCoverageExclusion(properties,"src/main/webapp/app/router.ts"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package tech.jhipster.lite.generator.server.springboot.locale_profile.domain;

import static tech.jhipster.lite.module.domain.JHipsterModule.*;
import static tech.jhipster.lite.module.domain.replacement.ReplacementCondition.notContainingReplacement;

import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.buildproperties.PropertyKey;
import tech.jhipster.lite.module.domain.buildproperties.PropertyValue;
import tech.jhipster.lite.module.domain.mavenplugin.MavenPlugin;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;
import tech.jhipster.lite.module.domain.replacement.TextReplacer;
import tech.jhipster.lite.shared.error.domain.Assert;

public class LocalProfileModuleFactory {
Expand Down Expand Up @@ -58,12 +56,12 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.and()
.optionalReplacements()
.in(path(".github/workflows/github-actions.yml"))
.add(new TextReplacer(notContainingReplacement(), "./mvnw clean verify"), "./mvnw clean verify -P'!local'")
.add(new TextReplacer(notContainingReplacement(), "./gradlew clean integrationTest --no-daemon"), "./gradlew clean integrationTest -Pprofile=local --no-daemon")
.add(text("./mvnw clean verify"), "./mvnw clean verify -P'!local'")
.add(text("./gradlew clean integrationTest --no-daemon"), "./gradlew clean integrationTest -Pprofile=local --no-daemon")
.and()
.in(path(".gitlab-ci.yml"))
.add(new TextReplacer(notContainingReplacement(), "./mvnw clean verify"), "./mvnw clean verify -P'!local'")
.add(new TextReplacer(notContainingReplacement(), "./gradlew clean integrationTest $GRADLE_CLI_OPTS"), "./gradlew clean integrationTest -Pprofile=local $GRADLE_CLI_OPTS")
.add(text("./mvnw clean verify"), "./mvnw clean verify -P'!local'")
.add(text("./gradlew clean integrationTest $GRADLE_CLI_OPTS"), "./gradlew clean integrationTest -Pprofile=local $GRADLE_CLI_OPTS")
.and()
.and()
.build();
Expand Down

0 comments on commit c596226

Please sign in to comment.