Skip to content

Commit 57ac750

Browse files
authored
script adjusts (#28176)
1 parent ea92a73 commit 57ac750

File tree

5 files changed

+35
-35
lines changed

5 files changed

+35
-35
lines changed

generators/cypress/generator.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import { cypressEntityFiles, cypressFiles } from './files.js';
2727

2828
const { ANGULAR } = clientFrameworkTypes;
2929

30+
const WAIT_TIMEOUT = 3 * 60000;
31+
3032
export default class CypressGenerator extends BaseApplicationGenerator {
3133
async beforeQueue() {
3234
if (!this.fromBlueprint) {
@@ -188,22 +190,28 @@ export default class CypressGenerator extends BaseApplicationGenerator {
188190
},
189191

190192
configure({ application }) {
193+
const { devServerPort, devServerPortProxy: devServerPortE2e = devServerPort } = application;
194+
191195
const clientPackageJson = this.createStorage(this.destinationPath(application.clientRootDir!, 'package.json'));
192196
clientPackageJson.merge({
193197
devDependencies: {
194198
'eslint-plugin-cypress': application.nodeDependencies['eslint-plugin-cypress'],
195199
},
196200
scripts: {
201+
'ci:e2e:run': 'concurrently -k -s first -n application,e2e -c red,blue npm:ci:e2e:server:start npm:e2e:headless',
202+
'ci:e2e:dev': `concurrently -k -s first -n application,e2e -c red,blue npm:app:start npm:e2e:headless`,
203+
cypress: 'cypress open --e2e',
197204
e2e: 'npm run e2e:cypress:headed --',
198-
'e2e:headless': 'npm run e2e:cypress --',
199-
'e2e:cypress:headed': 'npm run e2e:cypress -- --headed',
200205
'e2e:cypress': 'cypress run --e2e --browser chrome',
206+
'e2e:cypress:headed': 'npm run e2e:cypress -- --headed',
201207
'e2e:cypress:record': 'npm run e2e:cypress -- --record',
202-
cypress: 'cypress open --e2e',
208+
'e2e:dev': `concurrently -k -s first -n application,e2e -c red,blue npm:app:start npm:e2e`,
209+
'e2e:devserver': `concurrently -k -s first -n backend,frontend,e2e -c red,yellow,blue npm:backend:start npm:start "wait-on -t ${WAIT_TIMEOUT} http-get://127.0.0.1:${devServerPortE2e} && npm run e2e:headless -- -c baseUrl=http://localhost:${devServerPortE2e}"`,
210+
'pree2e:headless': 'npm run ci:server:await',
211+
'e2e:headless': 'npm run e2e:cypress --',
203212
},
204213
});
205214
},
206-
207215
configureAudits({ application }) {
208216
if (!application.cypressAudit) return;
209217
const clientPackageJson = this.createStorage(this.destinationPath(application.clientRootDir!, 'package.json'));
@@ -220,7 +228,7 @@ export default class CypressGenerator extends BaseApplicationGenerator {
220228
});
221229
},
222230
configureCoverage({ application, source }) {
223-
const { cypressCoverage, clientFrameworkAngular, dasherizedBaseName } = application;
231+
const { cypressCoverage, clientFrameworkAngular, clientRootDir, dasherizedBaseName } = application;
224232
if (!cypressCoverage) return;
225233
const clientPackageJson = this.createStorage(this.destinationPath(application.clientRootDir!, 'package.json'));
226234
clientPackageJson.merge({
@@ -241,7 +249,10 @@ export default class CypressGenerator extends BaseApplicationGenerator {
241249
});
242250
if (clientFrameworkAngular) {
243251
// Add 'ng build --configuration instrumenter' support
244-
this.createStorage('angular.json').setPath(`projects.${dasherizedBaseName}.architect.build.configurations.instrumenter`, {});
252+
this.createStorage(`${clientRootDir}angular.json`).setPath(
253+
`projects.${dasherizedBaseName}.architect.build.configurations.instrumenter`,
254+
{},
255+
);
245256
source.addWebpackConfig?.({
246257
config: `targetOptions.configuration === 'instrumenter'
247258
? {

generators/java/generators/node/generator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export default class NodeGenerator extends BaseApplicationGenerator {
9595
blocks: [
9696
{
9797
condition: (ctx: any) => ctx.useNpmWrapper,
98-
transform: false,
9998
templates: ['npmw', 'npmw.cmd'],
10099
},
101100
],

generators/java/generators/node/templates/npmw.cmd renamed to generators/java/generators/node/templates/npmw.cmd.ejs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ setlocal
44

55
set NPMW_DIR=%~dp0
66

7-
if exist "%NPMW_DIR%mvnw.cmd" (
8-
set NODE_EXE=^"^"
9-
set NODE_PATH=%NPMW_DIR%target\node\
10-
set NPM_EXE=^"%NPMW_DIR%target\node\npm.cmd^"
11-
set INSTALL_NPM_COMMAND=^"%NPMW_DIR%mvnw.cmd^" -Pwebapp frontend:install-node-and-npm@install-node-and-npm
12-
) else (
13-
set NODE_EXE=^"%NPMW_DIR%build\node\bin\node.exe^"
14-
set NODE_PATH=%NPMW_DIR%build\node\bin\
15-
set NPM_EXE=^"%NPMW_DIR%build\node\lib\node_modules\npm\bin\npm-cli.js^"
16-
set INSTALL_NPM_COMMAND=^"%NPMW_DIR%gradlew.bat^" npmSetup
17-
)
7+
<%_ if (buildToolMaven) { _%>
8+
set NODE_EXE=^"^"
9+
set NODE_PATH=%NPMW_DIR%target\node\
10+
set NPM_EXE=^"%NPMW_DIR%target\node\npm.cmd^"
11+
set INSTALL_NPM_COMMAND=^"%NPMW_DIR%mvnw.cmd^" -Pwebapp frontend:install-node-and-npm@install-node-and-npm
12+
<%_ } else if (buildToolGradle) { _%>
13+
set NODE_EXE=^"%NPMW_DIR%build\node\bin\node.exe^"
14+
set NODE_PATH=%NPMW_DIR%build\node\bin\
15+
set NPM_EXE=^"%NPMW_DIR%build\node\lib\node_modules\npm\bin\npm-cli.js^"
16+
set INSTALL_NPM_COMMAND=^"%NPMW_DIR%gradlew.bat^" npmSetup --no-daemon
17+
<%_ } _%>
1818

1919
if not exist %NPM_EXE% (
2020
call %INSTALL_NPM_COMMAND%

generators/java/generators/node/templates/npmw renamed to generators/java/generators/node/templates/npmw.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
basedir=$(dirname "$0")
44

5+
<%_ if (buildToolMaven) { _%>
56
if [ -f "$basedir/mvnw" ]; then
67
bindir="$basedir/target/node"
78
repodir="$basedir/target/node/node_modules"
89
installCommand="$basedir/mvnw --batch-mode -ntp -Pwebapp frontend:install-node-and-npm@install-node-and-npm"
9-
elif [ -f "$basedir/gradlew" ]; then
10+
<%_ } else if (buildToolGradle) { _%>
11+
if [ -f "$basedir/gradlew" ]; then
1012
bindir="$basedir/build/node/bin"
1113
repodir="$basedir/build/node/lib/node_modules"
12-
installCommand="$basedir/gradlew npmSetup"
14+
installCommand="$basedir/gradlew npmSetup --no-daemon"
15+
<%_ } _%>
1316
else
1417
echo "Using npm installed globally"
1518
exec npm "$@"

generators/java/generators/server/generator.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ export default class ServerGenerator extends BaseApplicationGenerator {
4949
if (buildTool === 'maven') {
5050
const excludeWebapp = application.skipClient ? '' : ' -Dskip.installnodenpm -Dskip.npm';
5151
scriptsStorage.set({
52-
'app:start': './mvnw',
52+
'app:start': './mvnw -ntp --batch-mode',
5353
'backend:info': './mvnw --version',
5454
'backend:doc:test': './mvnw -ntp javadoc:javadoc --batch-mode',
5555
'backend:nohttp:test': './mvnw -ntp checkstyle:check --batch-mode',
56-
'backend:start': `./mvnw${excludeWebapp}`,
56+
'backend:start': `./mvnw${excludeWebapp} -ntp --batch-mode`,
5757
'java:jar': './mvnw -ntp verify -DskipTests --batch-mode',
5858
'java:war': './mvnw -ntp verify -DskipTests --batch-mode -Pwar',
5959
'java:docker': './mvnw -ntp verify -DskipTests -Pprod jib:dockerBuild',
@@ -98,9 +98,7 @@ export default class ServerGenerator extends BaseApplicationGenerator {
9898
});
9999
},
100100
packageJsonE2eScripts({ application }) {
101-
const { devServerPort, devServerPortProxy: devServerPortE2e = devServerPort } = application;
102101
const scriptsStorage = this.packageJson.createStorage('scripts');
103-
const buildCmd = application.buildToolGradle ? 'gradlew' : 'mvnw -ntp';
104102

105103
let applicationWaitTimeout = WAIT_TIMEOUT * (application.applicationTypeGateway ? 2 : 1);
106104
applicationWaitTimeout = application.authenticationTypeOauth2 ? applicationWaitTimeout * 2 : applicationWaitTimeout;
@@ -110,17 +108,6 @@ export default class ServerGenerator extends BaseApplicationGenerator {
110108
scriptsStorage.set({
111109
'ci:server:await': `echo "Waiting for server at port $npm_package_config_backend_port to start" && wait-on -t ${applicationWaitTimeout} ${applicationEndpoint} && echo "Server at port $npm_package_config_backend_port started"`,
112110
});
113-
114-
// TODO add e2eTests property to application.
115-
if (this.jhipsterConfig.testFrameworks?.includes('cypress')) {
116-
scriptsStorage.set({
117-
'pree2e:headless': 'npm run ci:server:await',
118-
'ci:e2e:run': 'concurrently -k -s first -n application,e2e -c red,blue npm:ci:e2e:server:start npm:e2e:headless',
119-
'ci:e2e:dev': `concurrently -k -s first -n application,e2e -c red,blue "./${buildCmd}" npm:e2e:headless`,
120-
'e2e:dev': `concurrently -k -s first -n application,e2e -c red,blue "./${buildCmd}" npm:e2e`,
121-
'e2e:devserver': `concurrently -k -s first -n backend,frontend,e2e -c red,yellow,blue npm:backend:start npm:start "wait-on -t ${WAIT_TIMEOUT} http-get://127.0.0.1:${devServerPortE2e} && npm run e2e:headless -- -c baseUrl=http://localhost:${devServerPortE2e}"`,
122-
});
123-
}
124111
},
125112
});
126113
}

0 commit comments

Comments
 (0)