qilin-manager is a simple and minimal package manager which allows you to install plugins and themes for Qilin. Packages are downloaded and prepared from GitHub.
$ npm install qilin-manager
import QilinManager from "qilin-manager";
const qpm = new QilinManager();
qpm.install(package: string, namespace?: string): Promise
Asynchronously installs a specified package from GitHub. Once downloaded, the package is extracted in dest
directory and properly prepared: its dependencies are downloaded by NPM and build scripts are launched.
Example:
Promise.all([
qpm.install("userA/repo"),
qpm.install("userB/repo", "namespaceB"),
qpm.install("userC/repo", "namespaceC")
]).then(() => {
console.log("Done!");
});
qpm.list(namespace?: string): Promise
Asynchronously returns a list of installed packages in dest
directory under a given namespace. The returned list is an object whose keys correspond to packages names and values are objects containing:
namespace
: plugin namespace;directory
: plugin parent directory;version
: same as inpackage.json
;package
: full path topackage.json
;
Example:
const all = await qpm.list();
const themes = await qpm.list("themes");
const plugins = await qpm.list("plugins");
Example output:
{
"packageA": {
"namespace": "namespaceA",
"directory": "packageA-master",
"version": "x.x.x",
"package": "[…]/namespaceA/packageA-master/package.json"
},
"packageB": {
"namespace": "namespaceB",
"directory": "packageB-master",
"version": "x.x.x",
"package": "[…]/namespaceB/packageB-master/package.json"
}
}
qpm.update(namespace?: string): Promise
Asynchronously checks if locally installed packages under a certain namespace are up-to-date. If no, they are downloaded again.
Example:
qpm.update().then(/* … */);
qpm.update("themes").then(/* … */);
qpm.update("plugins").then(/* … */);
qpm.load(package: string, namespace?: string): Promise
Asynchronously loads then executes a script in a virtual machine (V8 sandbox) and returns it's module.exports
back to the client. All the dependencies are resolved automatically.
Example:
const MyPlugin = await qpm.load("user/repo", "plugins");
const instance = new MyPlugin(…);
qpm.search(organization: string, filter?: string): Promise
Asynchronously searches a GitHub organization for repositories matching a specified filter.
Example:
const plugins = await qpm.search("organization", "project-plugin-");
const themes = await qpm.search("organization", "project-theme-");
Example output:
Refer to GitHub API.
Note: packages are built automatically once installed using
qpm.install
.
Installs dependencies for a given package and executes several NPM scripts in order to build the plugin. Scripts are executes in the order below:
preinstall
;install
;postinstall
;prepare
;
Example:
qpm.build("full/path/to/package_A").then(/* … */);
qpm.build("full/path/to/package_B").then(/* … */);
You can configure qilin-manager
using environment variables.
Variable | Description | Default |
---|---|---|
DEBUG=qilin:* |
Outputs debug informations in terminal | undefined |
QPM_HOME |
Destination path for downloaded packages | HOME/.qpm/ |
QPM_PROXY |
Custom proxy settings | undefined |