Class RomeStep


  • public class RomeStep
    extends java.lang.Object
    formatter step that formats JavaScript and TypeScript code with Rome: https://github.com/rome/tools. It delegates to the Rome executable. The Rome executable is downloaded from the network when no executable path is provided explicitly.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FormatterStep create()
      Creates a formatter step with the current configuration, which formats code by passing it to the Rome executable.
      static java.lang.String name()  
      RomeStep withConfigPath​(java.lang.String configPath)
      Sets the path to the directory with the rome.json config file.
      static RomeStep withExeDownload​(java.lang.String version, java.lang.String downloadDir)
      Creates a Rome step that format code by downloading to the given Rome version.
      static RomeStep withExePath​(java.lang.String pathToExe)
      Creates a Rome step that formats code by delegating to the Rome executable located at the given path.
      RomeStep withLanguage​(java.lang.String language)
      Sets the language of the files to format When no language is set, it is determined automatically from the file name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • name

        public static java.lang.String name()
        Returns:
        The name of this format step, i.e. rome.
      • withExeDownload

        public static RomeStep withExeDownload​(java.lang.String version,
                                               java.lang.String downloadDir)
        Creates a Rome step that format code by downloading to the given Rome version. The executable is downloaded from the network.
        Parameters:
        version - Version of the Rome executable to download.
        downloadDir - Directory where to place the downloaded executable.
        Returns:
        A new Rome step that download the executable from the network.
      • withExePath

        public static RomeStep withExePath​(java.lang.String pathToExe)
        Creates a Rome step that formats code by delegating to the Rome executable located at the given path.
        Parameters:
        pathToExe - Path to the Rome executable to use.
        Returns:
        A new Rome step that format with the given executable.
      • create

        public FormatterStep create()
        Creates a formatter step with the current configuration, which formats code by passing it to the Rome executable.
        Returns:
        A new formatter step for formatting with Rome.
      • withConfigPath

        public RomeStep withConfigPath​(java.lang.String configPath)
        Sets the path to the directory with the rome.json config file. When no config path is set, the default configuration is used.
        Parameters:
        configPath - Config path to use. Must point to a directory which contain a file named rome.json.
        Returns:
        This builder instance for chaining method calls.
      • withLanguage

        public RomeStep withLanguage​(java.lang.String language)
        Sets the language of the files to format When no language is set, it is determined automatically from the file name. The following languages are currently supported by Rome.
        • js (JavaScript)
        • jsx (JavaScript + JSX)
        • js? (JavaScript or JavaScript + JSX, depending on the file extension)
        • ts (TypeScript)
        • tsx (TypeScript + JSX)
        • ts? (TypeScript or TypeScript + JSX, depending on the file extension)
        • json (JSON)
        Parameters:
        language - The language of the files to format.
        Returns:
        This builder instance for chaining method calls.