# @sixtyninecommerce/create-storefront

Scaffolder for the [sixtynine-commerce storefront template](https://github.com/SIXTYNINE-digital/sixtynine-commerce-storefront-starter).

## Usage

```bash
npm create @sixtyninecommerce/storefront <project-dir> --store-code <code>
```

Example:

```bash
npm create @sixtyninecommerce/storefront my-shop --store-code my-channel
```

The CLI:

1. Validates the channel exists by calling `client.commerce.getBranding()`.
2. Downloads the latest tagged release of the template from GitHub.
3. Applies your channel's `BrandingInfo` to the scaffold:
   - Writes `src/theme.config.ts` with the primary color and font identifiers.
   - Drops `logo-light`, `logo-dark`, `favicon`, and `cover` assets into `public/`.
   - Writes `.env.local` so `npm run dev` connects to the right channel.
   - Substitutes `package.json` `name` and `description`.
4. Picks the locale shape that matches the channel's `urlLocaleStrategy`.

## Flags

| Flag | Default | Notes |
|---|---|---|
| `--store-code <code>` | (required) | Channel code from the dashboard |
| `--cdn-url <url>` | `https://cdn.sixtyninecommerce.com` | Channel CDN base URL |
| `--cms-url <url>` | SDK production default | Override for self-hosted/local CMS |
| `--vendure-url <url>` | SDK production default | Override for self-hosted/local Vendure |
| `--plugins-url <url>` | SDK production default | Override for self-hosted/local plugins service |
| `--site-url <url>` | `branding.storefront.url` or `http://localhost:6969` | Storefront URL for SEO meta |
| `--template-ref <ref>` | latest release tag | Tag, branch, or commit SHA |

## Environment

- `GITHUB_TOKEN` — set when fetching from a private repo or to avoid GitHub rate limits.

## After scaffolding

```bash
cd <project-dir>
npm install
npm run dev
```
