Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mipengine/mip-extension-optimizer
MIP Extension Optimizer
https://github.com/mipengine/mip-extension-optimizer
Last synced: about 1 month ago
JSON representation
MIP Extension Optimizer
- Host: GitHub
- URL: https://github.com/mipengine/mip-extension-optimizer
- Owner: mipengine
- Created: 2016-09-29T15:45:34.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-14T06:35:30.000Z (about 6 years ago)
- Last Synced: 2024-10-28T22:42:43.802Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 39.1 KB
- Stars: 3
- Watchers: 7
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
mip-extension-optimizer
===========MIP Extension Optimizer
## CLI
### install
Install with `npm i -g`
```
$ npm i -g mip-extension-optimizer
```### use
Call `mip-extension-optimise` command to optimise MIP extensions.
#### format
```
mip-extension-optimise [-o output-path] [extension, extension ...]
```#### example
```
$ mip-extension-optimise mip-extensions/src -o mip-extensions-dist
$ mip-extension-optimise mip-extensions/src -o mip-extensions-dist mip-fixed
```## API
This package provides some APIs for MIP extension infomation.
### import
```
$ npm i mip-extension-optimizer --save
```### load all extensions from directory
```js
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)
});
}
);
```### load single extension
```js
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)
```### use build result in program
```js
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();
});
```