{"id":14977064,"url":"https://github.com/michaeljier/easy-alioss","last_synced_at":"2025-03-01T14:41:46.172Z","repository":{"id":100026651,"uuid":"305640974","full_name":"MIchaelJier/easy-alioss","owner":"MIchaelJier","description":"A plugin to upload assets to aliyun oss","archived":false,"fork":false,"pushed_at":"2023-10-17T01:58:51.000Z","size":1179,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-12T11:12:16.523Z","etag":null,"topics":["ali-oss","alioss","assets","oss","vite","vite-plugin","vite4","webpack","webpack-plugin","webpack5-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/search?q=%40easy-alioss","language":"TypeScript","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/MIchaelJier.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":"2020-10-20T08:29:58.000Z","updated_at":"2023-10-17T01:44:54.000Z","dependencies_parsed_at":"2024-09-11T12:43:04.546Z","dependency_job_id":null,"html_url":"https://github.com/MIchaelJier/easy-alioss","commit_stats":null,"previous_names":["michaeljier/webpack-yun-oss","michaeljier/easy-alioss"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MIchaelJier%2Feasy-alioss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MIchaelJier%2Feasy-alioss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MIchaelJier%2Feasy-alioss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MIchaelJier%2Feasy-alioss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MIchaelJier","download_url":"https://codeload.github.com/MIchaelJier/easy-alioss/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241381519,"owners_count":19953749,"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":["ali-oss","alioss","assets","oss","vite","vite-plugin","vite4","webpack","webpack-plugin","webpack5-plugin"],"created_at":"2024-09-24T13:54:59.508Z","updated_at":"2025-03-01T14:41:46.149Z","avatar_url":"https://github.com/MIchaelJier.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# easy-alioss  \n\n[![npm version](https://img.shields.io/npm/v/@easy-alioss/vite-plugin.svg?style=flat)]([https://www.npmjs.com/package/svga](https://www.npmjs.com/package/@easy-alioss/vite-plugin)) \n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactjs.org/docs/how-to-contribute.html#your-first-pull-request)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)]([https://github.com/NetEase/tango/blob/main/LICENSE](https://github.com/MIchaelJier/easy-alioss/blob/main/LICENSE))\n\nA plugin to upload assets to aliyun oss\n\n## 安装 \n```bash\n# webpack\nnpm i @easy-alioss/webpack-plugin --save\n# vite\nnpm i @easy-alioss/vite-plugin --save\n```\n## 参数\n\n# AliOSSConfig\n\n| name | type | optional | default | description |\n| - | - | - | - | - |\n| accessKeyId | `string` | `false` | `n/a` | 阿里云 accessKeyId |\n| accessKeySecret | `string` | `false` | `n/a` | 阿里云 accessKeySecret |\n| region | `string` | `false` | `n/a` | 阿里云 region |\n| bucket | `string` | `false` | `n/a` | 阿里云 bucket |\n| prefix | `string \\| undefined` | `true` | `''` | 自定义路径前缀，通常使用项目目录名，文件将存放在alioss的bucket/prefix目录下 |\n| exclude | `RegExp \\| RegExp[] \\| undefined` | `true` | `[/.*\\.html$/]` | 可传入正则，或正则组成的数组，来排除上传的文件 |\n| deleteAll | `boolean \\| undefined` | `true` | `n/a` | 是否删除bucket/prefix中所有文件。优先匹配format配置 |\n| local | `boolean \\| undefined` | `true` | `false` | 默认每次上传webpack构建流中文件，设为true可上传打包后webpack output指向目录里的文件 |\n| output | `string \\| undefined` | `true` | `''` | 读取本地目录的路径，如果local为true，output为空，默认为读取webpack输出目录 |\n| limit | `number \\| undefined` | `true` | `5` | 最多备份版本数量，会备份最近的版本，最小是3。配置了format才会生效 |\n| format | `string \\| undefined` | `true` | `getFormat('YYMMDD')` | 用时间戳来生成oss目录版本号，每次会保留最近的版本文件做零宕机发布，删除其他版本文件。可以通过插件自身提供的静态方法getFormat()获得，默认值为年月日 |\n\n## 使用\n\n* 实例传参\n```javascript\nconst WebpackAliOSSPlugin = require('@easy-alioss/webpack-plugin')\n\nnew WebpackAliOSSPlugin({\n  accessKeyId: '2****************9',\n  accessKeySecret: 'z**************=',\n  region: 'oss-cn-hangzhou',\n  bucket: 'xxx',\n  prefix: 'test',  \n})\n```\n* 配置文件\n```javascript\n\nconst WebpackAliOSSPlugin = require('@easy-alioss/webpack-plugin')\nconst format = WebpackAliOSSPlugin.getFormat('YYYYMMDD') // 默认为getFormat('YYMMDD')\nnew WebpackAliOSSPlugin({\n  format\n})\n\n// easy-alioss.config.json\n{\n  accessKeyId: '2****************9',\n  accessKeySecret: 'z**************=',\n  region: 'oss-cn-hangzhou',\n  bucket: 'xxx',\n  prefix: 'test',  \n}\n```\n\u003e 更多格式参考[cosmiconfig](https://github.com/cosmiconfig/cosmiconfig#readme)\n\u003e By default, Cosmiconfig will start where you tell it to start and search up the directory tree for the following:\n\u003e -  a package.json property\n\u003e - a JSON or YAML, extensionless \"rc file\"\n\u003e - an \"rc file\" with the extensions .json, .yaml, .yml, .js, .ts, .mjs, or .cjs\n\u003e - any of the above two inside a .config subdirectory\n\u003e - a .config.js, .config.ts, .config.mjs, or .config.cjs file\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeljier%2Feasy-alioss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaeljier%2Feasy-alioss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeljier%2Feasy-alioss/lists"}