Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.
Arthur Bleil edited this page Mar 10, 2022 · 26 revisions

Beagle Backend TypeScript CLI

This is the CLI for Beagle Backend TypeScript, where you can quickly create a new project and generate screens.

Setting Up a Project

Install the Beagle Backend TypeScript CLI globally:

npm install -g @zup-it/beagle-backend-typescript-cli

Create a new project:

beagle-ts new [PROJECT NAME]

Run the application:

cd [PROJECT NAME]
npm run start

Generating a Basic Screen

Go to the project root and run:

beagle-ts generate-screen [SCREEN NAME]

The new screen will be generated inside the folder: src/screens, or inside the folder defined on the attribute screensFolderPath in the configuration file ./beagle-ts.json.

The generated screen code will be:

import { BeagleJSX } from '@zup-it/beagle-backend-core'
import { Text } from '@zup-it/beagle-backend-components'

export const ScreenNameScreen = () => (
  <>
    <Text>This the ScreenNameScreen screen component!</Text>
  </>
)

Also, when you generate a screen, the routes are updated with your new screen, like this:

import { RouteMap } from '@zup-it/beagle-backend-express'
import { Home } from './home'
import { Welcome } from './welcome'
import { ScreenName } from './screen-name'

export const routes: RouteMap = {
  '': Welcome,
  '/home': Home,
  '/screen-name': ScreenName,
}
Clone this wiki locally