# Signed license file for Angular and other builds

Projects that use `ng build` or another build system without a Needle plugin can
generate a small signed license file before building. The generated file
contains a signed JWT, never a Needle Cloud access token. Needle Engine verifies
the JWT in the browser before the usual runtime license check.

Add a meta tag to the application's `index.html`:

```html
<meta name="needle-license" content="needle-license.json">
```

For an Angular CLI application whose `public/` directory is copied to the
build output, add these npm scripts:

```json
{
  "scripts": {
    "prestart": "needle-license --out public/needle-license.json",
    "start": "ng serve",
    "prebuild": "needle-license --out public/needle-license.json",
    "build": "ng build"
  }
}
```

Run `npm start` for development and `npm run build` for production. These npm
commands generate the file first. Running `ng serve` or `ng build` directly
does not regenerate it. Add `public/needle-license.json` to `.gitignore` so a
locally generated license is not committed by accident.

The command uses the same license resolver as Needle's Vite plugin. Set
`NEEDLE_CLOUD_TOKEN` in CI or pass `--team your-team-id` when the license
belongs to a specific team. If no signed license can be resolved, it writes an
empty JWT, replacing any older file. The engine then uses its runtime license
check. A license file loaded through the meta tag is requested with
`cache: "no-store"`.
