{"id":13657477,"url":"https://github.com/1337programming/webpack-shell-plugin","last_synced_at":"2025-04-13T00:40:46.643Z","repository":{"id":44381160,"uuid":"53098048","full_name":"1337programming/webpack-shell-plugin","owner":"1337programming","description":"Run shell commands either before or after webpack builds","archived":false,"fork":false,"pushed_at":"2019-11-06T17:57:22.000Z","size":61,"stargazers_count":262,"open_issues_count":35,"forks_count":62,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-29T20:56:00.538Z","etag":null,"topics":["shell","shell-scripts","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1337programming.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-04T01:37:50.000Z","updated_at":"2024-05-28T13:52:55.000Z","dependencies_parsed_at":"2022-07-14T12:49:57.224Z","dependency_job_id":null,"html_url":"https://github.com/1337programming/webpack-shell-plugin","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1337programming%2Fwebpack-shell-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1337programming%2Fwebpack-shell-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1337programming%2Fwebpack-shell-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1337programming%2Fwebpack-shell-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1337programming","download_url":"https://codeload.github.com/1337programming/webpack-shell-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650414,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["shell","shell-scripts","webpack","webpack-plugin"],"created_at":"2024-08-02T05:00:43.542Z","updated_at":"2025-04-13T00:40:46.619Z","avatar_url":"https://github.com/1337programming.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/webpack-shell-plugin.svg)](https://badge.fury.io/js/webpack-shell-plugin)\n![](https://reposs.herokuapp.com/?path=1337programming/webpack-shell-plugin)\n[![npm](https://img.shields.io/npm/dm/webpack-shell-plugin.svg)]()\n# Webpack Shell Plugin\n\nThis plugin allows you to run any shell commands before or after webpack builds. This will work for both webpack and webpack-dev-server.\n\nGoes great with running cron jobs, reporting tools, or tests such as selenium, protractor, phantom, ect.\n\n## WARNING\n\nThis plugin is meant for running simple command line executions. It is not meant to be a task management tool.\n\n## Installation\n\n`npm install --save-dev webpack-shell-plugin`\n\n## Setup\nIn `webpack.config.js`:\n\n```js\nconst WebpackShellPlugin = require('webpack-shell-plugin');\n\nmodule.exports = {\n  ...\n  ...\n  plugins: [\n    new WebpackShellPlugin({onBuildStart:['echo \"Webpack Start\"'], onBuildEnd:['echo \"Webpack End\"']})\n  ],\n  ...\n}\n```\n\n## Example\n\nInsert into your webpack.config.js:\n\n```js\nconst WebpackShellPlugin = require('webpack-shell-plugin');\nconst path = require('path');\n\nvar plugins = [];\n\nplugins.push(new WebpackShellPlugin({\n  onBuildStart: ['echo \"Starting\"'],\n  onBuildEnd: ['python script.py \u0026\u0026 node script.js']\n}));\n\nvar config = {\n  entry: {\n    app: path.resolve(__dirname, 'src/app.js')\n  },\n  output: {\n    path: path.resolve(__dirname, 'dist'), // regular webpack\n    filename: 'bundle.js'\n  },\n  devServer: {\n    contentBase: path.resolve(__dirname, 'src') // dev server\n  },\n  plugins: plugins,\n  module: {\n    loaders: [\n      {test: /\\.js$/, loaders: 'babel'},\n      {test: /\\.scss$/, loader: 'style!css!scss?'},\n      {test: /\\.html$/, loader: 'html-loader'}\n    ]\n  }\n}\n\nmodule.exports = config;\n\n```\nOnce the build finishes, a child process is spawned firing both a python and node script.\n\n### API\n* `onBuildStart`: array of scripts to execute on the initial build. **Default: [ ]**\n* `onBuildEnd`: array of scripts to execute after files are emitted at the end of the compilation. **Default: [ ]**\n* `onBuildExit`: array of scripts to execute after webpack's process is complete. *Note: this event also fires in `webpack --watch` when webpack has finished updating the bundle.* **Default: [ ]**\n* `dev`: switch for development environments. This causes scripts to execute once. Useful for running HMR on webpack-dev-server or webpack watch mode. **Default: true**\n* `safe`: switches script execution process from spawn to exec. If running into problems with spawn, turn this setting on. **Default: false**\n* `verbose`: **DEPRECATED** enable for verbose output. **Default: false**\n\n### Developing\n\nIf opening a pull request, create an issue describing a fix or feature. Have your pull request point to the issue by writing your commits with the issue number in the message.\n\nMake sure you lint your code by running `npm run lint` and you can build the library by running `npm run build`.\n\nI appreciate any feed back as well, Thanks for helping!\n\n### Other Webpack Plugins\nAlso checkout our other webpack plugin [WebpackBrowserPlugin](https://github.com/1337programming/webpack-browser-plugin).\n\n### Contributions\nYair Tavor\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1337programming%2Fwebpack-shell-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1337programming%2Fwebpack-shell-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1337programming%2Fwebpack-shell-plugin/lists"}