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

Incorrect Package Manager Detection in npm create pylon@latest #45

Closed
schettn opened this issue Nov 5, 2024 · 2 comments · Fixed by #42
Closed

Incorrect Package Manager Detection in npm create pylon@latest #45

schettn opened this issue Nov 5, 2024 · 2 comments · Fixed by #42
Assignees
Labels
🕹 aspect: interface Concerns end-users' experience with the software 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be fixed soon released 🏁 status: ready for de Ready for work

Comments

@schettn
Copy link
Contributor

schettn commented Nov 5, 2024

Description:

The current implementation of the package manager (pm) detection in the npm create pylon@latest command always favors yarn due to its reliance on the presence of lock files. This is problematic because the Pylon create command does not include lock files.

Current Behavior:

  1. If any of the following lock files are found in the current working directory, it resolves the associated package manager and skips further checks:
    • yarn.lock -> resolves yarn
    • package-lock.json -> resolves npm
    • pnpm-lock.yaml -> resolves pnpm
    • bun.lockb -> resolves bun
  2. If no lock files are found, it checks if the yarn, pnpm, or bun commands are available in the environment. If so, it resolves the respective package manager; otherwise, it defaults to npm.

Expected Behavior:

The package manager detection should:

  1. Check if the current environment uses a specific package manager (e.g., check for the presence of relevant commands or configurations).
  2. If no specific environment configuration is found, fall back to lock file detection and ensure that the detected package manager is available.
  3. Accept a preferredPm configuration option. This allows prioritizing a preferred package manager if it's available, such as favoring bun when using the bun runtime. This feature is also required for supporting Deno (Provide a starter for Deno/Hono #41).

Steps to Reproduce:

  1. Run npm create pylon@latest in a directory without any lock files.
  2. Observe that yarn is favored if it is available, even if another package manager should be preferred based on the environment or configuration.

Proposed Solution:

  • Modify the pm detection logic to first check the current environment for a specific package manager.
  • If no specific environment configuration is found, proceed with lock file detection.
  • Implement the preferredPm configuration to allow users to specify their preferred package manager. This option should be checked first before falling back to environment or lock file detection.
  • Ensure compatibility with supporting runtimes like Deno (Provide a starter for Deno/Hono #41).

Additional Context:

  • This issue affects the usability of the npm create pylon@latest command, especially in environments where multiple package managers are present.
  • Resolving this issue will enhance the flexibility and accuracy of the package manager detection mechanism.
@schettn schettn added 🟨 priority: medium Not blocking but should be fixed soon 🏁 status: ready for de Ready for work 🛠 goal: fix Bug fix 🕹 aspect: interface Concerns end-users' experience with the software labels Nov 5, 2024
@schettn schettn self-assigned this Nov 5, 2024
Copy link

github-actions bot commented Nov 7, 2024

🎉 This issue has been resolved in version create-pylon-v1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Nov 7, 2024

🎉 This issue has been resolved in version @getcronit/pylon-v2.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕹 aspect: interface Concerns end-users' experience with the software 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be fixed soon released 🏁 status: ready for de Ready for work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant