Package Descriptor
July 31, 2013 ยท View on GitHub
A sm compatible package must have a package descriptor stored in a package.json file at the root of the package.
The following declarations are recognized:
package.json ~ {
"uid": "<string>",
"name": "<string>",
"version": "<semver>",
"pm": "<name>",
"help": {
"web": "<uri>",
"cli": "./<path>"
},
"dependencies": {
"<depName>": "<pointer>"
},
"devDependencied": {},
"mappings": {},
"devMappings": {},
"optionalMappings": {},
"bin": {
"<binAlias>": "<path>"
},
"scripts": {
"start-workspace": "<command>",
"stop-workspace": "<command>",
"install": "<command>"
}
}
The above is loosely based on the following specifications:
Once a package has a package descriptor it may be used via the sm Command Line Tool or
the sm NodeJS Module.
See Package Environment for what can be achieved with the package descriptor.
See Platforms and Engines for <platform*> and <engine*> defaults.
Details on properties
uid
- A url that points to the repository uri for the package excluding any branch, version or revision identification.
dependencies
- Where
<depName> === <pkgAlias>and is the name of a package from the<platformRegistry>and<pointer>a npm version range. - Where packages are installed at
./<platformDepFolder>/<depName>. - Where
<pointer>is one of npm version range.
mappings
- Use the official stable (or most stable) distribution channel.
- Where
<pointer>is one of:[<pm>, <uri>, <extra>]where<pm>determines valid values for<uri>and<extra>may override package descriptor.<uri>
bin
- Where
<path>is linked to./.sm/bin/<depAlias>-<binAlias>
scripts
- Where
<command>may be formatted according toSM.for("github.com/sourcemint/sm/").require("helpers").makeNodeCommanFromString("<command>"). - For
*-workspacescripts see Package Environment. - Where
installis called after all dependencies are resolved and is intended to compile the package.
help
Used to display help information for a package when user calls sm help.
help.cliis optional.help.webis optional.help: "./<path>"will be converted tohelp: { cli: "./<path>" }.help: "<uri>"will be converted tohelp: { web: "<uri>" }.help.climust point to JS module within package. Module must exportmain(API)whereAPI.TERM.stdoutmay be used to write to console.
Notes
$__DIRNAMEis replaced with the absolute realpath to the directory representing the root of the package.