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

Read package.json from APP_ROOT or Rails.root, not cwd #520

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

marvinthepa
Copy link
Contributor

@marvinthepa marvinthepa commented Oct 9, 2024

Fixes #519.

Summary

We have a few tools that are called from outside the rails root, require the rails environment, and then do something with the rails db.
These fail as error_unless_package_manager_is_obvious only works when called from inside Rails.root.
Other methods like Shakapacker::VersionChecker::NodePackageVersion.package_json_path take this into account, so my guess is that this is just a small bug.

Pull Request checklist

  • Add/update test to cover these changes
  • Update documentation Bugfix, not a documented feature
  • Update CHANGELOG file

Summary by CodeRabbit

  • Documentation

    • Updated the changelog to include versioning, upgrade guides, and significant changes across multiple versions of the Shakapacker library.
  • New Features

    • Enhanced package manager detection to operate within the correct file path context of a Rails application.
  • Bug Fixes

    • Addressed errors related to the Rails environment being required from outside the Rails root directory.
    • Fixed documentation for the esbuild loader and improved asset compilation issues.
  • Tests

    • Expanded test coverage for scenarios involving different working directories and package manager detection logic.

@marvinthepa marvinthepa marked this pull request as ready for review October 9, 2024 09:27
Copy link

coderabbitai bot commented Oct 9, 2024

Walkthrough

The pull request updates the CHANGELOG.md to document changes across multiple versions of the Shakapacker library, including upgrade guides and various fixes. Additionally, modifications were made to the Manager class in lib/shakapacker/utils/manager.rb to ensure package manager detection functions correctly within the Rails application's root directory. The test suite in spec/shakapacker/utils_manager_spec.rb was also enhanced to cover scenarios where the lockfile is located outside the Rails root.

Changes

File Change Summary
CHANGELOG.md Updated to include versioning, upgrade guides, unreleased changes, and detailed version changes.
lib/shakapacker/utils/manager.rb Modified methods error_unless_package_manager_is_obvious! and guess_binary for Rails root context; added rails_root method.
spec/shakapacker/utils_manager_spec.rb Enhanced test coverage for methods handling different working directories relative to Rails root.

Assessment against linked issues

Objective Addressed Explanation
error_unless_package_manager_is_obvious! triggers when rails environment is required from outside the rails root (#519)

Possibly related PRs

  • Update changelog #518: This PR updates the CHANGELOG.md file, which is directly related to the main PR's changes in the same file, specifically regarding the modification of require statements to require_relative.

Suggested reviewers

  • tomdracz

Poem

In the code where rabbits hop,
Changes made, we’ll never stop.
With paths aligned and tests so bright,
Shakapacker shines, a joyful sight!
Upgrade guides and fixes here,
Hopping forward, full of cheer! 🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 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

@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: 5

🧹 Outside diff range and nitpick comments (7)
lib/shakapacker/utils/manager.rb (1)

38-38: LGTM! Consider a minor optimization.

The change to use Rails.root.join(lock) when checking for lock files ensures that the correct directory is searched, regardless of the current working directory. This addresses the issue mentioned in #519 and aligns with the PR objectives.

A minor optimization could be to move the Rails.root.join call outside the loop to avoid repeated method calls:

MANAGER_LOCKS.find { |_, lock| File.exist?(Rails.root.join(lock)) }&.first || "npm"

Could be optimized to:

rails_root = Rails.root
MANAGER_LOCKS.find { |_, lock| File.exist?(rails_root.join(lock)) }&.first || "npm"

This change is optional and would only provide a very slight performance improvement.

CHANGELOG.md (4)

16-17: Consider adding more context to the Unreleased change.

The entry in the Unreleased section is clear, but it could be improved by adding more context about the impact of this change. Consider expanding on how this fix affects users and why it's important.

Here's a suggested expansion:

- Fix error when rails environment is required from outside the rails root directory [PR 520](https://github.com/shakacode/shakapacker/pull/520)
+ Fix error when Rails environment is required from outside the Rails root directory [PR 520](https://github.com/shakacode/shakapacker/pull/520). This improves the flexibility of Shakapacker, allowing it to function correctly in more diverse project setups and deployment scenarios.
🧰 Tools
🪛 Markdownlint

17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


Line range hint 28-46: Inconsistent bullet point formatting

There's an inconsistency in the formatting of bullet points in this section. Some use "-" while others use "*". For better readability and consistency, it's recommended to use the same bullet point style throughout the document.

Consider updating all bullet points to use the same symbol, preferably "-" to match the majority of the document. For example:

- * This enables support for package managers other than `yarn`, with `npm` being the default; to continue using Yarn,
+ - This enables support for package managers other than `yarn`, with `npm` being the default; to continue using Yarn,
🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


Line range hint 48-49: Consider adding a summary for v8.0.0 changes

Given the significance of a major version change and the number of breaking changes, it would be helpful to include a brief summary at the beginning of the v8.0.0 section. This would give users a quick overview of the most important changes before diving into the details.

Consider adding a summary like this:

## [v8.0.0] - May 17, 2024

This major version includes several breaking changes and improvements, focusing on modernizing the package manager support, removing deprecated features, and enhancing overall performance and flexibility. Key changes include switching to `npm` as the default package manager, removing support for older Node.js versions, and various API changes.

### Breaking changes
...
🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


Line range hint 1-1: Consider creating a historical changelog file

The CHANGELOG.md file contains entries for many older versions, going back to v5.4.3 and earlier. While this provides valuable historical context, it also makes the file quite long. To improve readability and maintainability, consider moving older version entries (e.g., everything before v6.0.0) to a separate CHANGELOG-HISTORICAL.md file.

You could add a note at the end of the main CHANGELOG.md like this:

...

## v6.0.0 and earlier

For changes in version 6.0.0 and earlier, please see [CHANGELOG-HISTORICAL.md](./CHANGELOG-HISTORICAL.md).

This approach would keep the main CHANGELOG.md more focused on recent and relevant changes while still preserving the full history of the project.

🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

spec/shakapacker/utils_manager_spec.rb (2)

94-95: Consolidate stubbing of Rails.root

Stubbing Rails.root to return the current directory is done in multiple places. To improve consistency and reduce repetition, consider moving this stub to a higher-level before block or a shared context that applies to all relevant tests.


170-170: Avoid stubbing Rails.root multiple times

The stubbing of Rails.root on line 170 is performed in several places throughout the tests. To adhere to the KISS (Keep It Simple, Stupid) principle and improve test clarity, consider moving this stub to a global before block or shared context.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9544d55 and 4d276ca.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • lib/shakapacker/utils/manager.rb (2 hunks)
  • spec/shakapacker/utils_manager_spec.rb (5 hunks)
🧰 Additional context used
🪛 Markdownlint
CHANGELOG.md

17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

🔇 Additional comments (2)
lib/shakapacker/utils/manager.rb (1)

Line range hint 1-58: Summary: Changes effectively address the reported issue

The modifications to error_unless_package_manager_is_obvious! and guess_binary methods successfully address the issue reported in #519. By using Rails.root to locate files, the code now works correctly regardless of the current working directory.

These changes align well with the PR objectives and provide a robust solution to the problem. The rest of the file remains unchanged, ensuring that existing functionality is preserved.

Overall, this is a well-focused and effective fix for the reported issue.

CHANGELOG.md (1)

Line range hint 1-1: LGTM with suggested improvements

Overall, the CHANGELOG.md file is well-maintained and provides detailed information about changes across versions. It serves its purpose effectively, helping users understand the evolution of the Shakapacker library and guiding them through upgrades.

The suggested improvements (adding more context to the Unreleased section, consistent bullet point formatting, adding a summary for v8.0.0, and considering a historical changelog file) will further enhance its readability and usefulness.

🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

lib/shakapacker/utils/manager.rb Outdated Show resolved Hide resolved
spec/shakapacker/utils_manager_spec.rb Show resolved Hide resolved
spec/shakapacker/utils_manager_spec.rb Show resolved Hide resolved
spec/shakapacker/utils_manager_spec.rb Show resolved Hide resolved
Comment on lines +145 to +151
context "when lockfile is in Rails.root, but pwd is different" do
before do
rails_root = Pathname.new("rails_root_#{lock}")
FileUtils.mkdir_p(rails_root)
FileUtils.touch(rails_root.join(lock))
allow(Rails).to receive(:root).and_return(rails_root)
end
Copy link

@coderabbitai coderabbitai bot Oct 9, 2024

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use shared context for consistent test setup

The context "when lockfile is in Rails.root, but pwd is different" in the guess_version method repeats code found in other tests. Implementing a shared context ensures consistent setup and reduces the likelihood of errors due to code duplication.

Copy link
Contributor Author

@marvinthepa marvinthepa Oct 9, 2024

Choose a reason for hiding this comment

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

If a human reviewer wants me to extract a shared context for something as simple as this, I am more than willing to oblige.

IMVHO, tests profit from a little bit of duplication if it makes the logic easier to follow. Especially rspec shared contexts sometimes make tests unecessarily complicated.

I saw some duplication in the existing code and thought this was the style of the project, but feel free to correct me if I am wrong.

Copy link

Choose a reason for hiding this comment

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

@marvinthepa, thank you for sharing your perspective. I understand that you prefer some duplication in tests for clarity, and that using shared contexts might make tests unnecessarily complicated. I'll keep that in mind for future reviews.

 (\_/)
 (•_•)  *pondering thoughtfully*
 /   \


✏️ Learnings added
Learnt from: marvinthepa
PR: shakacode/shakapacker#520
File: spec/shakapacker/utils_manager_spec.rb:145-151
Timestamp: 2024-10-09T10:52:40.755Z
Learning: In tests, prefer some duplication if it makes the logic easier to follow. Avoid using RSpec shared contexts if they make tests unnecessarily complicated.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: marvinthepa
PR: shakacode/shakapacker#520
File: spec/shakapacker/utils_manager_spec.rb:68-89
Timestamp: 2024-10-09T10:47:17.620Z
Learning: In `spec/shakapacker/utils_manager_spec.rb`, the code within the context `"when lockfile is in Rails.root, but pwd is different"` is not duplicated for each package manager.

Copy link
Contributor

@G-Rath G-Rath left a comment

Choose a reason for hiding this comment

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

yyeaah this sounds reasonable to me - if nothing else, I know the context and where to look if I later find an edge case 😄

nice work on the tests btw!

@justin808
Copy link
Member

Once specs pass, I'll merge.

@justin808
Copy link
Member

@marvinthepa got a test failure.

@marvinthepa
Copy link
Contributor Author

@marvinthepa got a test failure.

Fixed.

In the shakapacker binstub, Rails.root is not available, so I am using APP_ROOT there. I don't know if that is a good solution, I would be glad to get any suggestions.

Copy link

@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

🧹 Outside diff range and nitpick comments (3)
lib/shakapacker/utils/manager.rb (1)

56-66: LGTM! Well-implemented rails_root method.

The new rails_root method provides a robust way to determine the Rails root path, handling different scenarios (presence of APP_ROOT or Rails module). The method is appropriately marked as private for internal use.

Consider slightly modifying the error message for clarity:

- raise "can only be called from a rails environment or with APP_ROOT defined"
+ raise "Rails.root is not available. Ensure this is called from a Rails environment or APP_ROOT is defined."

This change provides more context about what went wrong and what the user can do to resolve the issue.

CHANGELOG.md (2)

Line range hint 7-11: Consider adding a brief description for version 8.0.2

The changelog entry for version 8.0.2 lacks a brief description of the changes. Consider adding a short summary to give users a quick overview of what this version includes.

🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


Line range hint 26-69: Consider reorganizing Version 8.0.0 changes for better readability

The changelog entry for version 8.0.0 is comprehensive but could be reorganized for better readability. Consider grouping the changes into categories such as "Breaking Changes", "New Features", "Improvements", and "Fixes". This would make it easier for users to quickly understand the impact of this major version update.

🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4d276ca and be4ff99.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • lib/shakapacker/utils/manager.rb (3 hunks)
  • spec/shakapacker/utils_manager_spec.rb (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • spec/shakapacker/utils_manager_spec.rb
🧰 Additional context used
🪛 Markdownlint
CHANGELOG.md

17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

🔇 Additional comments (8)
lib/shakapacker/utils/manager.rb (3)

19-19: LGTM! This change addresses the reported issue.

The modification to use rails_root when reading the package.json file ensures that the correct file is accessed regardless of the current working directory. This change directly addresses the issue reported in #519 and aligns with the PR objectives.


38-38: LGTM! Consistent change with error_unless_package_manager_is_obvious!.

The modification to use rails_root.join(lock) when checking for the existence of lock files ensures consistency with the changes made to error_unless_package_manager_is_obvious!. This change guarantees that lock files are checked relative to the Rails application's root directory, addressing the issue reported in #519.


Line range hint 19-66: Summary: Effective resolution of the reported issue.

The changes in this file successfully address the issue reported in #519 by consistently using rails_root to ensure correct file paths are used, regardless of the current working directory. The modifications to error_unless_package_manager_is_obvious! and guess_binary, along with the addition of the rails_root method, provide a robust solution that aligns well with the PR objectives.

These changes enhance the reliability of the Shakapacker gem when the Rails environment is required from outside the Rails root directory, which was the core issue reported.

CHANGELOG.md (5)

Line range hint 1-5: LGTM: Header and links section

The header section of the changelog is well-structured and provides useful links to upgrade guides for different versions. This is helpful for users navigating between major versions.

🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


Line range hint 19-24: LGTM: Version 8.0.1 changes

The changelog entry for version 8.0.1 is clear and concise, providing good information about the changes made in this version.

🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


Line range hint 71-563: LGTM: Earlier versions and footer

The changelog entries for earlier versions and the footer with version comparison links are well-structured and provide valuable information for users tracking changes across different versions.

🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


Line range hint 1-563: Overall, the CHANGELOG.md is well-maintained and informative

The changelog provides detailed information about changes across multiple versions of the Shakapacker library. It includes links to upgrade guides, which is very helpful for users. The document is generally well-structured, with a few minor areas for improvement:

  1. Adding a brief description for version 8.0.2
  2. Fixing an unordered list style inconsistency in the 8.0.2 section
  3. Considering a reorganization of the 8.0.0 section for better readability

These minor improvements would enhance the overall quality and usability of the changelog. Great job on maintaining such a detailed and informative changelog!

🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


13-17: ⚠️ Potential issue

Fix unordered list style inconsistency

There's an inconsistency in the unordered list style. The Markdownlint tool flagged this issue.

Apply this change to maintain consistency with the rest of the document:

-Corrections have been made to the documentation for the esbuild loader.
-- Logic has been added to the SASS rule that is conditional based on the version of the sass-loader.
+- Corrections have been made to the documentation for the esbuild loader.
+- Logic has been added to the SASS rule that is conditional based on the version of the sass-loader.

Likely invalid or redundant comment.

🧰 Tools
🪛 LanguageTool

[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...s since the last non-beta release. ### Changed - Changed internal requires to `require_relativ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

14-14: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


17-17: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

@justin808
Copy link
Member

@marvinthepa got a test failure.

Fixed.

In the shakapacker binstub, Rails.root is not available, so I am using APP_ROOT there. I don't know if that is a good solution, I would be glad to get any suggestions.

where did you get APP_ROOT?

https://chatgpt.com/share/67085053-11d0-8002-b73a-e337730b805d

@marvinthepa
Copy link
Contributor Author

In the shakapacker binstub, Rails.root is not available, so I am using APP_ROOT there. I don't know if that is a good solution, I would be glad to get any suggestions.

where did you get APP_ROOT?

it is defined in the binstubs:

APP_ROOT = File.expand_path("..", __dir__)

APP_ROOT = File.expand_path("..", __dir__)

@justin808 justin808 changed the title Read package.json from Rails.root, not cwd Read package.json from APP_ROOT or Rails.root, not cwd Oct 18, 2024
@justin808 justin808 merged commit 1678b07 into shakacode:main Oct 18, 2024
45 checks passed
@justin808
Copy link
Member

Thanks @marvinthepa

@alecslupu
Copy link
Contributor

@justin808 any plans to release this fix anytime soon ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants