Skip to content

fix: locate sentry-cli when working with a mono-repo #19

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

Merged

Conversation

alexlafroscia
Copy link
Contributor

The current approach to locating the sentry-cli executable makes the assumption that the package is installed in an Ember app at the root of the repository. This works fine most of the time, but breaks in a mono-repo where the actual node_modules directory might be above the current project in the directory structure.

This change dynamically locates the sentry-cli executable by:

  1. Dynamically locating the package.json for the @sentry/cli package in a way that will work for both standard and mono-repo setups
  2. Extracting the root of the @sentry/cli package from that path, which should be safe; the package.json will always be at the package root
  3. Reading the package.json file for @sentry/cli to determine where the executable actually lives
  4. Building an absolute path to the sentry-cli executable from the information that we've gathered

This makes the approach to locating sentry-cli resilient to changes in the directory structure for different types of apps

The current approach to locating the `sentry-cli` executable makes the assumption that the package is installed in an Ember app at the root of the repository. This works fine most of the time, but breaks in a mono-repo where the actual `node_modules` directory might be above the current project in the directory structure.

This change dynamically locates the `sentry-cli` executable by:

1. Dynamically locating the `package.json` for the `@sentry/cli` package in a way that will work for both standard and mono-repo setups
2. Extracting the root of the `@sentry/cli` package from that path, which should be safe; the `package.json` will always be at the package root
3. Reading the `package.json` file for `@sentry/cli` to determine where the executable actually lives
4. Building an absolute path to the `sentry-cli` executable from the information that we've gathered

This makes the approach to locating `sentry-cli` resilient to changes in the directory structure for different types of apps
@alexlafroscia alexlafroscia force-pushed the better-sentry-cli-resolution branch from 0b8bd3f to 1789b10 Compare October 26, 2021 21:01
@Exelord
Copy link
Member

Exelord commented Oct 28, 2021

This is awesome! Thank you Alex <3

@Exelord Exelord merged commit 2c2b69f into EmberExperts:master Oct 28, 2021
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.

2 participants