The project has moved to monorepo. See https://github.com/pownjs/pown for more information.
Modules is a utility library for working with PownJS modules. This library provides the core functionalities for the PownJS command-line framework.
Install this module from the root of your project:
$ npm install @pown/modules --save
Once done, list all installed pown modules like this:
const pownModules = require('@pown/modules')
pownModules.list((err, modules) => {
if (err) {
console.error(err)
return
}
modules.forEach((module) => {
// do something with module.config, module.package or module.realpath
})
})
You can also use promises with async/await like this:
const pownModules = require('@pown/modules')
const modules = await pownModules.list()
modules.forEach((module) => {
// do something with module.config, module.package or module.realpath
})
A pown module is a regular NPM module which exports pown features and options via package.json or .pownrc.
Example: package.json
{
"pown": {
"main": "./main.js",
"command": "./mytool.js",
"commands": [
"./mytool2.js"
],
"transform": "./mytransform.js",
"transforms": [
"./mytransform2.js"
]
}
}
Example: .pownrc
{
"main": "./main.js",
"command": "./mytool.js",
"commands": [
"./mytool2.js"
],
"transform": "./mytransform.js",
"transforms": [
"./mytransform2.js"
]
}