A Plugin for fuse-box that gives you the ability to run any tasks (npm, tsc, etc.) after fuse-box bundled your code
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.vscode
src
.gitignore
.npmignore
LICENSE
README.md
package.json
tsconfig.json
tslint.json

README.md

fuse-box-process-plugin

npm license npm

A Plugin for fuse-box that gives you the ability to run any tasks (npm, tsc, etc.) after fuse-box bundled your code

Installation

npm install fuse-box-process-plugin --save-dev

API

ProcessPlugin({
    process: [{
            processKey: '', // Uniq key that represent this process
            processName: '', // Name of the process to execute
            processArgs: Array<string>, // Args to pass to the process
            verbose: true, // If the process needs to log to the console
            child : IProcessDetail // Any child process that needs to be executed once the parent as `exit`
        } : IProcessDetail
    ]
}),

How to use

To run npm tasks like npm run lint and npm run server

const ProcessPlugin = require('fuse-box-process-plugin').ProcessPlugin;

let fuse = new FuseBox({
    homeDir: "src/",
    sourcemaps: true,
    outFile: "./build/out.js",
    plugins: [
        ProcessPlugin({
            process: [{
                    processKey: 'npm run lint',
                    processName: 'npm',
                    processArgs: ['run', 'lint'],
                    verbose: true,
                },
                {
                    processKey: 'npm run server',
                    processName: 'npm',
                    processArgs: ['run', 'server'],
                    verbose: false,
                },
            ]
        }),
    ]
});

Typescript

I love Typescript, so this project also has typings !:)

import { ProcessPlugin } from 'fuse-box-process-plugin';

Microsoft Windows...

For Microsoft windows, you might need to do something like this to run commands :

const isWindows: boolean = /^win/.test(process.platform);

let fuse = new FuseBox({
    homeDir: "src/",
    sourcemaps: true,
    outFile: "./build/out.js",
    plugins: [
        ProcessPlugin({
            process: [{
                    processKey: 'npm run lint',
                    processName: isWindows ? 'npm.cmd' : 'npm',
                    processArgs: ['run', 'lint'],
                    verbose: true,
                },
                {
                    processKey: 'npm run server',
                    processName: isWindows ? 'npm.cmd' : 'npm',
                    processArgs: ['run', 'server'],
                    verbose: false,
                },
            ]
        }),
    ]
});