Catalogs and Sources
Tusk uses a “consolidated” catalog, usually at ”$SEA/.tusk/catalog.json” to find and install packages. The catalog is generated on demand (on first attempt to use ”tusk install”) or when you expressly run ”tusk update”. The default catalog is downloaded from the Narwhal project. You can create your own catalog by making a ”$SEA/.tusk/sources.json” source catalog and consolidating it by running ”tusk update”.
Multiple Catalogs
You can create a catalog from multiple catalogs with the "includes" property in your ”sources.json”.
{"includes": [
"http://example.com/catalog.json",
"file:///usr/share/narwhal/catalog.json",
"../extra-sources.json"
]}
The catalogs can have transitive dependencies. They are prioritized from lowest to highest, so the last catalog will override the package descriptors of all the catalogs that come before it.
Package Sources
A package may also specify its own package sources, like Github projects or zip archives anywhere on the Web.
{
"includes": ["catalog.json"],
"sources": {
"my-project": {
"type": "github",
"user": "me",
"name": "my-github-project-name" // defaults to "my-project"
"ref": "1.0" // defaults to "master"
}
}
}
Catalog Generation
tusk udpate generates the consolidated catalog (”$SEA/.tusk/catalog.json”, from the catalog sources (”$SEA/.tusk/sources.json”). You can use Tusk to create catalogs for publication on the web, so your users can include them in their projects. It would work fine to post your raw sources. However, all of your users would then have to construct their catalogs with numerous HTTP requests to the original projects. To avoid that, or to create catalogs that use stable versions of each of those projects, Tusk can consolidate sources.
Tusk takes optional input and output catalogs. To consolidate ”sources.json” into ”catalog.json”, use the following command:
$ tusk update -i sources.json -o catalog.json
The input and output default to their corresponding files in (”$SEA/.tusk”) so you can provide either, neither, or both.
Tusk can also be asked to update specific package descriptors from their sources in a consolidated catalog.
$ tusk update narwhal
Consult ”tusk update --help” for further options.
Schemas
Catalogs and Sources
For example, ”sources.json” and ”catalog.json”
!a commentversiona schema number. if this is less than the minimum schema version supported by the package manager, the package manager must update its catalog, and will do so automaticallyincludesarray of URLs to catalogs to include, from lowest to highest priority, all lower priority than this one catalogsourcesobject mapping package names to package descriptor sources (described below)packagesobject mapping package names to package descriptors (described below)
Package Descriptors
For example, ”package.json”.
namethe name of the package. The package system will only load one package with a given name. The name defaults to the name of the parent directory.authorthe original author of the package. The author may be a String including an optional(URL in parentheses)and optional<email address in angle brackets>. Alternately, it may be an Object with any ofname,email, andurlattributes. The package reader normalizes authors to the latter Object form.maintainerthe package maintainer for the project as a String or Object just as the author attribute.contributorsmay be an Array of additional author Strings.urlthe URL of the project website.licensethe name of the license as a String, with an optional URL in parentheses, or an Object withnameandurlattributes.descriptiona String describing the package. Most package descriptions end with a period/full stop.keywordsan Array of String keywords to assist users searching for the package withtusk searchortusk apropos.liba path or array of paths to top-level module directories provided in this package. Defaults to["lib"].jarsfor Rhino engines, a path or array of paths to directories to add to the Java CLASSPATH (uses a Java URLClassLoader, so accepts.jarpaths and directory paths ending with/).packagesa path or array of paths to directories containing additional packages, defaults to["packages"].enginesa path or array of paths to directories containing engine-specific packages, defaults to["engines"]. These engine packages will be loaded if and in the prioritized order they appear in thesystem.enginesarray, and with higher priority that those in this package’s genericjspath so that they can override engine-specific modules.versiona version string, array, or object, normalized to an objectasyncboolean whether this package exclusively provides and consume asynchronous APIs.packageUrlthe URL of the archive of this package. This property does not need to be included in a package’s advertised package.json if the package manager can discern it from the catalog’s sources package descriptor reference.packageArchiveoptionally, the archival medium of the package, defaults to"zip", and no other media are yet supported.sourcethe source Object from which this package was generated, if any.
Package Descriptor Source
typeeither"github"or"inline"
Additional properties depend on the type and are described below.
Github Package Descriptor Source
type"github"usera Github user namenamean optional Github project name, defaults to the package namerefan optional Github ref: branch, tag, or commit hash; that defaults to"master"descriptoran optional package descriptor if the Github project does not contain one, or must be overridden. Providing adescriptorprevents ”tusk update” from attempting to download ”package.json” from the project.
Inline Package Descriptor Source
type"inline"descriptora package descriptor that must include apackageUrl.descriptorUrlthe URL of apackage.jsonpackage descriptor file, if no descriptor is expressly provided.