fuse-box-process-plugin
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

fuse-box-process-plugin

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,
                },
            ]
        }),
    ]
});

Readme

Keywords

Package Sidebar

Install

npm i fuse-box-process-plugin

Weekly Downloads

43

Version

2.0.4

License

MIT

Last publish

Collaborators

  • rpdeshaies