farrow
Useful modules for developing farrow app
Setup
Install via npm or yarn
# via npm
npm install --save farrow
# via yarn
yarn add farrow
add scripts
to your package.json
{
"scripts": {
"dev": "farrow dev",
"build": "farrow build",
"start": "farrow start"
}
}
and then:
npm run dev
for developing
npm run build
for bundling the source code
npm run start
for running the output code of bundler
farrow
assumes that your source code is in src
folder, and the output code is in dist
folder.
farrow.config.js
farrow.config.js
is used to configure the behavior of farrow
Example
const { createFarrowConfig } = require('farrow')
module.exports = createFarrowConfig({
server: {
entry: 'index.js',
src: 'src',
dist: 'dist',
},
})
Type
export type Config = {
server?: ServerBundlerOptions | ServerBundlerOptions[] | false
api?: ApiClientOptions | ApiClientOptions[] | false
}
export type ServerBundlerOptions = {
entry?: string
src?: string
dist?: string
nodeArgs?: string[]
env?: NodeJS.ProcessEnv
esbuild?: Omit<BuildOptions, 'entryPoints' | 'outdir' | 'outbase'>
autoExternal?: boolean
}
export type ApiClientOptions = {
src: string
dist: string
codegen?: CodegenOptions
pollingInterval?: number
logger?: false | ((options: ApiClientOptions) => void)
transform?: (source: string) => string
format?: (source: string) => string
}
export type CodegenOptions = {
emitApiClient?: boolean
}