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

feat(app.vue, nuxt.config.ts, package.json): display build version in UI and automate version generation #4

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

mauvehed
Copy link
Owner

@mauvehed mauvehed commented Dec 7, 2024

Add a build version display to the app's UI to provide users with information about the current build. Introduce a new script to automatically generate a build version based on the current date and time, ensuring each build is uniquely identifiable. The build version is read from a JSON file and injected into the Nuxt runtime config, making it accessible in the application. This change enhances transparency and traceability of deployed versions, aiding in debugging and user support.

Summary by Sourcery

Display the build version in the UI and automate its generation by adding a script that creates a version based on the current date and time. Integrate this version into the Nuxt runtime config and update the build process to include version generation, enhancing transparency and traceability of deployed versions.

New Features:

  • Display the build version in the app's UI to provide users with information about the current build.

Enhancements:

  • Automate the generation of a build version based on the current date and time, ensuring each build is uniquely identifiable.

Build:

  • Add a script to generate a build version and update the build process to include this step.

… UI and automate version generation

Add a build version display to the app's UI to provide users with
information about the current build. Introduce a new script to
automatically generate a build version based on the current date and
time, ensuring each build is uniquely identifiable. The build version
is read from a JSON file and injected into the Nuxt runtime config,
making it accessible in the application. This change enhances
transparency and traceability of deployed versions, aiding in debugging
and user support.
Copy link
Contributor

sourcery-ai bot commented Dec 7, 2024

Reviewer's Guide by Sourcery

This PR implements a build version display feature by adding a version number to the UI, generating it automatically during the build process, and making it accessible through Nuxt's runtime configuration. The implementation uses a combination of a new script to generate timestamps, configuration changes to expose the version, and UI modifications to display it.

Sequence Diagram for Build Version Generation

sequenceDiagram
    participant Developer
    participant Script as generate-build-version.js
    participant FileSystem
    Developer->>Script: Run generate-version script
    Script->>FileSystem: Write build-version.json with timestamp
    Script->>Developer: Log generated version
Loading

Class Diagram for Updated Nuxt Configuration

classDiagram
    class NuxtConfig {
        +String compatibilityDate
        +Boolean devtools
        +RuntimeConfig runtimeConfig
    }
    class RuntimeConfig {
        +PublicConfig public
    }
    class PublicConfig {
        +String buildVersion
    }
    NuxtConfig --> RuntimeConfig
    RuntimeConfig --> PublicConfig
    note for PublicConfig "Contains the build version accessible in the app"
Loading

File-Level Changes

Change Details Files
Implement automatic build version generation
  • Create a new script that generates a timestamp-based version
  • Write version information to a JSON file
  • Add a new generate-version script to package.json
  • Modify build script to include version generation step
scripts/generate-build-version.js
build-version.json
package.json
Configure Nuxt to expose build version through runtime config
  • Import and read version from build-version.json
  • Add build version to public runtime configuration
nuxt.config.ts
Add build version display to the UI
  • Add a fixed-position build version display component
  • Access build version from runtime config in the component
  • Style the version display with CSS
app.vue

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

vercel bot commented Dec 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yourip ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2024 7:48pm

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @mauvehed - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using semantic versioning (e.g., MAJOR.MINOR.PATCH) combined with a build number or git commit hash instead of timestamps for more meaningful version tracking and to avoid potential collisions with multiple builds in the same second.
  • There appears to be a duplicate div with id="app". Consider merging the build version display into the existing root div structure to avoid potential styling or structural issues.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@mauvehed mauvehed self-assigned this Dec 7, 2024
@mauvehed mauvehed merged commit 214efa1 into main Dec 7, 2024
6 checks passed
@mauvehed mauvehed deleted the add-build-ver branch December 7, 2024 19:51
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