Azion CLI init
Azion CLI command that starts a project from a preset and a template, with every flag, its type, its default, and each question it asks.
The Azion CLI init command starts a project from a preset and a template, in a folder it creates inside the current directory. A preset gives the project the build settings of one framework or language, and the template is the starter code for that preset. The command writes the azion folder that Azion CLI deploy reads later. The presets the build accepts are listed on Azion CLI presets, and the options every command accepts, such as --format, --out, and -y, are on Global options.
Usage
azion init asks for the preset and the template in two pickers, then fetches the template and sets up the project:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--auto |
— | — | — | Skips the questions about a local development server and a deploy at the end of the command. |
--config-dir |
— | string | "azion" |
Relative path to the folder that holds your azion.json and args.json files. |
--local |
— | — | — | Runs the build and the deploy on your machine when you deploy the project from this command. |
--name |
— | string | — | Name of the application. The command creates the project in a folder with this name. Without it, the command asks for the name. |
--package-manager |
— | string | — | Package manager that installs the project dependencies, such as npm, yarn, or pnpm. |
--skip-framework-build |
— | — | — | Skips the framework build that runs before azion build. |
--sync |
— | — | — | Synchronizes the local azion.json file with the remote resources when you deploy the project from this command. |
The command has no flag that sets the preset or the template: --preset and --template are refused with Error: unknown flag. You choose both in the pickers on every run, even with --auto. To also answer the dependency question without stopping, add -y to --auto.
The pickers need a terminal. Without one, the command stops with Error: EOF.
After the command ends, change to the project folder before you build or deploy. The command prints this reminder in its output.
Prompts
azion init asks these questions in this order. A picker moves with the arrow keys and filters as you type:
| Prompt | When it appears | How to skip it |
|---|---|---|
Your application's name: |
Without --name. The suggested name in parentheses is random on each run. |
--name |
Choose a preset: |
On every run. | No flag |
Choose a template: |
After the preset. It lists the templates of the chosen preset. | No flag |
Do you want to install project dependencies? This may be required to generate initial configuration file (Y/n) |
After the template is fetched and configured. | -y answers yes |
Do you want to start a local development server? (y/N) |
After the dependencies are installed and the configuration is built. With n, the command prints that Azion CLI dev starts the server later. |
--auto |
Do you want to deploy your project? (y/N) |
After the development server question. With n, the command prints that azion deploy deploys the project later. |
--auto |
The preset picker offers 25 presets: AI Studio, Angular, Astro, Docusaurus, Eleventy, Emscripten, Gatsby, Hexo, Hono, Hugo, Javascript, Jekyll, Next, Nuxt, OpenNextJS, Preact, Qwik, React, Rustwasm, Stencil, Svelte, Typescript, Vitepress, Vue, and Vuepress.
This list differs from the one azion list presets prints, and it has no HTML entry. To set up an HTML site, run azion link --preset html in the site folder, as Azion CLI link describes.
Examples
Each example shows the command and the output it prints.
Initialize a project interactively
This command starts a project named my-app. In the pickers, select Javascript and then Hello World, and answer Y to the dependency question:
The command fetches the template, installs the dependencies, and builds the initial configuration:
The command then asks whether to start a local development server and whether to deploy the project. With n to both, it prints how to run each later and ends with Your application my-app was initialized successfully.
The command creates the project in a my-app folder inside the current directory. For the Hello World template of the Javascript preset, the folder holds these files:
The template sets the extension of the configuration file, azion.config.mjs or azion.config.cjs. For more information, refer to azion.config.js.
Initialize a project with fewer questions
This command starts the same project with only the two pickers to answer. Select Javascript and then Hello World:
The -y option installs the dependencies, and --auto skips the development server and deploy questions. The command deploys nothing: