Skip to content

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Nov 4, 2022

This PR marks the first step of re-adding CLI functionality. It removes our previous release detection code (RIP) and replaces it with CLI functionality. Doing this to ensure feature parity with the CLI, we can revisit this if we have time.

ref #85

authToken: userOptions.authToken,
url: userOptions.url ?? "https://sentry.io/",
release: userOptions.release ?? detectRelease(),
release: userOptions.release ?? "",
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems odd but I want to keep release a required property, hence I'm assigning an empty string.

Copy link

Choose a reason for hiding this comment

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

Would it hurt us to make it an optional property? If it is actually optional now, we should define it as such. (Same probably down the line for project, authToken etc. because they could be defined via config/env-vars now right?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, we'd have to check for its definedness everywhere while right now we could be sure that it's defined. For env vars (whenever we bring them back) we can just assign them in our normalization step so we could still leave token, org, project, etc required.

Generally, I'm thinking of moving our validation logic (which def needs to be refactored) into or before the final internal option conversion step so we can error before the plugin does anything. WDYT, does this sound reasonable?

Copy link
Member Author

@Lms24 Lms24 Nov 4, 2022

Choose a reason for hiding this comment

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

release is a special case here because we can't easily await the cli.releases.proposeVersion promise in the top-level function we pass to createUnplugin. Hence I moved it to the buildStart hook

Copy link
Member Author

@Lms24 Lms24 Nov 7, 2022

Choose a reason for hiding this comment

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

because they could be defined via config/env-vars now right?

@lforst especially the config file is a valid point. Haven't thought about this when making the change here. So this means that, unless we want to read and parse the config file during normalization (which I don't want to do unless necessary), we have to refactor our internal options conversion to actually make these parameters (releaes, authtoken, etc) optional again...

I'm gonna merge this PR to get some of the quick CLI replacements in and then tackle the options again. In the end this will change this line above

Comment on lines +123 to +125
if (!internalOptions.release) {
internalOptions.release = await cli.releases.proposeVersion();
}
Copy link
Member Author

@Lms24 Lms24 Nov 4, 2022

Choose a reason for hiding this comment

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

In case we don't have a release (i.e. an empty string), we use the CLI to detect it automatically

@Lms24 Lms24 merged commit 097252c into main Nov 7, 2022
@Lms24 Lms24 deleted the lms-cli-release branch November 7, 2022 10:25
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