pmnps
is a monorepo tool, it uses npm workspaces
to manage packages and platforms. This project is created to define plugin interfaces to pmnps
.
$ npm install pmnps-plugin --save-dev
In pmnps@2.0.0
, it will open refresh action
for plugins, so, we can add a plugin to it.
import {Project,Tools} from 'pmnps-plugin';
export default (proj:Project,tool:Tools)=>{
return {
// declare which action you want add plugin to.
refresh: {
// run before `refresh action`
async before(){
const {
// package.json object in root
root:rootPackageJson,
// package.json objects in every package, it is an array.
packages:packagePackageJsons,
// package.json objects in every platforms, it is an array.
platforms:platformPackageJsons
} = await proj.packageJsons();
// do things......
tool.message.warn('Something is in danger');
tool.message.info('Every thing is ok');
return true; // return false will stop the action
},
// run after `refresh action`
async after(){
const {
root:rootPackageJson,
packages:packagePackageJsons,
platforms:platformPackageJsons
} = await proj.packageJsons();
// do things......
tool.message.warn('Something is in danger');
tool.message.info('Every thing is ok');
return true; // return false will stop the action
}
}
}
}
Config the .pmnpsrc.json
file.
{
"workspace":"workspace",
"git":true,
"lock":true,
"plugins":[
"my-pmnps-plugin"
]
}
This document is not a complete one, we will complete it at pmnps@2.1.0
.