package.json file.
Usage
Description
Creates a newpackage.json file in the current directory with interactive prompts. If run non-interactively (e.g., in a CI environment), uses default values.
Options
Display help information.
Interactive Prompts
When run in an interactive terminal,ant init prompts for:
- package name: Defaults to the current directory name
- version: Defaults to
1.0.0 - entry point: Defaults to
index.js
Examples
Interactive Mode
Non-Interactive Mode
Generated package.json
The created file includes:Features
- ES Modules by Default: Sets
"type": "module" - Start Script: Automatically creates a start script with
ant - Smart Defaults: Uses directory name as package name
- Non-Interactive Support: Works in CI/CD pipelines
Error Handling
Ifpackage.json already exists:
Related
- ant install - Install dependencies
- ant add - Add packages to dependencies