CircleCI-Public / circleci-config-sdk-ts

Generate CircleCI Configuration YAML from JavaScript or TypeScript. Use Dynamic Configuration and the Config SDK together for live generative config.
https://circleci-public.github.io/circleci-config-sdk-ts/
Apache License 2.0
82 stars 29 forks source link

Refactor!: expand run command parameters #131

Open KyleTryon opened 2 years ago

KyleTryon commented 2 years ago

Currently, the constructor for the Run native command takes in a singular argument RunParameters, which is an object containing all possible parameters of the Run command.

While the singular argument for parameters in the constructor is preferred, we should expand the internal properties.

https://github.com/CircleCI-Public/circleci-config-sdk-ts/blob/main/src/lib/Components/Commands/exports/Native/Run.ts#L20

constructor(parameters: RunParameters) {
    this.parameters = parameters;
  }

This should be expanded into this instead.

/**
   * Command to run via the shell
   */
  command: StringParameter;
  /**
   * Shell to use for execution command (default: See Default Shell Options)
   */
  shell?: StringParameter;
...
batovpasha commented 2 years ago

@KyleTryon Hello! I want to clarify one moment. Do you mean we need to destructure all properties from the parameters parameter and assign each of them to an own this class property? For example:

constructor(parameters: RunParameters) {
    const {shell, command} = parameters;

    this.shell = shell;
    this.command = command;
    // Other properties
}