npm package: @incodetech/create-dashboard
Description: CLI tool to create new Incode dashboard applications
Latest version: 0.6.8

# @incodetech/create-dashboard

A CLI tool to quickly scaffold a new Incode dashboard application from a template.

## Features

- Downloads the latest dashboard template from the IncodeTechnologies/dashboards-ui repository
- Sets up a new project directory with the template code
- Optionally copies the source code of the dashboard UI components instead of using the npm dependency (see `-c` option)
- Automatically updates the project name and version in `package.json`
- Guides you through the next steps to get started

## Prerequisites

- [Node.js](https://nodejs.org/) (v20 or higher recommended)
- [Git](https://git-scm.com/) with SSH access to GitHub (your SSH key must be added to your GitHub account)
- [NPM](https://www.npmjs.com/) you also need to be a part of @incodetech org on npm, or you can obtain INCODE_DASHBOARD_NPM_TOKEN from org member in order to install the dependencies which are under private scope of the org.

## Installation

You can use this CLI directly with `npx`

```sh
export INCODE_DASHBOARD_NPM_TOKEN=npm_myorgtoken
npx @incodetech/create-dashboard my-dashboard
```

## Usage

### Create a new dashboard project

```sh
npx @incodetech/create-dashboard [options] <project-directory>
```

- Replace `<project-directory>` with your desired project name.
- If you omit the project name, the CLI will prompt you for one.

### Options

- `-c`, `--copy-components-source-code`
  Copy the source code of the dashboard UI components into your new project instead of adding `@incodetech/dashboard-ui` as an npm dependency. This is useful if you want to customize or directly inspect the component implementations.

  If you do not specify this option, you will be prompted interactively.

### What happens?

- The CLI clones the dashboard template from the [IncodeTechnologies/dashboards-ui](https://github.com/IncodeTechnologies/dashboards-ui) repository using a sparse checkout (only the template app is downloaded).
- It copies the template to your new project directory.
- If you use the `-c` option, it copies the source code of the dashboard UI components into your project (under `src/components`) and updates imports accordingly. Otherwise, it adds `@incodetech/dashboard-ui` as a dependency.
- It updates the `package.json` with your project name and resets the version to `0.1.0`.
- It cleans up any temporary files.

### Next steps

After the CLI finishes, follow the instructions:

```sh
cd my-dashboard
npm install
npm run dev
```

Or if you wish to use yarn:

```sh
cd my-dashboard
touch yarn.lock
yarn install
yarn dev
```

## Example

Create a dashboard project using the npm package for UI components (default):

```sh
export INCODE_DASHBOARD_NPM_TOKEN=npm_myorgtoken
npx @incodetech/create-dashboard awesome-dashboard
```

Create a dashboard project and copy the dashboard UI component source code:

```sh
export INCODE_DASHBOARD_NPM_TOKEN=npm_myorgtoken
npx @incodetech/create-dashboard awesome-dashboard -c
```

## Troubleshooting

- **SSH required:** Make sure your GitHub SSH key is set up and you have access to the IncodeTechnologies/dashboards-ui repository.
- **Directory already exists:** The CLI will not overwrite existing directories.