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

Split README fragments #23599

Merged
merged 1 commit into from
Sep 23, 2023
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
9 changes: 6 additions & 3 deletions generators/app/__snapshots__/generator.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ exports[`generator - app with default config should match snapshot 1`] = `
"zookeeperTag": "zookeeper-tag-placeholder",
},
"dockerServicesDir": "src/main/docker/",
"documentationArchiveUrl": "https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION",
"domains": [
"com.mycompany.myapp",
],
Expand Down Expand Up @@ -395,7 +396,7 @@ exports[`generator - app with default config should match snapshot 1`] = `
"jhiTablePrefix": "jhi",
"jhipsterDependenciesVersion": "JHIPSTER_DEPENDENCIES_VERSION",
"jhipsterPackageJson": Any<Object>,
"jhipsterVersion": undefined,
"jhipsterVersion": "JHIPSTER_VERSION",
"jwtSecretKey": "SECRET--64",
"languages": [
"en",
Expand Down Expand Up @@ -846,6 +847,7 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"zookeeperTag": "zookeeper-tag-placeholder",
},
"dockerServicesDir": "src/main/docker/",
"documentationArchiveUrl": "https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION",
"domains": [
"com.mycompany.myapp",
],
Expand Down Expand Up @@ -948,7 +950,7 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"jhiTablePrefix": "jhi",
"jhipsterDependenciesVersion": "JHIPSTER_DEPENDENCIES_VERSION",
"jhipsterPackageJson": Any<Object>,
"jhipsterVersion": undefined,
"jhipsterVersion": "JHIPSTER_VERSION",
"jwtSecretKey": Any<String>,
"languages": [
"en",
Expand Down Expand Up @@ -1399,6 +1401,7 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"zookeeperTag": "zookeeper-tag-placeholder",
},
"dockerServicesDir": "src/main/docker/",
"documentationArchiveUrl": "https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION",
"domains": [
"com.mycompany.myapp",
],
Expand Down Expand Up @@ -1501,7 +1504,7 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"jhiTablePrefix": "jhi",
"jhipsterDependenciesVersion": "JHIPSTER_DEPENDENCIES_VERSION",
"jhipsterPackageJson": Any<Object>,
"jhipsterVersion": undefined,
"jhipsterVersion": "JHIPSTER_VERSION",
"jwtSecretKey": Any<String>,
"languages": [
"en",
Expand Down
3 changes: 2 additions & 1 deletion generators/app/support/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getDBTypeFromDBValue } from '../../server/support/index.mjs';
import detectLanguage from '../../languages/support/detect-language.mjs';
import { loadConfig, loadDerivedConfig } from '../../../lib/internal/index.mjs';
import serverCommand from '../../server/command.mjs';
import { packageJson } from '../../../lib/index.mjs';

const { GATLING, CUCUMBER, CYPRESS } = testFrameworkTypes;
const { GATEWAY, MONOLITH } = applicationTypes;
Expand Down Expand Up @@ -87,7 +88,7 @@ export const loadAppConfig = ({
application.nodeVersion = NODE_VERSION;
}

application.jhipsterVersion = config.jhipsterVersion;
application.jhipsterVersion = useVersionPlaceholders ? 'JHIPSTER_VERSION' : config.jhipsterVersion ?? packageJson.version;
application.baseName = config.baseName;
application.reactive = config.reactive;
application.jhiPrefix = config.jhiPrefix;
Expand Down
1 change: 1 addition & 0 deletions generators/base-application/types.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type BaseApplication = {
hipster: string;
lowercaseBaseName: string;
upperFirstCamelCaseBaseName: string;
documentationArchiveUrl: string;

projectVersion: string;
projectDescription: string;
Expand Down
2 changes: 2 additions & 0 deletions generators/bootstrap-application/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { preparePostEntityServerDerivedProperties } from '../server/support/inde
import { getDefaultAppName } from '../project-name/support/index.mjs';
import { packageJson } from '../../lib/index.mjs';
import { loadStoredAppOptions } from '../app/support/index.mjs';
import { JHIPSTER_DOCUMENTATION_ARCHIVE_PATH, JHIPSTER_DOCUMENTATION_URL } from '../generator-constants.mjs';

const {
Validations: { MAX, MIN, MAXLENGTH, MINLENGTH, MAXBYTES, MINBYTES, PATTERN },
Expand Down Expand Up @@ -91,6 +92,7 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera
prettierExtensions = `${prettierExtensions},java`;
}
application.prettierExtensions = prettierExtensions;
application.documentationArchiveUrl = `${JHIPSTER_DOCUMENTATION_URL}${JHIPSTER_DOCUMENTATION_ARCHIVE_PATH}v${application.jhipsterVersion}`;
},
});
}
Expand Down
8 changes: 4 additions & 4 deletions generators/ci-cd/__snapshots__/ci-cd.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ gradle-package:
exports[`generator - CI-CD GitLab CI tests GitLab CI: Maven Angular NPM inside Docker should match files snapshot 1`] = `
{
".gitlab-ci.yml": {
"contents": "image: jhipster/jhipster:v
"contents": "image: jhipster/jhipster:vJHIPSTER_VERSION

cache:
key: "$CI_COMMIT_REF_NAME"
Expand Down Expand Up @@ -1963,7 +1963,7 @@ deploy-to-production:
exports[`generator - CI-CD GitLab CI tests GitLab CI: Maven Angular Yarn inside Docker Autoconfigure should match files snapshot 1`] = `
{
".gitlab-ci.yml": {
"contents": "image: jhipster/jhipster:v
"contents": "image: jhipster/jhipster:vJHIPSTER_VERSION

cache:
key: "$CI_COMMIT_REF_NAME"
Expand Down Expand Up @@ -2074,7 +2074,7 @@ maven-package:
exports[`generator - CI-CD GitLab CI tests GitLab CI: npm skip server should match files snapshot 1`] = `
{
".gitlab-ci.yml": {
"contents": "image: jhipster/jhipster:v
"contents": "image: jhipster/jhipster:vJHIPSTER_VERSION

before_script:
- export NG_CLI_ANALYTICS="false"
Expand Down Expand Up @@ -2410,7 +2410,7 @@ node {
checkout scm
}

docker.image('jhipster/jhipster:v').inside('-u jhipster -e MAVEN_OPTS="-Duser.home=./"') {
docker.image('jhipster/jhipster:vJHIPSTER_VERSION').inside('-u jhipster -e MAVEN_OPTS="-Duser.home=./"') {
stage('check java') {
sh "java -version"
}
Expand Down
151 changes: 7 additions & 144 deletions generators/common/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -96,166 +96,29 @@ overrides:
"README.md": {
"contents": "# jhipster

This application was generated using JHipster , you can find documentation and help at [https://www.jhipster.tech/documentation-archive/vundefined](https://www.jhipster.tech/documentation-archive/vundefined).

## Project Structure

Node is required for generation and recommended for development. \`package.json\` is always generated for a better development experience with prettier, commit hooks, scripts and so on.

In the project root, JHipster generates configuration files for tools like git, prettier, eslint, husky, and others that are well known and you can find references in the web.


\`/src/*\` structure follows default Java structure.

- \`.yo-rc.json\` - Yeoman configuration file
JHipster configuration is stored in this file at \`generator-jhipster\` key. You may find \`generator-jhipster-*\` for specific blueprints configuration.
- \`.yo-resolve\` (optional) - Yeoman conflict resolver
Allows to use a specific action when conflicts are found skipping prompts for files that matches a pattern. Each line should match \`[pattern] [action]\` with pattern been a [Minimatch](https://github.com/isaacs/minimatch#minimatch) pattern and action been one of skip (default if ommited) or force. Lines starting with \`#\` are considered comments and are ignored.
- \`.jhipster/*.json\` - JHipster entity configuration files

- \`npmw\` - wrapper to use locally installed npm.
JHipster installs Node and npm locally using the build tool by default. This wrapper makes sure npm is installed locally and uses it avoiding some differences different versions can cause. By using \`./npmw\` instead of the traditional \`npm\` you can configure a Node-less environment to develop or test your application.
- \`/src/main/docker\` - Docker configurations for the application and services that the application depends on

## Development


### JHipster Control Center

JHipster Control Center can help you manage and control your application(s). You can start a local control center server (accessible on http://localhost:7419) with:

\`\`\`
docker compose -f src/main/docker/jhipster-control-center.yml up
\`\`\`



## Building for production

### Packaging as jar

To build the final jar and optimize the jhipster application for production, run:

\`\`\`
./mvnw -Pprod clean verify
\`\`\`

This will concatenate and minify the client CSS and JavaScript files. It will also modify \`index.html\` so it references these new files.
To ensure everything worked, run:

\`\`\`
java -jar target/*.jar
\`\`\`

Then navigate to [http://localhost:8080](http://localhost:8080) in your browser.

Refer to [Using JHipster in production][] for more details.

### Packaging as war

To package your application as a war in order to deploy it to an application server, run:

\`\`\`
./mvnw -Pprod,war clean verify
\`\`\`


## Testing

To launch your application's tests, run:

\`\`\`
./mvnw verify
\`\`\`


For more information, refer to the [Running tests page][].

### Code quality

Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with:

\`\`\`
docker compose -f src/main/docker/sonar.yml up -d
\`\`\`

Note: we have turned off forced authentication redirect for UI in [src/main/docker/sonar.yml](src/main/docker/sonar.yml) for out of the box experience while trying out SonarQube, for real use cases turn it back on.

You can run a Sonar analysis with using the [sonar-scanner](https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner) or by using the maven plugin.

Then, run a Sonar analysis:

\`\`\`
./mvnw -Pprod clean verify sonar:sonar -Dsonar.login=admin -Dsonar.password=admin
\`\`\`

If you need to re-run the Sonar phase, please be sure to specify at least the \`initialize\` phase since Sonar properties are loaded from the sonar-project.properties file.

\`\`\`
./mvnw initialize sonar:sonar -Dsonar.login=admin -Dsonar.password=admin
\`\`\`

Additionally, Instead of passing \`sonar.password\` and \`sonar.login\` as CLI arguments, these parameters can be configured from [sonar-project.properties](sonar-project.properties) as shown below:

\`\`\`
sonar.login=admin
sonar.password=admin
\`\`\`

For more information, refer to the [Code quality page][].

## Using Docker to simplify development (optional)

You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the [src/main/docker](src/main/docker) folder to launch required third party services.

For example, to start a postgresql database in a docker container, run:

\`\`\`
docker compose -f src/main/docker/postgresql.yml up -d
\`\`\`

To stop it and remove the container, run:

\`\`\`
docker compose -f src/main/docker/postgresql.yml down
\`\`\`

You can also fully dockerize your application and all the services that it depends on.
To achieve this, first build a docker image of your app by running:

\`\`\`
npm run java:docker
\`\`\`

Or build a arm64 docker image when using an arm64 processor os like MacOS with M1 processor family running:

\`\`\`
npm run java:docker:arm64
\`\`\`

Then run:

\`\`\`
docker compose -f src/main/docker/app.yml up -d
\`\`\`

When running Docker Desktop on MacOS Big Sur or later, consider enabling experimental \`Use the new Virtualization framework\` for better processing performance ([disk access performance is worse](https://github.com/docker/roadmap/issues/7)).

For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (\`jhipster docker-compose\`), which is able to generate docker configurations for one or several JHipster applications.

## Continuous Integration (optional)

To configure CI for your project, run the ci-cd sub-generator (\`jhipster ci-cd\`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information.


[JHipster Homepage and latest documentation]: https://www.jhipster.tech
[JHipster archive]: https://www.jhipster.tech/documentation-archive/vundefined
[Using JHipster in development]: https://www.jhipster.tech/documentation-archive/vundefined/development/
[Using Docker and Docker-Compose]: https://www.jhipster.tech/documentation-archive/vundefined/docker-compose
[Using JHipster in production]: https://www.jhipster.tech/documentation-archive/vundefined/production/
[Running tests page]: https://www.jhipster.tech/documentation-archive/vundefined/running-tests/
[Code quality page]: https://www.jhipster.tech/documentation-archive/vundefined/code-quality/
[Setting up Continuous Integration]: https://www.jhipster.tech/documentation-archive/vundefined/setting-up-ci/
[JHipster JHIPSTER_VERSION archive]: https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION
[Using JHipster in development]: https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION/development/
[Using Docker and Docker-Compose]: https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION/docker-compose
[Using JHipster in production]: https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION/production/
[Running tests page]: https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION/running-tests/
[Code quality page]: https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION/code-quality/
[Setting up Continuous Integration]: https://www.jhipster.tech/documentation-archive/vJHIPSTER_VERSION/setting-up-ci/

[Node.js]: https://nodejs.org/
[NPM]: https://www.npmjs.com/
Expand Down
Loading