Skip to content

Implemented: support to serve app on specific version requested by oms#724

Draft
ymaheshwari1 wants to merge 1 commit into
hotwax:mainfrom
ymaheshwari1:feat/manage-app-version/dxp/448
Draft

Implemented: support to serve app on specific version requested by oms#724
ymaheshwari1 wants to merge 1 commit into
hotwax:mainfrom
ymaheshwari1:feat/manage-app-version/dxp/448

Conversation

@ymaheshwari1

Copy link
Copy Markdown
Contributor

Related Issues

Short Description and Why It's Useful

Screenshots of Visual Changes before/after (If There Are Any)

Contribution and Currently Important Rules Acceptance

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @ymaheshwari1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a robust mechanism to support serving different versions of the application, primarily driven by requests from an Order Management System (OMS). It enables the application to dynamically adapt its routing based on the version specified in the URL, ensuring users are directed to the correct application instance. This enhancement is crucial for environments requiring parallel deployments of various application versions.

Highlights

  • Version-based Routing: The application now supports serving specific versions based on the URL path, dynamically adjusting the base URL for Vue Router and enabling version-specific deployments.
  • State Management for App Version: The active application version is now stored and managed within the Vuex user module, allowing for consistent tracking and enabling redirection if a user navigates to a different version.
  • Build Configuration for Versioning: The Vue CLI configuration has been updated to output build artifacts into version-specific directories and set the public path accordingly, facilitating the deployment of multiple application versions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for serving different versions of the application based on the URL path. This is a significant feature, achieved by updating webpack configuration and Vue Router logic. The implementation is mostly on the right track, but there are several areas for improvement. My review focuses on removing debug logs, improving the robustness of URL manipulation, and correcting the webpack and router configuration to ensure stable client-side routing with versioned paths. Addressing these points will make the feature more reliable and maintainable.

Comment thread src/router/index.ts
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
// TODO: check if we need this condition to check for VUE_APP_BUILD value and compare it with appVersion
history: createWebHistory(appVersion == process.env.VUE_APP_BUILD ? appVersion : process.env.BASE_URL),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The logic to determine the history's base path is complex, and the TODO comment indicates it's not finalized. The check appVersion == process.env.VUE_APP_BUILD seems to prevent using older versions of the app, as it would cause the router to use an incorrect base path. The redirection logic in router.beforeEach should be sufficient to handle incorrect versions.

A simpler and more correct approach would be to use appVersion as the base path if it exists. This also depends on the publicPath setting in vue.config.js. If publicPath is correctly set to an absolute path, you can likely just use createWebHistory(process.env.BASE_URL).

Suggested change
history: createWebHistory(appVersion == process.env.VUE_APP_BUILD ? appVersion : process.env.BASE_URL),
history: createWebHistory(appVersion || process.env.BASE_URL),

Comment thread src/router/index.ts
Comment thread vue.config.js
transpileDependencies: ['@hotwax/dxp-components']
transpileDependencies: ['@hotwax/dxp-components'],
outputDir: `dist/${process.env.VUE_APP_BUILD}`,
publicPath: process.env.NODE_ENV === "production" ? `./${process.env.VUE_APP_BUILD}` : "/"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using a relative publicPath (starting with ./) is not recommended when using HTML5 history mode for client-side routing. It can cause problems with nested routes and requires specific server configuration to work correctly. It's safer to use an absolute path to avoid ambiguity and ensure routing works as expected.

Suggested change
publicPath: process.env.NODE_ENV === "production" ? `./${process.env.VUE_APP_BUILD}` : "/"
publicPath: process.env.NODE_ENV === "production" ? `/${process.env.VUE_APP_BUILD}/` : "/"

Comment thread src/router/index.ts
Comment thread src/views/Settings.vue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant