Private betav0.1.0
Docs
Format developer documentation

format init

Set up Format in an existing project.

Bootstraps Format into an existing repo. The init script will create a format.config.json, add npm scripts, update your .gitignore, and install the relevant Format packages for your chosen framework. Each step asks before touching anything. Finally, it offers to create your first document, so you can dive straight in.

If you are starting with a completely blank slate with no existing files or dependencies, you should use format new project instead.

If you'd rather set everything up manually, follow the manual setup instead.

npx format init
pnpm dlx format init
yarn dlx format init
bun x format init

Reference

NameDescription
The framework to build your documents with — React, Vue or HTML. Detected from your dependencies when omitted.
Where to install the Format project into. The path you give will be set in your Format config's rootDir.
Don't automatically add or install any Format packages.
Don't add the npm dev and npm compile scripts to your package.json. Existing dev and compile script names are never overwritten regardless, If there's a name clash, they get a format: prefix.
Don't append the _generated and .env entries to .gitignore. Existing lines are never touched.
Don't offer to create a first document.
Skip all prompts and use the defaults for every option that isn't provided.

Details

--framework <framework>

Description
The framework to build your documents with — React, Vue or HTML. Detected from your dependencies when omitted.
Type
"react" | "vue" | "html"

--root-dir <dir>

Description
Where to install the Format project into. The path you give will be set in your Format config's rootDir.
Type
string

--no-install

Description
Don't automatically add or install any Format packages.
Type
boolean
Default value
true
Note
Negation flag: default is true. Passing --no-install sets this to false.

--no-scripts

Description
Don't add the npm dev and npm compile scripts to your package.json. Existing dev and compile script names are never overwritten regardless, If there's a name clash, they get a format: prefix.
Type
boolean
Default value
true
Note
Negation flag: default is true. Passing --no-scripts sets this to false.

--no-gitignore

Description
Don't append the _generated and .env entries to .gitignore. Existing lines are never touched.
Type
boolean
Default value
true
Note
Negation flag: default is true. Passing --no-gitignore sets this to false.

--no-document

Description
Don't offer to create a first document.
Type
boolean
Default value
true
Note
Negation flag: default is true. Passing --no-document sets this to false.

-y, --yes

Description
Skip all prompts and use the defaults for every option that isn't provided.
Type
boolean
Default value
false
Was this page helpful?