Documentation
    Preparing search index...

    RcFileTransformer is used to transform the adonisrc.ts file for adding new commands, providers, meta files etc.

    This class provides a fluent API for modifying the AdonisJS configuration file (adonisrc.ts) by adding various types of entries like providers, commands, preloaded files, meta files, and test suites.

    const transformer = new RcFileTransformer(cwd, project)
    transformer.addProvider('#providers/app_provider')
    transformer.addCommand('#commands/make_controller')
    await transformer.save()
    Index

    Constructors

    Methods

    • Add a new preloaded file to the rcFile

      Parameters

      • modulePath: string

        The path to the preload file

      • Optionalenvironments: ("test" | "web" | "console" | "repl")[]

        Optional array of environments where this preload should run

      Returns RcFileTransformer

      This RcFileTransformer instance for method chaining

    • Add a new provider to the rcFile

      Parameters

      • providerPath: string

        The path to the provider file

      • Optionalenvironments: ("test" | "web" | "console" | "repl")[]

        Optional array of environments where this provider should run

      Returns RcFileTransformer

      This RcFileTransformer instance for method chaining

    • Add a new test suite to the rcFile

      Parameters

      • suiteName: string

        The name of the test suite

      • files: string | string[]

        File patterns for the test suite (string or array)

      • Optionaltimeout: number

        Optional timeout in milliseconds (defaults to 2000)

      Returns RcFileTransformer

      This RcFileTransformer instance for method chaining

    • Add a new assembler hook

      Parameters

      • type:
            | "init"
            | (keyof RouterHooks)
            | (keyof WatcherHooks)
            | (keyof DevServerHooks)
            | (keyof BundlerHooks)
            | (keyof TestRunnerHooks)

        The type of hook to add

      • path: string

        The path to the hook file

      Returns RcFileTransformer

      This RcFileTransformer instance for method chaining

    • Save the adonisrc.ts file with all applied transformations

      Formats the file according to editor settings and saves it to disk.

      Returns Promise<void>

      Promise that resolves when the file is saved