nachos-packages
v1.2.0
Published
A package to manage all nachos packages
Downloads
3
Readme
packages
Manage all nachos packages
Have a problem? Come chat with us!
Installation
$ [sudo] npm install nachos-packages --save
Usage
Initialize
var packages = require('nachos-packages');
TYPES
Returns the available packages types
var types = packages.Packages.TYPES;
getFolderByType(type)
Get folder by specific type
packages.getFolderByType('dip')
.then(function (folder) {
// folder -> user/home/.nachos/packages/dips
});
getFolderByPackage(packageName)
Get folder by specific package
packages.getFolderByPackage('your-package')
.then(function (folder) {
// folder -> user/home/.nachos/packages/type
});
getPackage(packageName, [type])
Get specific package
By name
packages.getPackage('your-package')
.then(function (packageConfig) {
/** packageConfig:
{
path: 'path/to/your/package',
type: 'package-type',
config: { ... } // -> nachos.json of the package
}
*/
});
By name and type
packages.getPackage('your-package', 'dip')
.then(function (packageConfig) {
/** packageConfig:
{
path: 'path/to/your/package',
config: { ... } // -> nachos.json of the package
}
*/
});
getByType(type, [full])
Get all packages with specific type
packages.getByType('dip')
.then(function (packagesByType) {
/** packagesByType:
[
{
name: 'pkg1',
path: 'path/to/your/package'
},
...
]
*/
});
// With 'full' option
packages.getByType('dip', true)
.then(function (packagesByType) {
/** packagesByType:
[
{
name: 'pkg1',
path: 'path/to/your/package',
config: { ... } // -> nachos.json of the package
},
...
]
*/
});
getDip(dipName)
Get dip by name
packages.getDip('your-dip')
.then(function (dipConfig) {
/** dipConfig:
{
path: 'path/to/your/dip',
config: { ... } // -> nachos.json of the package
}
*/
});
getTaco(tacoName)
Get taco by its name
packages.getTaco('your-taco')
.then(function (tacoConfig) {
/** tacoConfig:
{
path: 'path/to/your/taco',
config: { ... } // -> nachos.json of the package
}
*/
});
getAll([full])
Get all packages of all types
packages.getAll()
.then(function (packages) {
/** packages
{
dip: [
{
name: 'pkg1',
path: 'path/to/your/package'
},
...
],
taco: [...]
}
*/
});
// With 'full' option
packages.getAll(true)
.then(function (packages) {
/** packages
{
dip: [
{
name: 'pkg1',
path: 'path/to/your/package',
config: { ... } // -> nachos.json of the package
},
...
],
taco: [...]
}
*/
});
Run Tests
$ npm test