Skip to content

Commit

Permalink
feat!: remove backwards compatibility-preserving hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
ivomurrell committed Sep 2, 2024
1 parent 4e6b931 commit 99b2ae3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
3 changes: 1 addition & 2 deletions lib/schemas/src/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export type SchemaPromptGenerator<T> = (
logger: Logger,
prompt: typeof prompts,
onCancel: () => void,
// HACK:20231209:IM add bizOpsSystem as optional parameter to maintain
// backwards compatibility
// bizOpsSystem will be undefined if project is not a system
bizOpsSystem?: BizOpsSystem
) => Promise<T | undefined>
// This type defines an interface you can use to export prompt generators. The
Expand Down
17 changes: 9 additions & 8 deletions plugins/circleci/src/circleci-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,16 @@ export type CircleCIState = CircleConfig
*/
export type CircleCIStatePartial = PartialDeep<CircleCIState>

// Make this function lazy so that the global options object will have been
// populated first.
const getNodeVersions = (): Array<string> => {
// HACK: This function should only ever be called after the Tool Kit options
// are loaded so that we can see which node versions are specified. However,
// older versions of the other CircleCI plugins may not do this properly, so
// to avoid a breaking change we fall back to creating an array with a single
// empty string. The first executor is named 'node' without any reference to
// the version so the plugins which don't support matrices don't need to know
// the version option.
return getOptions('@dotcom-tool-kit/circleci')?.cimgNodeVersions ?? ['']
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion --
* Tool Kit will try and parse options for every plugin it loads which has a
* schema. If we're running this code the @dotcom-tool-kit/circleci has by
* definition been loaded, and there is a schema associated with it. So the
* option field will be guaranteed to be present.
**/
return getOptions('@dotcom-tool-kit/circleci')!.cimgNodeVersions
}

/* Applies a verion identifier for all but the first (and therefore default)
Expand Down
4 changes: 1 addition & 3 deletions plugins/n-test/src/tasks/n-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export default class NTest extends Task<{ task: typeof SmokeTestSchema }> {

// if we've built a review or staging app, test against that, not the app in the config
if (appState) {
// HACK:20231003:IM keep the old logic of using the app name as the
// subdomain to maintain backwards compatibility
this.options.host = appState.url ? appState.url : `https://${appState.appName}.herokuapp.com`
this.options.host = appState.url
// HACK:20231003:IM n-test naively appends paths to the host URL so
// expects there to be no trailing slash
if (this.options.host.endsWith('/')) {
Expand Down

0 comments on commit 99b2ae3

Please sign in to comment.