# Publishing `create-exotel-gwt-app` to npm

This folder is the **CLI package** (`create-exotel-gwt-app`). The generated apps live under `template/vite-app/` and are **not** published separately unless you choose to.

## Prerequisite

- An [npmjs.com](https://www.npmjs.com/) account.
- Permission to publish the chosen package name (unscoped **`create-exotel-gwt-app`**, or your org’s scoped name, e.g. **`@your-org/create-exotel-gwt-app`**).

## One-time setup

```bash
cd /path/to/create-gwt-app
npm login
npm whoami
```

## Before each release

1. **Bump version** in `package.json` (semver: patch / minor / major).
2. **Changelog** — note what changed (template, CLI, docs).
3. **Verify the template**:

   ```bash
   npm run verify-template
   ```

4. **Verify Signal-only UI imports** (also runs automatically as `prepublishOnly`):

   ```bash
   npm run check-signal-imports
   ```

   The Signal Design System is **mandatory**. This script scans `template/vite-app/app/**` for any direct `@mui/material` / `@mui/icons-material` imports and fails the publish if it finds any. The same script ships in every scaffolded app (`scripts/check-signal-imports.cjs`) and runs as `predev` / `prebuild`. Allowed exception: `@mui/material/styles` for `useTheme` and friends. Bypass for one-off dev only via `CHECK_SIGNAL_IMPORTS=skip`.

5. **Optional dry run** — see what would be packed:

   ```bash
   npm pack --dry-run
   ```

   Confirm `package.json` `"files"` includes `index.js`, `useCases.js`, `scripts/`, `template/` (no `node_modules`, no generated `template/vite-app/dist`).

## Publish

From `create-gwt-app/`:

```bash
npm publish
```

- **Scoped package** (`@org/name`): first publish usually needs public access:

  ```bash
  npm publish --access public
  ```

- **OTP / 2FA**: npm may prompt for a one-time password.

## After publish

Consumers can run:

```bash
npx create-exotel-gwt-app@latest
# or
npm create exotel-gwt-app@latest
```

(`npm create` maps `create-<name>` → `create-<name>` package.)

## Private registry

If Exotel uses a private registry, set `publishConfig.registry` in `package.json` and/or `.npmrc`, then `npm publish` as usual.

## Template dependency: Signal Design System

Scaffolded apps depend on **`@exotel-npm-dev/signal-design-system`**. Consumers must be able to reach that registry (public npm or your internal mirror). If the package is private, document how to add `.npmrc` in **DEVELOPER.md** for generated projects (same as Omni).
