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

update generator-jhipster to v8.7.1 #23

Merged
merged 6 commits into from
Sep 27, 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
6 changes: 3 additions & 3 deletions .github/workflows/generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: jhipster/actions/setup-git@v0
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: 'npm'
- run: git config --global user.name "JHipster Bot"; git config --global user.email "[email protected]"; git config --global init.defaultBranch main
- run: npm ci
- run: npm run test
20 changes: 20 additions & 0 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ jobs:
node-version: 20
generate-command: npx --yes [email protected] --defaults
migrate-command: jhipster-migrate
- tests: j8.3.0
node-version: 20
generate-command: npx --yes [email protected] --defaults
migrate-command: jhipster-migrate
- tests: j8.4.0
node-version: 20
generate-command: npx --yes [email protected] --defaults
migrate-command: jhipster-migrate
- tests: j8.5.0
node-version: 20
generate-command: npx --yes [email protected] --defaults
migrate-command: jhipster-migrate
- tests: j8.6.0
node-version: 20
generate-command: npx --yes [email protected] --defaults
migrate-command: jhipster-migrate
- tests: j8.7.0
node-version: 20
generate-command: npx --yes [email protected] --defaults
migrate-command: jhipster-migrate
defaults:
run:
working-directory: ${{ github.workspace }}/app
Expand Down
7 changes: 3 additions & 4 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Prettier configuration

printWidth: 140
singleQuote: true
tabWidth: 2
useTabs: false

# js and ts rules:
arrowParens: avoid
bracketSameLine: false
plugins:
- prettier-plugin-packagejson
3 changes: 2 additions & 1 deletion .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
}
},
"githubWorkflows": true,
"jhipsterVersion": "7.7.0",
"jhipsterVersion": "8.7.1",
"js": true,
"localBlueprint": false,
"packageJsonType": "module",
"prettierDefaultIndent": 2,
"projectName": "JHipster Migrate Blueprint",
"sampleWritten": true,
Expand Down
3 changes: 0 additions & 3 deletions .yo-resolve
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
.blueprint/** skip
.github/workflows/** skip
generators/** skip
README.md skip
cli/cli.cjs skip
5 changes: 5 additions & 0 deletions cli/cli-customizations.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This file will not be overwritten by generate-blueprint
module.exports = {
blueprints: undefined,
defaultCommand: 'migrate',
};
14 changes: 10 additions & 4 deletions cli/cli.cjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/env node

const { dirname, join } = require('path');
const { dirname, basename, join } = require('path');
const { version, bin } = require('../package.json');

// Get package name to use as namespace.
// Allows blueprints to be aliased.
const packagePath = dirname(__dirname);
const packageFolderName = basename(packagePath);
const devBlueprintPath = join(packagePath, '.blueprint');
const blueprint = packageFolderName.startsWith('jhipster-') ? `generator-${packageFolderName}` : packageFolderName;

(async () => {
const { runJHipster, done, logger } = await import('generator-jhipster/cli');
Expand All @@ -15,14 +17,18 @@ const devBlueprintPath = join(packagePath, '.blueprint');
runJHipster({
executableName,
executableVersion: version,
defaultCommand: 'migrate',
defaultCommand: 'app',
devBlueprintPath,
commands: require('./commands.cjs'),
blueprints: {
[blueprint]: version,
},
printBlueprintLogo: () => {
console.log('===================== JHipster migrate =====================');
console.log('===================== JHipster Migrate =====================');
console.log('');
},
lookups: [{ packagePaths: [packagePath] }],
commands: require('./commands.cjs'),
...require('./cli-customizations.cjs'),
}).catch(done);

process.on('unhandledRejection', up => {
Expand Down
14 changes: 10 additions & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import globals from 'globals';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import jhipsterRecommended from 'generator-jhipster/eslint/recommended';
import prettier from 'eslint-plugin-prettier/recommended';
import jhipster from 'generator-jhipster/eslint/recommended';

// Workaround for jhipster export issue.
delete jhipster.recommended.recommended;
// jhipster-needle-eslint-add-import - JHipster will add additional import here

export default [
{
Expand All @@ -10,6 +14,8 @@ export default [
},
},
},
jhipsterRecommended,
prettierRecommended,
{ ignores: ['coverage/**'] },
jhipster.recommended,
// jhipster-needle-eslint-add-config - JHipster will add additional config here
prettier,
];
11 changes: 4 additions & 7 deletions generators/migrate/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import chalk from 'chalk';

const choices = '(none, current, bundled, any npm version)';

/**
* @type {import('generator-jhipster').JHipsterCommandDefinition}
*/
const command = {
import { asCommand } from 'generator-jhipster';

export default asCommand({
options: {},
configs: {
sourceCli: {
Expand Down Expand Up @@ -86,6 +85,4 @@ const command = {
scope: 'generator',
},
},
};

export default command;
});
16 changes: 8 additions & 8 deletions generators/migrate/generator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { setTimeout } from 'timers/promises';
import { readFile, rm, readdir, appendFile } from 'fs/promises';
import { appendFile, readFile, readdir, rm } from 'fs/promises';
import { join } from 'path';
import chalk from 'chalk';
import { transform } from 'p-transform';
Expand All @@ -15,28 +15,28 @@ import { ResetMode } from 'simple-git';
import BaseGenerator from 'generator-jhipster/generators/base-application';
import getNode from 'get-node';
import {
createPrettierTransform,
createESLintTransform,
createPrettierTransform,
createRemoveUnusedImportsTransform,
} from 'generator-jhipster/generators/bootstrap/support';
import packageVersions from 'pkg-versions';

import { GENERATOR_JHIPSTER } from 'generator-jhipster';
import { GENERATOR_BOOTSTRAP } from 'generator-jhipster/generators';
import {
ACTUAL_APPLICATION,
BASE_APPLICATION,
DEFAULT_CLI_OPTIONS,
DEFAULT_CLI_OPTIONS_V7,
GIT_DRIVER_PACKAGEJSON,
GIT_DRIVER_PACKAGEJSON_REF,
GIT_VERSION_NOT_ALLOW_MERGE_UNRELATED_HISTORIES,
MIGRATE_SOURCE_BRANCH,
JSON_DRIVER_GIT_CONFIG,
MIGRATE_CONFIG_FILE,
MIGRATE_SOURCE_BRANCH,
MIGRATE_TARGET_BRANCH,
MIGRATE_TMP_FOLDER,
SERVER_MAIN_RES_DIR,
JSON_DRIVER_GIT_CONFIG,
GIT_DRIVER_PACKAGEJSON,
GIT_DRIVER_PACKAGEJSON_REF,
ACTUAL_APPLICATION,
BASE_APPLICATION,
V7_NODE,
} from './constants.js';
import command from './command.js';
Expand Down
12 changes: 7 additions & 5 deletions generators/migrate/generator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { beforeAll, describe, expect, it } from 'vitest';
import simpleGit from 'simple-git';
import { escapeRegExp } from 'lodash-es';

import { basicHelpers as helpers } from 'generator-jhipster/testing';
import { basicHelpers as helpers, runResult } from 'generator-jhipster/testing';

/**
* @return {import('simple-git').SimpleGit}
Expand All @@ -17,17 +17,19 @@ const SUB_GENERATOR_NAMESPACE = `jhipster-migrate:${SUB_GENERATOR}`;
describe('SubGenerator migrate of migrate JHipster blueprint', () => {
describe('default application', () => {
beforeAll(async () => {
const context = await helpers
await helpers
.runJHipster('app')
.withOptions({
skipGit: false,
})
.withJHipsterConfig({
baseName: 'upgradeTest',
skipCommitHook: true,
skipClient: true,
skipServer: true,
})
.withParentBlueprintLookup();
});

await context
await runResult
.create(SUB_GENERATOR_NAMESPACE)
.withOptions({
sourceVersion: 'bundled',
Expand Down
Loading