<commit_before>import * as path from 'path';
import * as chalk from 'chalk';
import {
  CommandLineInputs,
  CommandLineOptions,
  Command,
  CommandMetadata,
  CommandPreRun,
  promptToLogin,
} from '@ionic/cli-utils';

import {
  ImageResource,
  SourceImage,
  ResourcesConfig,
  ResourcesImageConfig,
  KnownPlatform,
  ImageUploadResponse
} from '../definitions';
import { getProjectPlatforms, installPlatform } from '../lib/utils/setup';
import { getOrientationFromConfigJson, parseConfigXmlToJson } from '../lib/utils/configXmlUtils';
import {
  flattenResourceJsonStructure,
  createImgDestinationDirectories,
  getSourceImages,
  findMostSpecificImage,
  uploadSourceImages,
  transformResourceImage,
  getResourceConfigJson,
  addResourcesToConfigXml
} from '../lib/resources';

/*
const RESOURCES_SUMMARY =
`Automatically create icon and splash screen resources.
Put your images in the ./resources directory, named splash or icon.
Accepted file types are .png, .ai, and .psd.
Icons should be 192x192 px without rounded corners.
Splashscreens should be 2732x2732 px, with the image centered in the middle.
`;
*/

const AVAILABLE_RESOURCE_TYPES = ['icon', 'splash'];

@CommandMetadata({
  name: 'resources',
  type: 'project',
  description: 'Automatically create icon and splash screen resources',
  exampleCommands: [''],
  inputs: [
    {
      name: 'platform',
      description: `The platform for which you would like to generate resources (e.g. ${chalk.green('ios')}, ${chalk.green('android')})`,
    }
  ],
  options: [
    {
      name: 'icon',
      description: 'Generate icon resources',
      type: Boolean,
      aliases: ['i'],
    },
    {
      name: 'splash',
      description: 'Generate splash screen resources',
      type: Boolean,
      aliases: ['s'],
    }
  ]
})
export class ResourcesCommand extends Command implements CommandPreRun {
  async preRun(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void | number> {
    const isLoggedIn = await this.env.session.isLoggedIn();
    if (!isLoggedIn) {
      this.env.log.warn(`You need to be logged into your Ionic account in order to run ${chalk.green(`ionic cordova resources`)}.\n`);
      await promptToLogin(this.env);
    }<commit_msg>refactor(cordova): mark platform as not required<commit_after>import * as path from 'path';
import * as chalk from 'chalk';
import {
  CommandLineInputs,
  CommandLineOptions,
  Command,
  CommandMetadata,
  CommandPreRun,
  promptToLogin,
} from '@ionic/cli-utils';

import {
  ImageResource,
  SourceImage,
  ResourcesConfig,
  ResourcesImageConfig,
  KnownPlatform,
  ImageUploadResponse
} from '../definitions';
import { getProjectPlatforms, installPlatform } from '../lib/utils/setup';
import { getOrientationFromConfigJson, parseConfigXmlToJson } from '../lib/utils/configXmlUtils';
import {
  flattenResourceJsonStructure,
  createImgDestinationDirectories,
  getSourceImages,
  findMostSpecificImage,
  uploadSourceImages,
  transformResourceImage,
  getResourceConfigJson,
  addResourcesToConfigXml
} from '../lib/resources';

/*
const RESOURCES_SUMMARY =
`Automatically create icon and splash screen resources.
Put your images in the ./resources directory, named splash or icon.
Accepted file types are .png, .ai, and .psd.
Icons should be 192x192 px without rounded corners.
Splashscreens should be 2732x2732 px, with the image centered in the middle.
`;
*/

const AVAILABLE_RESOURCE_TYPES = ['icon', 'splash'];

@CommandMetadata({
  name: 'resources',
  type: 'project',
  description: 'Automatically create icon and splash screen resources',
  exampleCommands: [''],
  inputs: [
    {
      name: 'platform',
      description: `The platform for which you would like to generate resources (e.g. ${chalk.green('ios')}, ${chalk.green('android')})`,
      required: false,
    }
  ],
  options: [
    {
      name: 'icon',
      description: 'Generate icon resources',
      type: Boolean,
      aliases: ['i'],
    },
    {
      name: 'splash',
      description: 'Generate splash screen resources',
      type: Boolean,
      aliases: ['s'],
    }
  ]
})
export class ResourcesCommand extends Command implements CommandPreRun {
  async preRun(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void | number> {
    const isLoggedIn = await this.env.session.isLoggedIn();
    if (!isLoggedIn) {
      this.env.log.warn(`You need to be logged into your Ionic account in order to run ${chalk.green(`ionic cordova resources`)}.\n`);
      await promptToLogin(this.env);
    }
{'fraction_non_alphanumeric': 0.11128250330542089, 'fraction_numerical': 0.00617011899515205, 'mean_word_length': 4.065848214285714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7553776', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1321, 'n_words': 391}