Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/sam-parsons/snowpack-plugin-run
- Owner: sam-parsons
- License: mit
- Created: 2021-05-22T18:19:28.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-05-23T22:42:38.000Z (over 3 years ago)
- Last Synced: 2024-12-20T23:46:12.346Z (about 1 month ago)
- Topics: shell, snowpack, snowpack-plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/snowpack-plugin-run
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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)