import { TARGET_JSON_FILE_NAME } from '../../../paths';
import { Spinner } from '../../../util';
import { TargetConfig, TargetJsonFile } from '../../../core/app';

export async function writeTargetJsonFileComponent(targetConfig: TargetConfig) {
  const message = `Write ${TARGET_JSON_FILE_NAME}`;
  try {
    TargetJsonFile().write(targetConfig);
    Spinner(message).succeed();
  } catch (exception) {
    Spinner(message).fail();
    throw exception;
  }
}
