Kanso.json format
Each package provides Kanso with basic information with its kanso.json file at the root of the package. All Kanso apps are also Kanso packages (so they're easy to share).
As kanso.json contains a single json document, you'll put all of your fields between {between curly braces}
Example Files
These give you an overview of what kanso.json looks like. See details about each field below.
Minimal
{
"name": "example-app",
"version": "0.0.1",
"description": "The simplest possible app",
"attachments": ["index.html"],
"dependencies": {
"attachments": null
}
}
Massive
{
"name": "bigger-app",
"version": "0.0.1",
"description": "A larger application",
"url": "http: //github.com/user123/bigger-app",
"load": "lib/app",
"modules": "lib",
"attachments": "static",
"dust": {
"templates": "templates"
},
"duality": {
"base_template": "base.html"
},
"coffee-script": {
"modules": ["lib"]
},
"less": {
"compress": true,
"compile": "static/css/style.less",
"remove_from_attachments": true
},
"dependencies": {
"underscore": null,
"modules": null,
"properties": null,
"url": null,
"path": null,
"db": null,
"session": null,
"users": null,
"sha1": null,
"cookies": null,
"sanitize": null,
"events": null,
"querystring": null,
"attachments": null,
"settings": null,
"duality": null,
"dust": null,
"duality-dust": null,
"couchtypes": null,
"coffee-script-precompiler": ">=0.0.3",
"handlebars": null
}
}
Details
Required Fields
Name
The name of a package is used as the name of the couchdb design document if you kanso push it and the name you'll use to require it or include it as a dependency.
"name": "the name of this application"
Version
A dot delimited version number generally in the format major_version.minor_version.patch_version
"version": "0.0.1"
Description
Used as the description of the package when it's published.
"description": "a short description of this application"
Common Fields
Dependencies
A dictionary of required package names and their required version numbers.
- To use the latest version of a package, enter
null. - You can specify version number requirements (
npmstyle) with>,>=,<, and<=. - You can also specify major versions only by doing
1.2.x, which would match1.2.1and1.2.2etc
"dependencies": {
"attachments": null,
"modules": ">=0.0.8",
"underscore": "1.2.0",
"coffee-script-precompiler": ">0.0.2"
}
Bundled Dependencies
Since Kanso 0.1.3, dependencies inside your packages directory will not be packed and uploaded to the package repository when you publish your package. If you need to directly include some packages in your upload you'll have to explicitly list them using the bundledDependencies property.
"dependencies": {
"modules": null,
"bundled-package": null
},
"bundledDependencies": [
"packages/bundled-package"
]
In the above example bundled-package would be uploaded to the package repository when you kanso publish but the modules package would not be uploaded. Packages not uploaded will be fetched individually from the package repository when someone depends on your package.
Don't bundle dependencies unless you have to, it just makes for a bigger download and makes version conflicts more likely to occur.
Url
Point to a site with further information about your package. Preferably this would be a link to the GitHub page for your package so it's easy for people to report bugs and get in touch with the author.
"url": "http: //github.com/user123/bigger-app"
Load
Used by the properties package to tell it which CommonJS module's exports to use when extending the design document. This is a require path, not a file path, so do not include the extension (.js).
"load": "lib/app"
Modules
Used by the modules package to tell it which files and directories of CommonJS modules to add to the design document.
"modules": ["lib"]
Attachments
Used by the attachments package to tell it which files and directories of static files to attach to the design document.
"attachments": ["static", "index.html"]
Custom Fields
kanso.json is a good place to put package-wide settings.