FIS3 HTTP Push Deploy Plugin

raw JSON →
2.0.8 verified Thu Apr 23 auth: no javascript maintenance

The `fis3-deploy-http-push` package serves as the default deployment plugin for the FIS3 build system, offering functionalities for both local and remote file synchronization via HTTP POST requests. Currently at version 2.0.8, it enables developers to configure custom deployment targets and attach specific data parameters for different file types directly within their FIS3 build configurations. A key characteristic is its deep integration with the FIS3 framework, allowing for sophisticated, programmatic control over the deployment process, including the ability to incorporate interactive elements like token prompts for authentication during a build. However, it is critical to note the explicit and severe security warnings associated with the provided `receiver.php` example script, which is inherently insecure and **must not be deployed in production environments**. This limitation means the plugin is primarily suitable for internal development, staging, or highly trusted network setups. The package's release cadence is not independent but rather follows the lifecycle and maintenance schedule of the broader FIS3 project.

error Security vulnerability when using receiver.php in production
cause The provided example `receiver.php` script lacks crucial security measures and is intended only for development or testing.
fix
Develop a custom, secure receiver application with proper authentication, authorization, and input sanitization, or choose an alternative, secure deployment method for production.
error Files are not deploying, or receiver responds with 404/500
cause The `receiver` URL configured in `fis.plugin('http-push', { receiver: '...' })` is incorrect, the remote server is not running, or the receiver script has errors.
fix
Verify the receiver URL is correct and accessible. Ensure the remote server is online and the receiver script (your custom one, not the insecure example) is correctly deployed and functioning.
error Deployed files land in wrong directories on the remote server
cause The `to` parameter in the plugin configuration is incorrectly set, or the remote receiver is not processing the `to` parameter as expected.
fix
Double-check the to option in your fis.plugin('http-push', { to: '...' }) configuration. Also, verify that your custom receiver script correctly reads and utilizes the to parameter to determine the target path on the server.
breaking The `receiver.php` script provided as an example in the README has severe security vulnerabilities and is explicitly marked as unsafe for production. Deploying it in a live environment will expose your server to significant risks.
fix DO NOT use the example `receiver.php` script in production. Implement a custom, secure backend receiver that includes robust authentication, authorization, and input validation, or utilize a different, secure deployment mechanism for production assets.
gotcha This plugin is tightly coupled with the FIS3 build system. It is not a standalone deployment tool and requires a functioning FIS3 project setup to operate.
fix Ensure you are using `fis3` as your project's build tool. If you require a standalone HTTP deployment solution, consider alternative packages not specific to FIS3.
gotcha The remote HTTP receiver endpoint (`receiver` option) must be a live server capable of accepting POST requests and handling file uploads. The plugin does not provide this server component itself (beyond the insecure example `receiver.php`).
fix Before deploying, ensure your target server is running and configured with a custom, secure receiver script or API endpoint that can process the uploaded files sent by this plugin.
npm install fis3-deploy-http-push
yarn add fis3-deploy-http-push
pnpm add fis3-deploy-http-push

Demonstrates how to configure the `http-push` plugin within a FIS3 project to deploy JavaScript files to a remote HTTP receiver endpoint with custom parameters.

const fis = require('fis3');

fis.match('*.js', {
    deploy: fis.plugin('http-push', {
        // If configured, fis will POST files one by one to the receiver endpoint.
        receiver: 'http://www.example.com:8080/receiver.php',
        // This parameter will be sent along with the POST request.
        to: '/home/fis/www',
        // Additional parameters, backend accesses via $_POST['xx'].
        // If 'data' contains a 'to' key, the above 'to' parameter will override it.
        data: {
            token : 'abcdefghijk',
            user : 'maxming',
            uid : 1
        }
    })
});

// Example of running the build (assuming fis3 CLI is installed)
// fis.project.vcs.query = () => '1.0.0'; // Mock version for a complete example
// fis.match('**', { release: '/$0' }); // Release all files
// fis.log.level = fis.log.L_INFO;
// fis.cli.run(process.argv); // This would trigger a build if run in a FIS3 project context