{"id":21344474,"url":"https://github.com/s00d/webpack-shell-plugin-next","last_synced_at":"2025-05-16T09:00:24.321Z","repository":{"id":54001229,"uuid":"125829379","full_name":"s00d/webpack-shell-plugin-next","owner":"s00d","description":"Run shell commands either before or after webpack 4 and 5 builds","archived":false,"fork":false,"pushed_at":"2025-01-07T19:50:26.000Z","size":2583,"stargazers_count":96,"open_issues_count":3,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-11T00:47:02.151Z","etag":null,"topics":[],"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/s00d.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-19T08:58:59.000Z","updated_at":"2025-05-10T02:19:48.000Z","dependencies_parsed_at":"2024-06-18T13:51:04.533Z","dependency_job_id":"a9243f4f-95ef-4d3d-9004-6341bd57f1a7","html_url":"https://github.com/s00d/webpack-shell-plugin-next","commit_stats":{"total_commits":56,"total_committers":6,"mean_commits":9.333333333333334,"dds":0.2857142857142857,"last_synced_commit":"68cf443ba8534744309fd91bff60ae29eff0c80d"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s00d%2Fwebpack-shell-plugin-next","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s00d%2Fwebpack-shell-plugin-next/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s00d%2Fwebpack-shell-plugin-next/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s00d%2Fwebpack-shell-plugin-next/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s00d","download_url":"https://codeload.github.com/s00d/webpack-shell-plugin-next/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254501548,"owners_count":22081526,"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":[],"created_at":"2024-11-22T01:19:12.412Z","updated_at":"2025-05-16T09:00:24.206Z","avatar_url":"https://github.com/s00d.png","language":"JavaScript","funding_links":["https://www.paypal.me/s00d"],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/webpack-shell-plugin-next.svg)](https://badge.fury.io/js/webpack-shell-plugin-next)\n[![npm downloads](https://img.shields.io/npm/dw/webpack-shell-plugin-next)](https://badge.fury.io/js/webpack-shell-plugin-next)\n[![NPM license](https://img.shields.io/npm/l/webpack-shell-plugin-next)](https://github.com/s00d/webpack-shell-plugin-next/blob/master/LICENSE)\n[![npm type definitions](https://img.shields.io/npm/types/webpack-shell-plugin-next)](https://github.com/s00d/webpack-shell-plugin-next)\n![Build Status](https://github.com/s00d/webpack-shell-plugin-next/workflows/Node.js%20CI/badge.svg?branch=master)\n[![donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.me/s00d)\n[![GitHub Repo stars](https://img.shields.io/github/stars/s00d/webpack-shell-plugin-next?style=social)](https://github.com/s00d/webpack-shell-plugin-next)\n# Webpack Shell Plugin Next\n\nfix webpack deprecated method. add typescript and other\n\nThis plugin allows you to run any shell commands before or after webpack 5 builds. This will work for both webpack 5.\n\nGoes great with running cron jobs, reporting tools, or tests such as selenium, protractor, phantom, ect.\n\n## Webpack compatibility\n\n| Webpack | webpack-shell-plugin-next |\n|:--------|:--------------------------|\n| *-4.x   | 1.*                       |\n| 5.x     | 2.*                       |\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-next`\n\n## Setup\nIn `webpack.config.js`:\n\n```js\nconst WebpackShellPluginNext = require('webpack-shell-plugin-next');\n...\nmodule.exports = {\n  //...\n  plugins: [\n    new WebpackShellPluginNext({\n      onBuildStart:{\n        scripts: ['echo \"Webpack Start\"'],\n        blocking: true,\n        parallel: false\n      }, \n      onBuildEnd:{\n        scripts: ['echo \"Webpack End\"'],\n        blocking: false,\n        parallel: true\n      }\n    })\n  ]\n  //...\n}\n```\n**More example in webpack.config.ts**\n\n### API\n* `onBeforeBuild`: array of scripts to execute before every build. \n* `onBuildError`: array of scripts to execute when there is an error during compilation.\n* `onBuildStart`: configuration object for scripts that execute before a compilation. \n* `onBuildEnd`: configuration object for scripts that execute after files are emitted at the end of the compilation. \n* `onBuildExit`: configuration object for scripts that execute after webpack's process is complete. *Note: this event also fires in `webpack --watch` when webpack has finished updating the bundle.*\n* `onWatchRun`: configuration object for scripts that execute when webpack's run watch\n* `onDoneWatch`: configuration object for scripts that execute after files are emitted at the end of the compilation with watch. \n* `onBeforeNormalRun`: configuration object for scripts that execute on normal run without --watch option\n* `onAfterDone`: configuration object for scripts that execute after done. \n* `onFailedBuild`: configuration object for scripts that execute after error. \n* `onBeforeCompile`: configuration object for scripts that execute before complite. \n\n***Default for all: ```{scripts: [],blocking: false,parallel: false}```***\n\n* `blocking (onBeforeBuild, onBuildStart, onBuildEnd, onBuildExit, onBuildExit, onWatchRun)`: block webpack until scripts finish execution.\n* `parallel (onBeforeBuild, onBuildStart, onBuildEnd, onBuildExit, onBuildExit, onWatchRun)`: execute scripts in parallel, otherwise execute scripts in the order in which they are specified in the scripts array.\n\n**Note:** below combination is not supported.\n ```js\n{\n  blocking: true\n  parallel: true\n} \n ```\n \n***Other global params***\n* `env`: Object with environment variables that will be applied to the executables **Default: { }**\n* `logging`:  show output for internal messages.  **Default: true**\n* `swallowError`: ignore script errors (useful in watch mode) **Default: false**\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\n\n```js\nnew WebpackShellPlugin({\n      onBeforeNormalRun: {\n        // ...\n      },\n      dev: false,\n      safe: false,\n      logging: true\n    })\n  ]\n}\n```\n\n\n### TypeScript\n\nThis project is written in TypeScript, and type declarations are included. You can take advantage of this if your project's webpack configuration is also using TypeScript (e.g. webpack.config.ts and webpack.config.js).\n\n### Function in scripts \n\nhow to use functions in the queue?\n\n#### Example:\n```js\n{\n  {\n    scripts: [\n      // sync\n      () =\u003e {\n        console.log('run tTimeout 1');\n        setTimeout(() =\u003e console.log('end Timeout 1'), 1000);\n      },\n      // async\n      () =\u003e new Promise((resolve, reject) =\u003e {\n        console.log('run async tTimeout');\n        setTimeout(() =\u003e {\n          console.log('end async tTimeout');\n          resolve('ok');\n        }, 1000);\n      }),\n    ],\n      blocking: true\n  }\n}\n```\n\n```js\n// use exec\nimport * as os from 'os'\n// ..\n{\n    safe: os.platform() === 'win32', // by default spawn is used everywhere. If you have problems try using safe: true\n    scripts: [\n      //...\n    ]\n    //  ...\n}\n```\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs00d%2Fwebpack-shell-plugin-next","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs00d%2Fwebpack-shell-plugin-next","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs00d%2Fwebpack-shell-plugin-next/lists"}