Skip to main content

init

deno module deno compatibility Build Coverage Status Deno

deno-init creates a Deno config file from the command line. It is loosely modeled after tsc --init and npm init.

Table of Contents

Requirements

  • Deno v1.17 or higher

Installation

deno install --allow-read --allow-write -fn deno-init https://deno.land/x/init@v2.6.0/mod.ts

Usage

Make a config file based on a number of prompts:

deno-init

Skip the prompts, use all defaults:

deno-init --yes

Add every possible option in comments (as a .jsonc file):

deno-init --fill

Options

--help or -h will print the CLI documentation to the terminal.

--yes or -y will skip the prompts and initialize the file in the current working directory with default values:

deno-init --yes

--fill or -i will create a deno.jsonc config file with all the possible configuration options listed as comments. This style is very similar to the output of tsc --init for generating a tsconfig.json.

deno-init --fill

It is also possible to add only specific fields to the config file and fill them with options in comments, for example:

deno-init --fmt --fill

--fmt or -m will add a fmt section only.

deno-init --fmt

--lint or -l will add a lint section only.

deno-init --lint

--map or -p will add an importMap section only. Note that using importMap requires Deno 1.20 or higher.

deno-init --map

--task or -k will add a tasks section only. Note that using tasks requires Deno 1.20 or higher.

deno-init --task

--test or -s will add a test section only. Note that using test requires Deno 1.24 or higher.

deno-init --test

--tsconfig or -t will add a compilerOptions section only.

deno-init --tsconfig

It is possible to combine the fmt, lint, map, task and tsconfig options.

--name or -n will use a non-default name for the config file. The default name is deno.json. Note that using a non-default name may prevent config file auto-discovery.

deno-init --name config.json

--force or -f will allow overwriting an existing config file.

Contributing

You are welcome to report bugs, other issues, or make a feature request! If you want to add a fix/feature/other improvement, please fork this repository and make a pull request with your changes.