Skip to content

Conversation

@pujitm
Copy link
Member

@pujitm pujitm commented Apr 9, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a command to remove stale archive files during the cleanup process.
    • Added functionality to archive the node_modules directory.
    • Enhanced dependency resolution with new overrides for specific packages.
  • Chores

    • Updated dependency settings by replacing one key dependency with an alternative and removing two unused ones, ensuring optimal deployment.
    • Enhanced the installation process to operate strictly in offline mode.
    • Updated artifact naming conventions for clarity and consistency in workflows.
    • Modified volume mappings in the Docker Compose configuration to reflect new artifact names.
    • Improved error handling in the GitHub Actions workflow by adding checks for required files.
    • Updated references in the build process to use a vendor store instead of the PNPM store.
    • Removed the management of PNPM store archives from the build process.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 9, 2025

Walkthrough

The changes update the deployment preparation process. In api/scripts/build.ts, the assignment of the pnpm property from parsedRootPackageJson to parsedPackageJson has been removed, and the dependency installation process now uses npm install --omit=dev instead of PNPM. In package.json, modifications were made in the pnpm.onlyBuiltDependencies array: specific dependencies have been removed and a new one added. The rc.unraid-api script has been modified to operate with a new dependencies_dir, removing the backup functionality for the pnpm store and introducing a function for archiving node_modules. No alterations were made to exported or public entities.

Changes

Files Change Summary
api/scripts/build.ts Removed the assignment of the pnpm property to parsedPackageJson, switched to npm install --omit=dev, and adjusted the packaging process to create a tarball of node_modules.
package.json Modified the pnpm.onlyBuiltDependencies array by removing @nestjs/core, cpu-features, and nestjs-pino, and adding protobufjs.
plugin/plugins/dynamix.unraid.net.plg Added a command to delete a stale node_modules-for-v*.tar.xz archive during the cleanup process when the Unraid API is stopped and uninstalled.
plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api Updated to use dependencies_dir, removed the backup functionality for the pnpm store, and introduced archive_dependencies function for archiving node_modules.
.github/workflows/build-plugin.yml Changed artifact name from packed-pnpm-store to packed-node-modules and added error checking for the existence of a .tar.xz file in the ./deploy directory.
.github/workflows/main.yml Renamed step from "Upload PNPM Store to Github artifacts" to "Upload Node Modules to Github artifacts" and updated artifact name and path accordingly.
plugin/builder/build-pnpm-store.ts Removed functions related to managing the pnpm store archive.
plugin/docker-compose.yml Modified volume mapping from packed-pnpm-store.txz to packed-node-modules.tar.xz.
api/package.json Added new overrides for @as-integrations/fastify and nest-authz packages to enhance dependency resolution.
plugin/builder/build-plugin.ts Replaced references to the PNPM store with vendor store functions, updating import statements and logic accordingly.
plugin/builder/build-vendor-store.ts Introduced a new file with functions for managing versioning and bundling of node_modules, including getVersion, getVendorBundleName, and bundleVendorStore.

Possibly related PRs

  • Feat/split plugin builds #1151: The changes in the main PR, which involve modifications to the dependency management and packaging process in build.ts, are related to the changes in the retrieved PR that also modify the build process in main.yml, particularly in how artifacts are handled and named, indicating a direct connection in the build workflow.

Suggested reviewers

  • elibosley
  • mdatelle

Poem

In the code’s quiet flow, lines gracefully fade,
Comments once burdened now quietly erased,
Dependencies shift like notes in a tune,
A subtle refinement beneath the coding moon,
With each change, a new digital verse is spun,
Celebrating progress — simple, clear, and fun!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 7813cd8 and c9f6f33.

📒 Files selected for processing (1)
  • plugin/plugins/dynamix.unraid.net.plg (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugin/plugins/dynamix.unraid.net.plg
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build API
  • GitHub Check: Build Web App
  • GitHub Check: Test API
  • GitHub Check: Cloudflare Pages

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
api/scripts/build.ts (1)

50-51: Retain pnpm Configuration:
With the removal of any deletion logic for the pnpm property, the script now preserves this configuration—thereby helping ensure that postinstall scripts (and other pnpm settings) run in production as intended. Consider updating the comment at line 50 to clearly reflect that the package.json is being written back with all pnpm properties intact.

package.json (1)

23-32: Updated pnpm.onlyBuiltDependencies List:
The dependency list has been adjusted by removing @nestjs/core, cpu-features, and nestjs-pino and by adding protobufjs. Ensure that these changes align with your deployment requirements and that no essential dependency for building or postinstall operations is inadvertently removed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd323ac and 15186a6.

📒 Files selected for processing (2)
  • api/scripts/build.ts (1 hunks)
  • package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build Web App
  • GitHub Check: Test API
  • GitHub Check: Build API
  • GitHub Check: Cloudflare Pages

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (3)

133-146: Added node_modules archive restoration logic

Good performance optimization! The function now checks for a cached node_modules archive and attempts to restore from it before running pnpm install.

Consider adding a timestamp check to verify the archive isn't outdated:

 if [ -f "$archive_file" ]; then
+  # Check if archive is recent (within 7 days)
+  if [ $(( $(date +%s) - $(stat -c %Y "$archive_file") )) -gt 604800 ]; then
+    echo "Archive is older than 7 days. Running fresh install..."
+  else
     echo "Found node_modules archive at '$archive_file'. Attempting to restore..."
     rm -rf "$node_modules_dir"
     if tar -xzf "$archive_file" -C "$(dirname "$node_modules_dir")" --preserve-permissions; then
       echo "Successfully restored node_modules from archive."
       return 0
     else
       echo "Failed to restore from archive. Falling back to pnpm install..."
     fi
+  fi
 fi

160-183: New archive_node_modules function

The function correctly archives the node_modules directory with appropriate error handling. Using compression level 1 is a good balance between speed and size.

Consider adding disk space verification similar to what you have in the restore_pnpm_store function:

 # Create destination directory if it doesn't exist
 mkdir -p "$dest_dir"

+# Check available disk space in destination
+local source_size
+source_size=$(du -sb "$source_dir" | cut -f1)
+local dest_space
+dest_space=$(df --output=avail "$(dirname "$archive_file")" | tail -n1)
+dest_space=$((dest_space * 1024)) # Convert KB to bytes
+
+if [ "$dest_space" -lt "$source_size" ]; then
+  echo "Error: Insufficient disk space for archiving. Need at least $((source_size / 1024 / 1024))MB, have $((dest_space / 1024 / 1024))MB"
+  return 1
+fi
+
 echo "Archiving node_modules from '$source_dir' to '$archive_file'"

152-153: Added warning and archive call after installation

The warning helps prevent users from interrupting the archiving process, but lacks clarity about what's happening.

Make the warning more informative:

-echo "⚠️ Do not close this window yet"
+echo "⚠️ Do not close this window yet - creating node_modules archive for future use"
 archive_node_modules
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 0cddb2e and a3048b4.

📒 Files selected for processing (2)
  • plugin/plugins/dynamix.unraid.net.plg (1 hunks)
  • plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugin/plugins/dynamix.unraid.net.plg
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test API
  • GitHub Check: Build Web App
  • GitHub Check: Build API
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (2)

204-206: Added archive-dependencies command handler

This addition properly exposes the new archiving functionality through the command interface.


111-111:

❓ Verification inconclusive

Changed from --prefer-offline to --offline mode

The installation command now runs in strict offline mode instead of prefer-offline. This ensures faster installation from cache but will fail if packages aren't available locally.


🏁 Script executed:

#!/bin/bash
# Check if there are specific reasons mentioned for the strict offline mode change
grep -r "offline.*mode" --include="*.md" --include="*.txt" .

Length of output: 62


Note on the Offline Mode Change:
The installation command was updated to use strict offline mode (--offline) instead of the --prefer-offline flag. This change is intended to speed up builds by enforcing the use of a local cache, though it will fail if any required packages aren’t available locally. Our search in markdown and text documentation did not yield any further details explaining this change. Please verify manually that the local cache includes all necessary packages and that this behavior aligns with your deployment strategy.

• Confirm that no additional context exists elsewhere in the repository (e.g., commit messages or internal documentation) regarding this change.
• Ensure that the local cache is complete so that package installations won’t unexpectedly fail.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
plugin/builder/build-pnpm-store.ts (2)

20-42: Update function name and documentation to match new implementation

While the implementation changes are correct, the function name and documentation still reference PNPM store, which is no longer accurate:

  1. The function name bundlePnpmStore doesn't reflect its current purpose
  2. The JSDoc comments still mention PNPM store and packed-pnpm-store.txz

Consider updating these to maintain clarity and consistency.

/**
- * The name of the pnpm store archive that will be vendored with the plugin.
+ * The name of the node modules archive that will be vendored with the plugin.
 * @returns The name of the pnpm store bundle file
 */
/**
- * Prepare a versioned bundle of the API's pnpm store to vendor dependencies.
+ * Prepare a versioned bundle of the API's node modules to vendor dependencies.
 * 
- * It expects a generic `packed-pnpm-store.txz` archive to be available in the `startingDir`.
+ * It expects a generic `packed-node-modules.tar.xz` archive to be available in the `startingDir`.
 * It copies this archive to the `deployDir` directory and adds a version to the filename.
- * It does not actually create the packed pnpm store archive; that is done inside the API's build script.
+ * It does not actually create the packed node modules archive; that is done inside the API's build script.
 * 
 * After this operation, the vendored store will be available inside the `deployDir`.
 */
-export async function bundlePnpmStore(): Promise<void> {
+export async function bundleNodeModules(): Promise<void> {

1-42: Consider renaming this file

The filename build-pnpm-store.ts no longer accurately represents the file's purpose since it now deals with node modules rather than PNPM store. Consider renaming it to something like build-node-modules.ts for clarity and consistency.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 42704df and 942b1a1.

📒 Files selected for processing (5)
  • .github/workflows/build-plugin.yml (2 hunks)
  • .github/workflows/main.yml (1 hunks)
  • api/scripts/build.ts (2 hunks)
  • plugin/builder/build-pnpm-store.ts (2 hunks)
  • plugin/docker-compose.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/scripts/build.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
plugin/builder/build-pnpm-store.ts (1)
plugin/builder/utils/consts.ts (1)
  • startingDir (6-6)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build Web App
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (6)
plugin/docker-compose.yml (1)

15-15: File path updated to reflect new node modules approach

The volume mapping has been updated to use packed-node-modules.tar.xz instead of packed-pnpm-store.txz, which is consistent with the shift from PNPM store to node_modules for dependency management.

.github/workflows/build-plugin.yml (2)

106-107: Artifact name updated to reflect new node modules approach

The artifact name has been updated from packed-pnpm-store to packed-node-modules, aligning with the shift from PNPM store to node_modules.


133-136: Added verification for tar.xz file

Good addition of error checking for the .tar.xz file in the deploy directory. This ensures the node_modules archive exists before proceeding with the build process.

.github/workflows/main.yml (1)

194-199: Updated step name and artifact details

The GitHub action step has been correctly updated to use the new node_modules approach:

  1. Step name changed from "Upload PNPM Store" to "Upload Node Modules"
  2. Artifact name updated to packed-node-modules
  3. Path updated to use packed-node-modules.tar.xz

These changes are consistent with the overall shift in dependency management approach.

plugin/builder/build-pnpm-store.ts (2)

26-26: Bundle name updated to use node modules

The bundle name format has been updated to reflect the shift from pnpm store to node modules.


39-39: Store archive path updated

The store archive path has been updated to use packed-node-modules.tar.xz instead of packed-pnpm-store.txz.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
api/package.json (2)

205-207: Review: Verify the override configuration for @as-integrations/fastify
The new override maps the fastify dependency to the variable $fastify. Please confirm that this variable-based aliasing is intentional and correctly supported by your dependency resolution process. If this mapping deviates from the typical version string override, adding a brief comment or documentation note could help future maintainers.


208-211: Review: Confirm alias resolution for nest-authz dependencies
The override for nest-authz directs @nestjs/common and @nestjs/core to resolve to $@nestjs/common and $@nestjs/core respectively. Verify that these substitutions work as expected in all environments (including production) and consider adding documentation on this non-standard aliasing approach for clarity.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 942b1a1 and 42814a0.

📒 Files selected for processing (2)
  • api/package.json (1 hunks)
  • api/scripts/build.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/scripts/build.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build Web App
  • GitHub Check: Build API
  • GitHub Check: Test API
  • GitHub Check: Cloudflare Pages

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (1)

95-100: ⚠️ Potential issue

Update extraction command to match archive format

Since the archive format has changed from tar.xz to tar.gz as indicated in the documentation, the extraction command should use -z instead of -J.

-  if ! tar -xJf "$backup_file" -C "$(dirname "$pnpm_store_dir")" --preserve-permissions; then
+  if ! tar -xzf "$backup_file" -C "$(dirname "$pnpm_store_dir")" --preserve-permissions; then
🧹 Nitpick comments (3)
plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (3)

11-11: Consider renaming the variable to match its new purpose

The variable name pnpm_store_dir now points to a node_modules directory, which is misleading. Consider renaming it to node_modules_dir to better reflect its actual purpose.

-pnpm_store_dir="/usr/local/unraid-api/node_modules"
+node_modules_dir="/usr/local/unraid-api/node_modules"

152-152: Make warning message more informative

The warning message "Do not close this window yet" doesn't explain why users should keep the window open.

-  echo "⚠️ Do not close this window yet"
+  echo "⚠️ Do not close this window yet - archiving node_modules in progress"

160-183: Well-structured archive function with good error handling

The new archive_node_modules function is well-structured with proper error handling and uses fast compression (level 1), which is appropriate for potentially large node_modules directories.

Consider parameterizing the source and destination paths for better flexibility:

 archive_node_modules() {
-  local source_dir="/usr/local/unraid-api/node_modules"
-  local dest_dir="/boot/config/plugins/dynamix.my.servers"
+  local source_dir="${node_modules_dir:-/usr/local/unraid-api/node_modules}"
+  local dest_dir="${flash:-/boot/config/plugins/dynamix.my.servers}"
   local archive_file="${dest_dir}/node_modules.tar.gz"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 4bc7f39 and 58f8f74.

📒 Files selected for processing (3)
  • api/scripts/build.ts (2 hunks)
  • plugin/plugins/dynamix.unraid.net.plg (3 hunks)
  • plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • api/scripts/build.ts
  • plugin/plugins/dynamix.unraid.net.plg
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build Web App
  • GitHub Check: Build API
  • GitHub Check: Test API
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (2)

111-111: Be aware of stricter offline installation

Changing from --prefer-offline to --offline makes the installation strictly offline with no fallback to online mode. This is more reliable in controlled environments but will fail if packages aren't available locally.


204-206: Good addition of archive command

The new archive-dependencies command provides a logical way to manually trigger the archiving process, maintaining consistency with the existing command structure.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
plugin/builder/build-vendor-store.ts (1)

13-18: Consider enhancing error handling.

The function correctly retrieves the version, but could benefit from more specific error handling.

function getVersion(): string {
    const packageJsonPath = join(apiDir, "package.json");
-    const packageJsonString = readFileSync(packageJsonPath, "utf8");
-    const packageJson = JSON.parse(packageJsonString);
-    return packageJson.version;
+    try {
+        const packageJsonString = readFileSync(packageJsonPath, "utf8");
+        const packageJson = JSON.parse(packageJsonString);
+        if (!packageJson.version) {
+            throw new Error("Version not found in package.json");
+        }
+        return packageJson.version;
+    } catch (error) {
+        throw new Error(`Failed to read API version: ${error instanceof Error ? error.message : String(error)}`);
+    }
}
plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (1)

104-109: Consider validating the restore-dependencies argument.

While the command case structure has been updated correctly, it would be beneficial to validate the backup file path before passing it to the function.

'restore-dependencies')
-  restore_dependencies "$2"
+  if [ -z "$2" ]; then
+    echo "Error: Missing backup file path. Usage: $0 restore-dependencies <backup_file_path>"
+    exit 1
+  fi
+  restore_dependencies "$2"
  ;;
'archive-dependencies')
  archive_dependencies
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 58f8f74 and 07751e7.

📒 Files selected for processing (5)
  • api/scripts/build.ts (1 hunks)
  • plugin/builder/build-plugin.ts (3 hunks)
  • plugin/builder/build-vendor-store.ts (1 hunks)
  • plugin/plugins/dynamix.unraid.net.plg (3 hunks)
  • plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • api/scripts/build.ts
  • plugin/plugins/dynamix.unraid.net.plg
🧰 Additional context used
🧬 Code Graph Analysis (2)
plugin/builder/build-plugin.ts (2)
plugin/builder/utils/bucket-urls.ts (1)
  • getAssetUrl (33-37)
plugin/builder/build-vendor-store.ts (2)
  • getVendorBundleName (24-27)
  • bundleVendorStore (38-42)
plugin/builder/build-vendor-store.ts (2)
plugin/builder/utils/paths.ts (2)
  • apiDir (19-26)
  • deployDir (17-17)
plugin/builder/utils/consts.ts (1)
  • startingDir (6-6)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test API
  • GitHub Check: Build Web App
  • GitHub Check: Build API
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (7)
plugin/builder/build-plugin.ts (3)

15-15: Updated imports to reflect new dependency management approach.

The imports have been changed to work with the new vendor store mechanism instead of the previous PNPM store approach.


64-65: Updated entity values for vendor store references.

The entities have been correctly updated to use the new getVendorBundleName() function for both URL and filename properties, maintaining consistency with the broader dependency management changes.


111-111: Updated vendor store bundling call.

The function call has been updated to use bundleVendorStore() which aligns with the project's transition from PNPM to a vendor store approach.

plugin/builder/build-vendor-store.ts (1)

24-27: Well-defined function for generating vendor bundle names.

This function builds a consistent and versioned filename for the node_modules archive, which will help with dependency versioning and tracking.

plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (3)

11-11: Updated path to use node_modules directory.

The variable has been correctly renamed and updated to point to the node_modules directory, which aligns with the project's transition from PNPM to standard npm for dependency management.


21-27: Updated function documentation for node_modules restoration.

The documentation has been properly updated to reflect the new dependency approach with node_modules instead of PNPM store.


69-92: New function to archive node_modules dependencies.

This well-structured function creates a compressed archive of the node_modules directory with appropriate error handling and progress messages.

@pujitm pujitm marked this pull request as ready for review April 9, 2025 19:03
@pujitm
Copy link
Member Author

pujitm commented Apr 9, 2025

@coderabbitai summary

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 9, 2025

✅ Actions performed

Summary regeneration triggered.

/etc/rc.d/rc.unraid-api restore-dependencies "$VENDOR_ARCHIVE"
echo
echo "⚠️ Do not close this window yet"
/etc/rc.d/rc.unraid-api pnpm-install
Copy link
Member

Choose a reason for hiding this comment

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

Nice

@pujitm pujitm changed the title chore: enable postinstall scripts in prod refactor(api): vendor node_modules instead of pnpm store Apr 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2025

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL:

https://preview.dl.unraid.net/unraid-api/tag/PR1346/dynamix.unraid.net.plg

@pujitm pujitm merged commit 97ab6fb into main Apr 9, 2025
9 checks passed
@pujitm pujitm deleted the fix/libvirt-install branch April 9, 2025 19:17
mdatelle pushed a commit that referenced this pull request Apr 14, 2025
due to issues and redundancies in vendoring postinstall side-effects, such as compiled bindings for libvirt, we reverted to vendoring `node_modules`, installed via `npm` instead of a global pnpm store generated by `pnpm`.

This should resolve runtime issues with e.g. the libvirt bindings because `node_modules` will contain the correct "side-effects."

## Summary by CodeRabbit

- **New Features**
- Introduced a command to remove stale archive files during the cleanup
process.
  - Added functionality to archive the `node_modules` directory.
- Enhanced dependency resolution with new overrides for specific
packages.

- **Chores**
- Updated dependency settings by replacing one key dependency with an
alternative and removing two unused ones, ensuring optimal deployment.
- Enhanced the installation process to operate strictly in offline mode.
- Updated artifact naming conventions for clarity and consistency in
workflows.
- Modified volume mappings in the Docker Compose configuration to
reflect new artifact names.
- Improved error handling in the GitHub Actions workflow by adding
checks for required files.
- Updated references in the build process to use a vendor store instead
of the PNPM store.
- Removed the management of PNPM store archives from the build process.
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.

3 participants