npm package: @sparrowengg/nexgate
Description: Nexus cli
Author: Akshay U
Latest version: 0.0.1-beta.9

# @sparrowengg/nexgate

> Official CLI tool for initializing Nexgate projects

[![npm version](https://img.shields.io/npm/v/@sparrowengg/nexgate.svg?style=flat-square)](https://www.npmjs.com/package/@sparrowengg/nexgate)
[![Node.js version](https://img.shields.io/node/v/@sparrowengg/nexgate.svg?style=flat-square)](https://nodejs.org/)

## Features

- 🚀 **Quick Project Setup** - Initialize new Nexgate projects with a single command
- 📦 **Template-Based** - Uses the official Nexgate template repository
- 🎯 **Interactive Prompts** - User-friendly prompts for project configuration
- ⚡ **Zero Configuration** - Works out of the box with sensible defaults

## Prerequisites

- **Node.js** >= 18.0.0
- **npm** or **yarn** package manager
- Access to the Nexgate template repository (https://bitbucket.org/surveysparrow/nexgate-template)

## Installation

### Global Installation (Recommended)

Install the CLI globally to use it from anywhere:

```bash
npm install -g @sparrowengg/nexgate
```

After installation, verify it's working:

```bash
nexgate --version
```

**Note:** If you get `command not found: nexgate` after global installation, ensure your npm global bin directory is in your PATH. You can check with `npm bin -g` and add it to your shell configuration if needed.

### Local Installation

If you prefer to install it locally in your project:

```bash
npm install --save-dev @sparrowengg/nexgate
```

When installed locally, you need to use `npx` to run the command:

```bash
npx nexgate init
```

## Usage

### Initialize a New Project

The primary command is `init`, which creates a new Nexgate project:

```bash
nexgate init
```

This will prompt you for:
- **Project name**: The display name for your project (default: "My Project")
- **Directory name**: The folder name where the project will be created (auto-generated from project name if not provided)

### Example

```bash
$ nexgate init
? Project name: My Awesome App
? Directory name: my-awesome-app
Cloning template from https://bitbucket.org/surveysparrow/nexgate-template.git to /path/to/my-awesome-app...
Template cloned successfully.
```

### With Project Name Argument

You can also provide the project name directly:

```bash
nexgate init my-project-name
```

This will skip the project name prompt and use "my-project-name" as the default directory name.

### Using npx (No Installation Required)

You can also use the CLI without installing it:

```bash
npx @sparrowengg/nexgate init
```

## How It Works

1. The CLI prompts for project name and directory name
2. Automatically converts project names to valid package names (lowercase, kebab-case)
3. Clones the official Nexgate template from Bitbucket
4. Updates the project's `package.json` with your project name
5. Your new project is ready to use in the specified directory

## Starter Commands

After initializing your project:

```bash
cd my-project-name
yarn install
yarn dev
```

## Troubleshooting

### Command Not Found

If `nexgate` command is not found after global installation:

1. Check if it's installed: `npm list -g @sparrowengg/nexgate`
2. Verify your PATH includes npm's global bin directory: `npm bin -g`
3. Add to PATH if needed (macOS/Linux):
   ```bash
   echo 'export PATH="$(npm bin -g):$PATH"' >> ~/.zshrc
   source ~/.zshrc
   ```

### Template Clone Fails

- Ensure you have internet access
- Verify you have access to the private Bitbucket repository
- Check that Git is installed and configured

## License

MIT