application
nx g @geekvetica/nx-astro:application my-appThe generator has the alias @geekvetica/nx-astro:app. It creates a minimal Astro project in apps/my-app, or in the directory you choose:
| File | Content |
|---|---|
astro.config.mjs |
Static output, with outDir at dist/apps/my-app in the workspace root |
project.json |
The targets dev, build, preview, check and sync |
package.json |
Name, version and "type": "module" |
tsconfig.base.json |
Extends the TypeScript config of the workspace |
tsconfig.json |
@/* for src, plus a copy of the workspace aliases |
src/, public/ |
One page with a layout and a component, and a favicon |
It also adds the project to the references of the root tsconfig.json, and creates a root tsconfig.base.json when the workspace has no TypeScript config to extend.
The name has to start with a letter and contain only letters, numbers and hyphens. It is written in kebab case: MyApp becomes my-app.
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
name (required) |
string | none | Application name, the first positional argument. |
directory |
string | none | Directory of the application, relative to the workspace root. Without it apps/<name>. |
tags |
string | none | Comma-separated tags for the project. |
importExisting |
boolean | false |
Registers a project that is already in the directory instead of creating files. |
template |
string | minimal |
Starter template. minimal is the only one. |
skipFormat |
boolean | false |
Does not format the generated files. |
astroVersion |
string | latest |
Deprecated, has no effect. Accepts 5, 6, 7 and latest. Choose the Astro version with the init generator. |
Examples
Section titled “Examples”Choose the directory and add tags:
nx g @geekvetica/nx-astro:application handbook --directory=sites/handbook --tags=type:site,scope:docsRegister an Astro project that is already in apps/handbook:
nx g @geekvetica/nx-astro:application handbook --importExistingWith --importExisting the project needs its own tsconfig.json: the generator references the directory from the root tsconfig.json, and Astro builds in the workspace fail when that file is missing. Use the import generator for a project outside the workspace.