{"id":22769667,"url":"https://github.com/planjs/webpack-deploy-plugin","last_synced_at":"2025-04-15T03:14:15.749Z","repository":{"id":42366903,"uuid":"469379171","full_name":"planjs/webpack-deploy-plugin","owner":"planjs","description":"The webpack plugin handles various uploads of front-end files","archived":false,"fork":false,"pushed_at":"2025-03-02T14:41:50.000Z","size":1151,"stargazers_count":2,"open_issues_count":4,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T15:01:42.568Z","etag":null,"topics":["deploy","oss","rsync","webpack-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@planjs/webpack-deploy-plugin","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/planjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2022-03-13T13:26:39.000Z","updated_at":"2022-04-15T03:12:44.000Z","dependencies_parsed_at":"2024-10-03T21:31:38.096Z","dependency_job_id":"bdbecc37-9e9f-4223-8fa0-cd881497e618","html_url":"https://github.com/planjs/webpack-deploy-plugin","commit_stats":{"total_commits":70,"total_committers":2,"mean_commits":35.0,"dds":0.05714285714285716,"last_synced_commit":"7eccf62aca5b336415b548ffbbf8fbeeab9cb931"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planjs%2Fwebpack-deploy-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planjs%2Fwebpack-deploy-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planjs%2Fwebpack-deploy-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planjs%2Fwebpack-deploy-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/planjs","download_url":"https://codeload.github.com/planjs/webpack-deploy-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248691771,"owners_count":21146438,"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":["deploy","oss","rsync","webpack-plugin"],"created_at":"2024-12-11T15:13:25.650Z","updated_at":"2025-04-15T03:14:15.713Z","avatar_url":"https://github.com/planjs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack-deploy-plugin\n\n![npm](https://img.shields.io/npm/v/@planjs/webpack-deploy-plugin?label=latest)\n[![test](https://github.com/planjs/webpack-deploy-plugin/actions/workflows/test.yml/badge.svg)](https://github.com/planjs/webpack-deploy-plugin/actions/workflows/test.yml)\n\n\u003e The plugin currently only supports `rsync` and `oss-upload-tool`. If it is rsync, you need to confirm whether the environment supports rsync.\n\n## Install\n\nUsing npm:\n\n```console\nnpm install @planjs/webpack-deploy-plugin --save-dev\n```\n\nUsing yarn:\n\n```console\nyarn add @planjs/webpack-deploy-plugin -D\n```\n\n## Usage\n\n`webpack.Stats` All output content will be uploaded to the server, or oss.\n**webpack.config.js**\n```js\nconst WebpackDeployPlugin = require('@planjs/webpack-deploy-plugin')\n\nmodule.exports = {\n    plugins: [\n      new WebpackDeployPlugin({\n        targets: {\n          oss: {\n            type: 'oss',\n            // oss deploy folder\n            dest: '/app/test1/',\n            patterns: ['**', '!**.js.map'],\n            OSSUploadOptions: {\n              type: 'COS',\n              COSOptions: {\n                SecretId: 'xxx',\n                SecretKey: 'xxx'\n              },\n              uploadParams: {\n                Bucket: 'xxx',\n                Region: 'xxx'\n              }\n            }\n          },\n          rsync: {\n            type: 'rsync',\n            patterns: ['**', '!**.js.map'],\n            dest: 'root@xx.xx.xx.xx:/www/deploy folder'\n          }\n        },\n        // The key of the `targets` used\n        env: 'oss'\n      })\n    ]\n};\n```\n\n## Options\n\n### `targets`\nUpload configuration collection.   \nType: `Record\u003cany, TargetItem\u003e | TargetItem`\n\n### `env`\nIf there are multiple upload configurations, it will be switched according to this as the key.   \nType: `string`\n\n## TargetItem\n\n### `type`\nType: `rsync | oss`   \nHow to upload files.\n\n### `dest`\nUpload to server folder.\n\u003e `type oss` folder default `''`   \n\u003e `type rsync` server connection string `root@xx.xx.xx.xx:/www/deploy folder`\n\nType: `string`\n\n### `patterns`\nType: `string | string[]` [multimatch](https://www.npmjs.com/package/multimatch)   \nPaths based on `compilation.assets` or `output` folder matching will be uploaded.\n\n### `isUploadOutputDir`\nType: `boolean`  \nDefault: `false`\nBy default, the file of `compilation.assets` is used, and when it is turned on, all the output folders will be uploaded.\n\n### `rsyncOptions`\nRsync args.   \nType: `{ args: string[][] }`   \n\u003e eg: `['bwlimit', 10]` [rsync](https://linux.die.net/man/1/rsync)   \n\n### `OSSUploadOptions`\nType: `object` \n\u003e Detailed reference [oss-upload-tool](https://github.com/planjs/stan/tree/master/packages/oss-upload-tool)   \n\u003e It also supports related environment variable configuration.\n\n### `maxAttempts`\nType: `number`      \nMaximum number of failed retries.   \nOnly valid for `oss-upload-tool`, `rsync` does not need to retry.   \n\n### `timeout`\nType: `number`      \nExecution timeout.   \nIf it is `rsync`, it is the timeout period for executing the command. If it is `oss-upload-tool`, it is the single file upload timeout period.  \n\n### isUploadOutputDir\nType: `boolean`   \nDefault: false only `compilation.assets` files   \nWhether to upload the output directory completely.\n\n### `onUploadStart`\nType: `(stats: Stats, shelljs) =\u003e void | Promise\u003cvoid\u003e`   \nBefore upload event.\n\n### `onUploadFinish`\nType: `(stats: Stats, shelljs) =\u003e void | Promise\u003cvoid\u003e`   \nUpload complete event.\n\n### `execUploadStartScripts`\nType: `string[][] | string[]`   \nbefore Upload start exec script.\n\u003e Detailed reference [execa](https://github.com/sindresorhus/execa)\n\n### `execUploadFinishScripts`\nType: `string[][] | string[]`   \nbefore Upload finish exec script.\n\u003e Detailed reference [execa](https://github.com/sindresorhus/execa)\n\n## FQA\n### Window Rsync error: `The command line is too long`\nBy default, window will use 8191 as the longest length, leave 100 for other parameters, and if the remaining length is too long, it will become multiple rsync commands.   \nIf it still fails, it may be an environment problem, change the cutting rules through the variable `MAX_COMMAND_LINE_LIMIT`.\n\n### Not all output directory contents are copied\nBy default, only the files on `compilation.assets` after webpack compilation will be copied. If you add files by other means, you can set isUploadOutputDir, \nand the files in the entire output directory will be uploaded, and you can specify file upload through `patterns`.\n\n## License\n\nMIT © [fupengl](https://github.com/fupengl)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanjs%2Fwebpack-deploy-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplanjs%2Fwebpack-deploy-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanjs%2Fwebpack-deploy-plugin/lists"}