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

move creation of .npmrc file to the init module #10889

Merged
merged 3 commits into from
Sep 18, 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 @@ -14,8 +14,6 @@ public class AngularModuleFactory {

private static final JHipsterSource SOURCE = from("client/angular/core");

private static final JHipsterSource SOURCE_COMMON = from("client/common");

private static final String ENGINES_NEEDLE = " \"engines\":";
private static final PackageName ANGULAR_CORE_PACKAGE = packageName("@angular/core");

Expand Down Expand Up @@ -76,9 +74,6 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.add(SOURCE.template("angular.json"), to("angular.json"))
.add(SOURCE.file("tsconfig.json"), to("tsconfig.json"))
.add(SOURCE.file("tsconfig.app.json"), to("tsconfig.app.json"))
.batch(SOURCE_COMMON, to("."))
.addFile(".npmrc")
.and()
.batch(SOURCE, to("."))
.addTemplate("eslint.config.mjs")
.addTemplate("proxy.conf.json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
public class ReactCoreModulesFactory {

private static final JHipsterSource SOURCE = from("client/react/core");
private static final JHipsterSource SOURCE_COMMON = from("client/common");

private static final JHipsterSource WEBAPP_SOURCE = SOURCE.append("src/main/webapp");
private static final JHipsterDestination WEBAPP_DESTINATION = to("src/main/webapp");
Expand Down Expand Up @@ -79,9 +78,6 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.addTemplate("vitest.config.ts")
.addTemplate("eslint.config.js")
.and()
.batch(SOURCE_COMMON, to("."))
.addFile(".npmrc")
.and()
.batch(APP_SOURCE, APP_DESTINATION)
.addTemplate("index.css")
.addTemplate("index.tsx")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class InitModuleFactory {

private static final JHipsterSource SOURCE = from("init");
private static final JHipsterDestination DESTINATION = to(".");
private static final JHipsterSource SOURCE_COMMON = from("client/common");

private final NpmVersions npmVersions;

Expand All @@ -38,6 +39,9 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.addTemplate(".editorconfig")
.addFile(".lintstagedrc.cjs")
.and()
.batch(SOURCE_COMMON, DESTINATION)
.addFile(".npmrc")
.and()
.addExecutable(SOURCE.append(".husky").file("pre-commit"), DESTINATION.append(".husky/pre-commit"))
.add(SOURCE.file("gitignore"), to(".gitignore"))
.add(SOURCE.file("gitattributes"), to(".gitattributes"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
public class TypescriptModuleFactory {

private static final JHipsterSource SOURCE = from("typescript");
private static final JHipsterSource SOURCE_COMMON = from("client/common");

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
Assert.notNull("properties", properties);
Expand Down Expand Up @@ -42,9 +41,6 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.addScript(scriptKey("watch:test"), scriptCommand("vitest --"))
.and()
.files()
.batch(SOURCE_COMMON, to("."))
.addFile(".npmrc")
.and()
.batch(SOURCE, to("."))
.addFile("tsconfig.json")
.addTemplate("vitest.config.ts")
Expand Down
1 change: 1 addition & 0 deletions src/test/features/init.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Feature: Init
| package.json |
| README.md |
| .lintstagedrc.cjs |
| .npmrc |
And I should not have files in ""
| .prettierignore |
| .prettierrc |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void shouldCreateAngularModule() {
"tsconfig.app.json",
"tsconfig.spec.json",
"proxy.conf.json",
".npmrc",
"eslint.config.mjs"
)
.hasPrefixedFiles(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void shouldBuildModuleWithStyle() {
"""
)
.and()
.hasFiles("tsconfig.json", "vite.config.ts", "vitest.config.ts", ".npmrc", "eslint.config.js")
.hasFiles("tsconfig.json", "vite.config.ts", "vitest.config.ts", "eslint.config.js")
.hasFiles("src/main/webapp/index.html")
.hasPrefixedFiles("src/main/webapp/app", "index.css", "index.tsx", "vite-env.d.ts")
.hasFiles("src/test/webapp/unit/common/primary/app/App.spec.tsx")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ void shouldBuildModule() {
.and()
.hasFile(".lintstagedrc.cjs")
.and()
.hasExecutableFiles(".husky/pre-commit");
.hasExecutableFiles(".husky/pre-commit")
.hasFile(".npmrc");
}

private JHipsterModuleProperties properties(String folder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ void shouldCreateTypescriptModule() {
.containing(nodeScript("watch:tsc", "tsc --noEmit --watch"))
.containing(nodeScript("lint", "eslint ."))
.and()
.hasPrefixedFiles("", ".npmrc", "eslint.config.js", "tsconfig.json");
.hasPrefixedFiles("", "eslint.config.js", "tsconfig.json");
}
}