sam-parsons / snowpack-plugin-run

execute multiple shell commands after bundle generation

Home Page:https://www.npmjs.com/package/snowpack-plugin-run

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm size libera manifesto

snowpack-plugin-run

Snowpack plugin that executes shell commands sequentially when the bundle is generated.

Requirements

This plugin requires an LTS Node version (v8.0.0+) and Snowpack v2.0.0+.

Install

Using npm:

npm install --save-dev snowpack-plugin-run

Usage

Create a snowpack.config.js configuration file and execute a single shell command when the bundle is generated by setting the value of cmd to a single string:

const dsv = require('snowpack-plugin-run');

module.exports = {
  mount: {
    public: { url: '/', static: true },
    src: { url: '/dist' },
  },
  plugins: [
    [
      'snowpack-plugin-run',
      {
        cmd: 'start chrome --new-window http://localhost/',
      },
    ],
  ],
};

Execute multiple shell commands sequential when the bundle is generated by setting the value of cmd to an array of strings:

const dsv = require('snowpack-plugin-run');
const path = require('path');

module.exports = {
  mount: { ... },
  plugins: [
    [
      'snowpack-plugin-run',
      {
        cmd: [
            // Copy index.html from src to public if index.html is not modified
            'robocopy src public index.html',
            // Then open the browser
            'start firefox -new-window "' + path.join(process.cwd(), 'public', 'index.html') + '"'
        ],
      },
    ],
  ],
};

Meta

LICENSE (MIT)

About

execute multiple shell commands after bundle generation

https://www.npmjs.com/package/snowpack-plugin-run

License:MIT License


Languages

Language:JavaScript 100.0%