Skip to main content

farrow

Useful modules for developing and bundling farrow app.

Setup

yarn add -D farrow

CLI

The farrow CLI allows you to dev, build, and start your application.

To get a list of the available CLI commands, run the following command inside your project directory:

farrow -h

The output should look like this:

Usage
$ farrow <command>

Available commands
dev, build, start

Options
--version, -v Version number
--help, -h Displays this message

For more information run a command with the --help flag
$ farrow dev --help

dev

farrow dev starts the application in development mode with hot-code reloading, error reporting, and more.

The application at src will start by default with development mode.

build

farrow build creates an optimized production build of your application.

start

farrow start runs the output code of bundler.

farrow.config.js

For define the behaviour of farrow, you need to create farrow.config.js file in the root of your project directory (next to package.json).

farrow.config.js is a regular Node.js module, not a JSON file.

Take a look at the following farrow.config.js example:

const { defineConfig } = require("farrow");

module.exports = defineConfig({
/* config options here */
});

Also support TypeScript

import { defineConfig } form 'farrow'

export default defineConfig({
/* config options here */
})

It has the type:

export type Config = {
server?: ServerBundlerOptions | ServerBundlerOptions[] | false;
api?: ApiClientOptions | ApiClientOptions[] | false;
};

server

The config of server app(s).

export type ServerBundlerOptions = {
entry?: string;
src?: string;
dist?: string;
nodeArgs?: string[];
env?: NodeJS.ProcessEnv;
esbuild?: Omit<BuildOptions, "entryPoints" | "outdir" | "outbase">;
autoExternal?: boolean;
};
  • entry

Entry of app. Default index.ts.

  • src

Folder of source code. Default ./src.

  • dist

Folder of output code. Default ./dist.

  • nodeArgs

For creating the config value. eg. { NODE_ENV: 'production' }.

  • env

Env value for Node.js. eg. { NODE_ENV: 'production' }, NODE_ENV = production in farrow start, NODE_ENV = development in farrow dev.

  • esbuild

Options for esbuild.

  • autoExternal

Auto add closest package.json dependenties to esbuild external or not.

api

Args for Node.js.

Learn more

Relative Module
Sample