MIP Extension Optimizer
Install with npm i -g
$ npm i -g mip-extension-optimizer
Call mip-extension-optimise
command to optimise MIP extensions.
mip-extension-optimise <extensions-path> [-o output-path] [extension, extension ...]
$ mip-extension-optimise mip-extensions/src -o mip-extensions-dist
$ mip-extension-optimise mip-extensions/src -o mip-extensions-dist mip-fixed
This package provides some APIs for MIP extension infomation.
$ npm i mip-extension-optimizer --save
var extOptimizer = require('mip-extension-optimizer');
extOptimizer.load('/your/extensions/root/directory').then(
function (extensions) {
extensions.forEach(function (extension) {
// extension.info has some data from package.json and README.md, such as:
// ================
// extension.info.name (parse from package.json)
// extension.info.version (parse from package.json)
// extension.info.props (parse from README.md)
// extension.info.examples (parse from README.md)
// extension.info.deps (parse from README.md)
});
}
);
var extOptimizer = require('mip-extension-optimizer');
var extension = new extOptimizer.Extension('/your/extension/directory');
// extension.info has some data from package.json and README.md, such as:
// ================
// extension.info.name (parse from package.json)
// extension.info.version (parse from package.json)
// extension.info.props (parse from README.md)
// extension.info.examples (parse from README.md)
// extension.info.deps (parse from README.md)
var extOptimizer = require('mip-extension-optimizer');
var extension = new extOptimizer.Extension('/your/extension/directory');
var builder = extension.createBuilder();
builder.process().then(function () {
// get all files of extension, and traverse
var files = getFiles();
files.forEach(function (file) {
// ...
});
// get file by path (relative)
var file = builder.getFile('extension-name/main.js');
// get file content
file.getData();
});