# Add Package Generator

This generator creates a new package in the Unisphere workspace with proper configuration based on the scope and naming conventions.

## Usage

```bash
# Using the generator with the full path
npx nx generate @unisphere/nx:add-package
```

## User Prompts

The generator will prompt you for the following information:

### Required Inputs

1. **packageName** (mandatory)

   - Format: `a-zA-Z[-][ ]` (alphanumeric with dashes and spaces allowed)
   - Example: `core`, `notification-service`, `user management`

2. **scope** (required, defaults to 'internal')
   - **public**: server to npm with `@unisphere/` prefix
   - **internal**: server to GitHub packages with `@kaltura-corp/unisphere-` prefix
   - **none**: Private repository only, no scope prefix

## Local Development & Distribution

### Packaging for Local Use

Use the built-in packaging tool to create distributable packages:

```bash
# Interactive packager - guides you through the process
npm run pack-generator

# This will:
# 1. Build the generator automatically
# 2. Create an npm package (.tgz file)
# 3. Ask what you want to do with it:
#    - Move to a specific directory
#    - Install directly in a target repository
#    - Keep in current directory
```

### Installing in Other Repositories

After packaging, install in your target repository:

```bash
# Install the generated package
npm install --save-dev path/to/unisphere-nx-unisphere-generator-0.0.1.tgz

# Use the generator
npx nx g @unisphere/nx:add-package
```

### Alternative Installation Methods

1. **Direct file path** (for development):

   ```bash
   npm install --save-dev file:../path/to/unisphere-nx/unisphere-generator
   ```

2. **Using npx directly**:
   ```bash
   npx --package file:../unisphere-nx/unisphere-generator nx g @unisphere/nx:add-package
   ```
