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

simplify upgrade generator #25203

Merged
merged 2 commits into from
Feb 15, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 4 additions & 10 deletions cli/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,10 @@ const __dirname = dirname(__filename);
const currentNodeVersion = process.versions.node;
const minimumNodeVersion = packageJson.engines.node;

if (!process.argv.includes('--skip-checks')) {
if (
!semver.satisfies(currentNodeVersion, minimumNodeVersion) &&
// Allow upgrade to be executed using node 16 due to https://github.com/jhipster/generator-jhipster/issues/20349
(!process.argv.includes('upgrade') || !semver.satisfies(currentNodeVersion, '^16.0.0'))
) {
logger.fatal(
`You are running Node version ${currentNodeVersion}\nJHipster requires Node version ${minimumNodeVersion}\nPlease update your version of Node.`,
);
}
if (!process.argv.includes('--skip-checks') && !semver.satisfies(currentNodeVersion, minimumNodeVersion)) {
logger.fatal(
`You are running Node version ${currentNodeVersion}\nJHipster requires Node version ${minimumNodeVersion}\nPlease update your version of Node.`,
);
}

const appFolderOrWorkspaceRoot = existsSync('../node_modules') ? join(process.cwd(), '..') : process.cwd();
Expand Down
15 changes: 15 additions & 0 deletions generators/upgrade/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# upgrade sub-generador

Upgrades the application the a newer generator-jhipster version.

The upgrade process generates 4 commits.

- the reference application
- a merge commit with unrelated histories
- the upgrade application
- a merge commit to apply the upgrade commit to the existing application

## Upgrading from v7

To upgrade to v8 you need to upgrade to v7.9.4 before due to node v18/v20 compatibility.
If you use blueprint that uses jhipster v7, you need to use [jhipster-migrate](https://github.com/jhipster/generator-jhipster-migrate/).
9 changes: 5 additions & 4 deletions generators/upgrade/USAGE
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Description:
Updates JHipster version, and upgrades generated application
Upgrades generated application

Example:

jhipster upgrade

Assuming you have Git installed, and you run this command in the Git branch you are using for development, JHipster Upgrader will :
- checkout a "jhipster_upgrade" branch
- update generator-jhipster via npm
- regenerate your whole application
- switch back to your development branch, and start the merge
- generate a application upgrade reference
- apply the reference point to your application
- generate the upgraded application
- switch back to your original branch and merge the upgrade branch into it
10 changes: 0 additions & 10 deletions generators/upgrade/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ import { JHipsterCommandDefinition } from '../base/api.js';

const command: JHipsterCommandDefinition = {
options: {
targetJhipsterVersion: {
name: 'targetVersion',
description: 'Upgrade to a specific version instead of the latest',
type: String,
scope: 'generator',
},
targetBlueprintVersions: {
description: 'Upgrade to specific blueprint versions instead of the latest, e.g. --target-blueprint-versions foo@0.0.1,bar@1.0.2',
type: String,
},
silent: {
description: 'Hides output of the generation process',
type: Boolean,
Expand Down