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

Improve Framework detection and tests #523

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

ia3andy
Copy link
Collaborator

@ia3andy ia3andy commented Sep 27, 2023

Fixes #520 #519

  • Clean frameworks doc page (some frameworks were too weird to be considered as detected)
  • I added tests to make sure the framework detection is working
  • if we consider the package.json is customized we don't auto add the args (--hmr for angular, ...)
  • for pnpm we remove the '--' to make it work

@ia3andy
Copy link
Collaborator Author

ia3andy commented Sep 27, 2023

@melloware this is another large PR but I think it is another good bunch of improvements for detection and logging

@ia3andy ia3andy force-pushed the fix-detection branch 2 times, most recently from 16932ac to 36cfa06 Compare September 27, 2023 16:12
@ia3andy
Copy link
Collaborator Author

ia3andy commented Sep 27, 2023

This is what the test run prints:

2023-09-27 18:12:43,008 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing react-create-app-exact
2023-09-27 18:12:43,066 DEBUG [io.qua.qui.dep.fra.FrameworkType] (main) Detected framework with dev command perfect match: REACT
2023-09-27 18:12:43,135 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

2023-09-27 18:12:43,150 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing react-create-app-different-dev-script
2023-09-27 18:12:43,152 DEBUG [io.qua.qui.dep.fra.FrameworkType] (main) Detected framework with dev command perfect match: REACT
2023-09-27 18:12:43,152 WARN  [io.qua.qui.dep.fra.FrameworkType] (main) REACT framework typically defines a 'start` script in package.json file but found 'dev' instead.
2023-09-27 18:12:43,152 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

2023-09-27 18:12:43,156 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing react-create-app-different-dev-script-envs
2023-09-27 18:12:43,159 WARN  [io.qua.qui.dep.fra.FrameworkType] (main) REACT framework typically defines a 'start` script in package.json file but found 'dev' instead.
2023-09-27 18:12:43,159 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

2023-09-27 18:12:43,165 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing react-create-app-multiple-ok
2023-09-27 18:12:43,167 DEBUG [io.qua.qui.dep.fra.FrameworkType] (main) Detected framework with dev command perfect match: REACT
2023-09-27 18:12:43,167 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

2023-09-27 18:12:43,171 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing react-create-app-multiple-ok-guess
2023-09-27 18:12:43,173 ERROR [io.qua.qui.dep.fra.FrameworkType] (main) Framework detection failed: It is probably REACT framework which typically defines a 'start' script in package.json but found multiple other dev scripts instead (dev, start).
2023-09-27 18:12:43,173 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

2023-09-27 18:12:43,178 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing react-create-app-multiple-ok-guess-command
2023-09-27 18:12:43,180 DEBUG [io.qua.qui.dep.fra.FrameworkType] (main) Detected framework with dev command perfect match: REACT
2023-09-27 18:12:43,181 WARN  [io.qua.qui.dep.fra.FrameworkType] (main) REACT framework typically defines a 'start` script in package.json file but found 'develop' instead.
2023-09-27 18:12:43,181 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

2023-09-27 18:12:43,185 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing react-create-app-multiple-nok
2023-09-27 18:12:43,187 ERROR [io.qua.qui.dep.fra.FrameworkType] (main) Framework detection failed: It is probably REACT framework which typically defines a 'start' script in package.json but found multiple other dev scripts instead (dev, develop).
2023-09-27 18:12:43,187 ERROR [io.qua.qui.dep.fra.FrameworkType] (main) Framework detection failed: It is probably REACT framework which typically defines a 'start' script in package.json but found multiple other dev scripts instead (dev, develop).
2023-09-27 18:12:43,187 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

2023-09-27 18:12:43,191 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing angular-exact
2023-09-27 18:12:43,194 DEBUG [io.qua.qui.dep.fra.FrameworkType] (main) Detected framework with dev command perfect match: ANGULAR
2023-09-27 18:12:43,194 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

2023-09-27 18:12:43,198 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing angular-envs
2023-09-27 18:12:43,200 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

2023-09-27 18:12:43,203 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) Testing angular-args
2023-09-27 18:12:43,204 INFO  [io.qua.qui.dep.fra.FrameworkTypeTest] (main) 

@ia3andy ia3andy requested a review from melloware September 27, 2023 16:13
@ia3andy ia3andy merged commit f373cc1 into quarkiverse:main Sep 27, 2023

private static final Logger LOG = Logger.getLogger(FrameworkTypeTest.class);

@ParameterizedTest
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice use of parameterized test!

import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.StringJoiner;
Copy link
Contributor

Choose a reason for hiding this comment

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

I just learned something new. I have been using Commons Lang StringUtils.join for years didn't know it was in the JDK now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Angular no longer works with 2.2.0.CR1 (pnpm)
2 participants