Default config
Knope has some default configuration for things that aren’t specified in a knope.toml file
(either when the file isn’t present, or when there are missing sections).
To find out what your project’s default config is, use
knope --generate (with no knope.toml file in the current directory).
Packages
Section titled “Packages”When there are no packages defined in a knope.toml file, Knope tries to find supported packages automatically.
Single package
Section titled “Single package”Most of the time, Knope will look for any supported formats in the current directory and add all of those to a single package:
[package]versioned_files = ["Cargo.toml", "package.json"]changelog = "CHANGELOG.md"The changelog field is only set if there’s a CHANGELOG.md file in the current directory.
Cargo workspaces
Section titled “Cargo workspaces”If there’s a Cargo.toml file in the current directory that looks like a Cargo workspace,
Knope will create a package for each member.
[workspace]members = ["member1", "member2"]The names of these packages are from the name in their respective Cargo.toml files, not the directory name.
There must be a Cargo.toml file in each member directory, or Knope will error.
Knope will also attempt to detect dependencies by package name between members and keep them up to date.
With a workspace like this:
[workspace]members = ["member1", "member2"]
[workspace.dependencies]something = { path = "member1" }something-else = { path = "member2" }[package]name = "something"version = "1.0.0"
[dependencies]something-else = { path = "../something-else", version = "0.1.0" }[package]name = "something-else"version = "0.1.0"The default knope.toml file will look like this:
[packages.something]versioned_files = [ "member1/Cargo.toml", "Cargo.lock", { path = "Cargo.toml", dependency = "something" },]scopes = ["something"]
[packages.something-else]versioned_files = [ "member2/Cargo.toml", "Cargo.lock", { path = "Cargo.toml", dependency = "something-else" }, { path = "member1/Cargo.toml", dependency = "something-else" },]scopes = ["something-else"]NPM Workspaces Knope 0.21.0+
Section titled “NPM Workspaces ”If there’s a package.json file in the current directory with workspaces defined, Knope will create a package for each
workspace.
{ "workspaces": ["member1", "others/*"] }The names of these packages are from the name in their respective package.json files, not the directory name.
Knope will also attempt to detect dependencies by package name between members and keep them up to date.
For the above package.json which defines workspaces, with this file tree:
- package.json # Workspace
- package-lock.json
Directorymember1/
- package.json # name = “first”, depends on “second”
Directoryothers/
Directorymember2/ - package.json # name = “second”
- …
DirectoryanotherDir/
- …
The default knope.toml file will look something like this:
[packages.first]versioned_files = [ "member1/package.json", { path = "package-lock.json", dependency = "first" },]scopes = ["first"]
[packages.something-else]versioned_files = [ "others/member2/package.json", { path = "package-lock.json", dependency = "second" }, { path = "member1/package.json", dependency = "second" },]scopes = ["second"]Deno workspaces
Section titled “Deno workspaces”If there’s a deno.json file in the current directory with a workspace
array, Knope will create a package for each member that has both a name and a version in its deno.json (or deno.jsonc).
Any package.json files living alongside those manifests are also considered so mixed JSR/NPM modules stay aligned.
{ "workspace": ["first", "packages/second"]}- deno.json # Workspace
- deno.lock
Directoryfirst/
- deno.json # name = “@scope/first”, depends on second
Directorypackages/
Directorysecond/
- deno.json # name = “@scope/second”
For this layout, the default knope.toml file looks like:
[packages."@scope/first"]versioned_files = [ "first/deno.json", { path = "deno.lock", dependency = "@scope/first" },]scopes = ["@scope/first"]
[packages."@scope/second"]versioned_files = [ "packages/second/deno.json", { path = "deno.lock", dependency = "@scope/second" }, { path = "first/deno.json", dependency = "@scope/second" },]scopes = ["@scope/second"]If a member also has a package.json with a version, Knope adds that file to the relevant package and keeps
deno.lock entries aligned for both the Deno and Node manifests.
Workflows
Section titled “Workflows”When there are no workflows defined in a knope.toml file, Knope will use the default workflows.
Some pieces will differ depending on the configured packages and forges:
[[workflows]]name = "release"
[[workflows.steps]]type = "PrepareRelease"
[[workflows.steps]]type = "Command"command = "git commit -m \"chore: prepare release $version\""
[[workflows.steps]]type = "Command"command = "git push"
[[workflows.steps]]type = "Release"
[[workflows]]name = "document-change"
[[workflows.steps]]type = "CreateChangeFile"
[[workflows]]name = "get-version"help_text = "Get the current version of the project"
[[workflows.steps]]type = "Command"command = "echo \"$version\""Forges
Section titled “Forges”If there is a knope.toml file, no forges will be configured by default.
If there is no knope.toml file, Knope will look at the first Git remote to determine a forge config.
For example, if the first Git remote is [email protected]:knope-dev/knope.git, Knope will generate a GitHub config:
[github]owner = "knope-dev"repo = "knope"See forges for more info.