Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sam-parsons/snowpack-plugin-run

execute multiple shell commands after bundle generation
https://github.com/sam-parsons/snowpack-plugin-run

shell snowpack snowpack-plugin

Last synced: 4 days ago
JSON representation

execute multiple shell commands after bundle generation

Awesome Lists containing this project

README

        

[npm]: https://img.shields.io/npm/v/snowpack-plugin-run
[npm-url]: https://www.npmjs.com/package/snowpack-plugin-run
[size]: https://packagephobia.now.sh/badge?p=snowpack-plugin-run
[size-url]: https://packagephobia.now.sh/result?p=snowpack-plugin-run

[![npm][npm]][npm-url]
[![size][size]][size-url]
[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)

# snowpack-plugin-run

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

## Requirements

This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.0.0+) and Snowpack v2.0.0+.

## Install

Using npm:

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

## Usage

Create a `snowpack.config.js` [configuration file](https://www.snowpack.dev/reference/configuration) and execute a single shell command when the bundle is generated by setting the value of `cmd` to a single string:

```js
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:

```js
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)](./LICENSE.md)