Skip to content

Commit

Permalink
Merge pull request #25695 from mshima/websocket-dependabot
Browse files Browse the repository at this point in the history
move websocket dependencies to dependabot
  • Loading branch information
DanielFran authored Apr 1, 2024
2 parents 8716b40 + e99b87e commit 7baa49d
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 18 deletions.
28 changes: 28 additions & 0 deletions generators/angular/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,34 @@ export default class AngularGenerator extends BaseApplicationGenerator {
return this.delegateTasksToBlueprint(() => this.writingEntities);
}

get postWriting() {
return this.asPostWritingTaskGroup({
addWebsocketDependencies({ application }) {
const { authenticationTypeSession, communicationSpringWebsocket, nodeDependencies } = application;
const dependencies = {};
if (communicationSpringWebsocket) {
if (authenticationTypeSession) {
dependencies['ngx-cookie-service'] = nodeDependencies['ngx-cookie-service'];
}
this.packageJson.merge({
dependencies: {
'sockjs-client': nodeDependencies['sockjs-client'],
'@stomp/rx-stomp': nodeDependencies['@stomp/rx-stomp'],
...dependencies,
},
devDependencies: {
'@types/sockjs-client': nodeDependencies['@types/sockjs-client'],
},
});
}
},
});
}

get [BaseApplicationGenerator.POST_WRITING]() {
return this.delegateTasksToBlueprint(() => this.postWriting);
}

get postWritingEntities() {
return this.asPostWritingEntitiesTaskGroup({
postWriteEntitiesFiles,
Expand Down
3 changes: 3 additions & 0 deletions generators/angular/resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
"@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "8.0.0",
"@popperjs/core": "2.11.8",
"@stomp/rx-stomp": "1.2.0",
"bootstrap": "5.3.3",
"bootswatch": "5.3.3",
"ngx-cookie-service": "17.1.0",
"ngx-infinite-scroll": "17.0.0",
"rxjs": "7.8.1",
"sockjs-client": "1.6.1",
"tslib": "2.6.2",
"zone.js": "0.14.4"
},
Expand All @@ -25,6 +27,7 @@
"@angular/cli": "17.3.2",
"@types/jest": "29.5.12",
"@types/node": "20.11.25",
"@types/sockjs-client": "1.5.1",
"@typescript-eslint/eslint-plugin": "7.4.0",
"browser-sync": "3.0.2",
"browser-sync-webpack-plugin": "2.3.0",
Expand Down
10 changes: 0 additions & 10 deletions generators/angular/templates/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,9 @@
"bootswatch": "<%= nodeDependencies.bootswatch %>",
<%_ } _%>
"dayjs": "<%= nodeDependencies['dayjs'] %>",
<%_ if (authenticationTypeSession && communicationSpringWebsocket) { _%>
"ngx-cookie-service": "<%= nodeDependencies['ngx-cookie-service'] %>",
<%_ } _%>
"ngx-infinite-scroll": "<%= nodeDependencies['ngx-infinite-scroll'] %>",
"@popperjs/core": "<%= nodeDependencies['@popperjs/core'] %>",
"rxjs": "<%= nodeDependencies['rxjs'] %>",
<%_ if (communicationSpringWebsocket) { _%>
"sockjs-client": "1.6.1",
"@stomp/rx-stomp": "1.2.0",
<%_ } _%>
"tslib": "<%= nodeDependencies['tslib'] %>",
"zone.js": "<%= nodeDependencies['zone.js'] %>"
},
Expand All @@ -71,9 +64,6 @@
<%_ } _%>
"@angular-architects/module-federation": "<%= nodeDependencies['@angular-architects/module-federation'] %>",
<%_ } _%>
<%_ if (communicationSpringWebsocket) { _%>
"@types/sockjs-client": "1.5.1",
<%_ } _%>
<%_ if (cypressTests) { _%>
"cypress": "<%= nodeDependencies['cypress'] %>",
<%_ } _%>
Expand Down
6 changes: 6 additions & 0 deletions generators/app/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,10 @@ exports[`generator - app with default config should match snapshot 1`] = `
"@ngx-translate/core": "NGX_TRANSLATE_CORE_VERSION",
"@ngx-translate/http-loader": "NGX_TRANSLATE_HTTP_LOADER_VERSION",
"@popperjs/core": "POPPERJS_CORE_VERSION",
"@stomp/rx-stomp": "STOMP_RX_STOMP_VERSION",
"@types/jest": "TYPES_JEST_VERSION",
"@types/node": "TYPES_NODE_VERSION",
"@types/sockjs-client": "TYPES_SOCKJS_CLIENT_VERSION",
"@typescript-eslint/eslint-plugin": "TYPESCRIPT_ESLINT_ESLINT_PLUGIN_VERSION",
"babel-loader": "BABEL_LOADER_VERSION",
"babel-plugin-istanbul": "BABEL_PLUGIN_ISTANBUL_VERSION",
Expand Down Expand Up @@ -631,6 +633,7 @@ exports[`generator - app with default config should match snapshot 1`] = `
"prettier-plugin-packagejson": "PRETTIER_PLUGIN_PACKAGEJSON_VERSION",
"rimraf": "RIMRAF_VERSION",
"rxjs": "RXJS_VERSION",
"sockjs-client": "SOCKJS_CLIENT_VERSION",
"swagger-ui-dist": "SWAGGER_UI_DIST_VERSION",
"ts-jest": "TS_JEST_VERSION",
"tslib": "TSLIB_VERSION",
Expand Down Expand Up @@ -1161,8 +1164,10 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"@ngx-translate/core": "NGX_TRANSLATE_CORE_VERSION",
"@ngx-translate/http-loader": "NGX_TRANSLATE_HTTP_LOADER_VERSION",
"@popperjs/core": "POPPERJS_CORE_VERSION",
"@stomp/rx-stomp": "STOMP_RX_STOMP_VERSION",
"@types/jest": "TYPES_JEST_VERSION",
"@types/node": "TYPES_NODE_VERSION",
"@types/sockjs-client": "TYPES_SOCKJS_CLIENT_VERSION",
"@typescript-eslint/eslint-plugin": "TYPESCRIPT_ESLINT_ESLINT_PLUGIN_VERSION",
"babel-loader": "BABEL_LOADER_VERSION",
"babel-plugin-istanbul": "BABEL_PLUGIN_ISTANBUL_VERSION",
Expand Down Expand Up @@ -1200,6 +1205,7 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"prettier-plugin-packagejson": "PRETTIER_PLUGIN_PACKAGEJSON_VERSION",
"rimraf": "RIMRAF_VERSION",
"rxjs": "RXJS_VERSION",
"sockjs-client": "SOCKJS_CLIENT_VERSION",
"swagger-ui-dist": "SWAGGER_UI_DIST_VERSION",
"ts-jest": "TS_JEST_VERSION",
"tslib": "TSLIB_VERSION",
Expand Down
21 changes: 21 additions & 0 deletions generators/react/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,27 @@ export default class ReactGenerator extends BaseApplicationGenerator {
};
}

get postWriting() {
return this.asPostWritingTaskGroup({
addWebsocketDependencies({ application }) {
const { communicationSpringWebsocket, nodeDependencies } = application;
if (communicationSpringWebsocket) {
this.packageJson.merge({
dependencies: {
rxjs: nodeDependencies.rxjs,
'sockjs-client': nodeDependencies['sockjs-client'],
'webstomp-client': nodeDependencies['webstomp-client'],
},
});
}
},
});
}

get [BaseApplicationGenerator.POST_WRITING]() {
return this.delegateTasksToBlueprint(() => this.postWriting);
}

get [BaseApplicationGenerator.POST_WRITING_ENTITIES]() {
return this.delegateTasksToBlueprint(() => this.postWritingEntities);
}
Expand Down
5 changes: 4 additions & 1 deletion generators/react/resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
"react-transition-group": "4.4.5",
"reactstrap": "9.2.2",
"redux": "5.0.1",
"rxjs": "6.6.3",
"sockjs-client": "1.5.0",
"sonar-scanner": "3.1.0",
"tslib": "2.6.2",
"uuid": "9.0.1"
"uuid": "9.0.1",
"webstomp-client": "1.2.6"
},
"devDependencies": {
"@module-federation/utilities": "3.0.3-0",
Expand Down
8 changes: 1 addition & 7 deletions generators/react/templates/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,11 @@
"react-transition-group": "<%= nodeDependencies['react-transition-group'] %>",
"reactstrap": "<%= nodeDependencies['reactstrap'] %>",
"redux": "<%= nodeDependencies['redux'] %>",
<%_ if (communicationSpringWebsocket) { _%>
"rxjs": "6.6.3",
"sockjs-client": "1.5.0",
<%_ } _%>
<%_ if (skipServer) { _%>
"sonar-scanner": "<%= nodeDependencies['sonar-scanner'] %>",
<%_ } _%>
"tslib": "<%= nodeDependencies['tslib'] %>",
"uuid": "<%= nodeDependencies['uuid'] %>"<% if (communicationSpringWebsocket) { %>,
"webstomp-client": "1.2.6"
<%_ } _%>
"uuid": "<%= nodeDependencies['uuid'] %>"
},
"devDependencies": {
<%_ if (applicationTypeGateway && microfrontend) { _%>
Expand Down
2 changes: 2 additions & 0 deletions generators/server/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,6 @@ export type SpringBootApplication = JavaApplication &

databaseMigration: string;
databaseMigrationLiquibase: boolean;

communicationSpringWebsocket: boolean;
};

0 comments on commit 7baa49d

Please sign in to comment.