diff --git a/README-zh.md b/README-zh.md
index 3222e26..db46542 100644
--- a/README-zh.md
+++ b/README-zh.md
@@ -7,7 +7,8 @@
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/FEMessage/upload-to-ali/pulls)
[![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/)
-对接阿里云 OSS,可通过环境变量配置上传信息,可自定义域名,支持多选、限制文件大小、删除、粘贴上传功能,拖拽上传功能,让上传功能更加简单
+可通过环境变量配置上传信息,可自定义域名,支持多选、限制文件大小、删除、粘贴上传功能,拖拽上传功能,让上传功能更加简单。
+> 虽然最初的设计是上传至阿里云,但现在已可通过设置环境变量 `UPLOAD_ACTION` 把数据传送至自定义的后端接口,因此,理论上可以上传至任何云!考虑到有许多项目在用,就暂时不改包名了。
![](https://i.loli.net/2019/11/15/UZ2P7wR83GiDXky.gif)
@@ -31,7 +32,7 @@
- 可截图粘贴上传
- 可拖拽上传
- 可预览图片
-- 支持 v-model
+- 支持 v-model
可以只设置 `action` props, 指向上传地址,组件内部默认实现了一套 post 方法,向上传地址传递数据
@@ -42,7 +43,7 @@
## Links
- [docs](https://FEMessage.github.io/upload-to-ali/)
-- [ali oss guide](docs/ali-oss-guide.md)
+- [ali oss guide](docs/guide-ali-oss.md)
[⬆ Back to Top](#table-of-contents)
diff --git a/README.md b/README.md
index bc4fb59..c2f839c 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/FEMessage/upload-to-ali/pulls)
[![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/)
-This component can upload file to Aliyun-OSS easily.
+In the beginning, this component is designed to upload file to Aliyun-OSS easily,but now it can upload to any oss as you wish.
You can configure OSS information through environmental variables, customize domain, support multi-selection, limit file size, delete, paste to upload, drag and drop to upload, make files upload simpler.
@@ -46,7 +46,7 @@ You can set `request` props to customize own upload function.
## Links
- [docs](https://FEMessage.github.io/upload-to-ali/)
-- [ali oss guide](docs/ali-oss-guide.md)
+- [ali oss guide](docs/guide-ali-oss.md)
[⬆ Back to Top](#table-of-contents)
@@ -130,6 +130,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
diff --git a/docs/faq.md b/docs/faq.md
new file mode 100644
index 0000000..e72c8cb
--- /dev/null
+++ b/docs/faq.md
@@ -0,0 +1,21 @@
+## 在 TypeScript 中指定组件的类型
+
+```html
+
+
+
+
+```
diff --git a/netlify.sh b/netlify.sh
new file mode 100755
index 0000000..78dcdb3
--- /dev/null
+++ b/netlify.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+echo "is netlify: $NETLIFY"
+echo "in branch: $BRANCH"
+echo "head: $HEAD"
+
+if [ "$NETLIFY" != "true" ]
+then
+ echo "this script only runs in netlify, bye"
+ exit 1
+fi
+
+if [ "$BRANCH" != "dev" ] && [ "$HEAD" != "dev" ]
+then
+ yarn doc
+else
+ echo "this script only runs in targeting dev's PR deploy preview, bye"
+fi
diff --git a/notify.sh b/notify.sh
index 3498724..5246785 100755
--- a/notify.sh
+++ b/notify.sh
@@ -1,16 +1,32 @@
#!/bin/sh
+# https://stackoverflow.com/questions/13872048/bash-script-what-does-bin-bash-mean
+echo "1/5: checking TRAVIS_TEST_RESULT"
if [ "$TRAVIS_TEST_RESULT" != "0" ]
then
echo "build not success, bye"
exit 1
fi
-git remote add github https://$GITHUB_TOKEN@github.com/FEMessage/upload-to-ali.git > /dev/null 2>&1
+ORG_NAME=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f 1)
+REPO_NAME=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f 2)
+
+echo "2/5: pushing commit and tag to github"
+# 该命令很可能报错,但不影响实际进行,因而不能简单地在脚本开头 set -e
+git remote add github https://$GITHUB_TOKEN@github.com/$TRAVIS_REPO_SLUG.git > /dev/null 2>&1
git push github HEAD:master --follow-tags
+echo "3/5: generating github release notes"
GREN_GITHUB_TOKEN=$GITHUB_TOKEN yarn release
-url=https://api.github.com/repos/FEMessage/upload-to-ali/releases/latest
+# 避免发送错误信息
+if [ $? -ne 0 ]
+then
+ echo "gren fails, bye"
+ exit 1
+fi
+
+echo "4/5: downloading github release info"
+url=https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/latest
resp_tmp_file=resp.tmp
curl -H "Authorization: token $GITHUB_TOKEN" $url > $resp_tmp_file
@@ -19,8 +35,11 @@ html_url=$(sed -n 5p $resp_tmp_file | sed 's/\"html_url\"://g' | awk -F '"' '{pr
body=$(grep body < $resp_tmp_file | sed 's/\"body\"://g;s/\"//g')
version=$(echo $html_url | awk -F '/' '{print $NF}')
-msg='{"msgtype": "markdown", "markdown": {"title": "upload-to-ali更新", "text": "@所有人\n# [upload-to-ali('$version')]('$html_url')\n'$body'"}}'
+echo "5/5: notifying with dingtalk bot"
+msg='{"msgtype": "markdown", "markdown": {"title": "'$REPO_NAME'更新", "text": "@所有人\n# ['$REPO_NAME'('$version')]('$html_url')\n'$body'"}}'
curl -X POST https://oapi.dingtalk.com/robot/send\?access_token\=$DINGTALK_ROBOT_TOKEN -H 'Content-Type: application/json' -d "$msg"
rm $resp_tmp_file
+
+echo "executing notify.sh successfully"
diff --git a/package.json b/package.json
index 4a7e3ef..d7c2967 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"browser": {
"./sfc": "src/upload-to-ali.vue"
},
+ "types": "src/upload-to-ali.d.ts",
"scripts": {
"dev": "vue-styleguidist server",
"test": "jest",
@@ -43,7 +44,7 @@
"@babel/core": "^7.4.3",
"@babel/plugin-transform-runtime": "^7.4.3",
"@babel/preset-env": "^7.4.3",
- "@femessage/github-release-notes": "^0.19.0",
+ "@femessage/github-release-notes": "latest",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.5",
"dotenv": "^7.0.0",
@@ -78,7 +79,7 @@
"publishConfig": {
"access": "public"
},
- "vue-sfc-cli": "1.10.6",
+ "vue-sfc-cli": "1.12.0",
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
diff --git a/src/upload-to-ali.d.ts b/src/upload-to-ali.d.ts
new file mode 100644
index 0000000..c049df7
--- /dev/null
+++ b/src/upload-to-ali.d.ts
@@ -0,0 +1,90 @@
+import Vue, {VueConstructor} from 'vue'
+
+declare module '@femessage/upload-to-ali' {
+ class FemessageComponent extends Vue {
+ static install(vue: typeof Vue): void
+ }
+
+ type CombinedVueInstance<
+ Instance extends Vue,
+ Data,
+ Methods,
+ Computed,
+ Props
+ > = Data & Methods & Computed & Props & Instance
+
+ type ExtendedVue<
+ Instance extends Vue,
+ Data,
+ Methods,
+ Computed,
+ Props
+ > = VueConstructor<
+ CombinedVueInstance & Vue
+ >
+
+ type Combined = Data &
+ Methods &
+ Computed &
+ Props
+
+ type UploadToAliData = {
+ previewUrl: string
+
+ uploading: boolean
+
+ isHighlight: boolean
+ }
+
+ type UploadToAliMethods = {
+ selectFiles: () => void
+ }
+
+ type UploadToAliComputed = {
+ uploadList: any[]
+ canUpload: boolean
+ uploadRequest: (file: any) => Promise
+ }
+
+ type UploadToAliProps = {
+ action: string
+ bucket: string
+ region: string
+ dir: string
+ customDomain: string
+ value: string | any[]
+ multiple: boolean
+ size: number
+ accept: string
+ timeout: number
+ disabled: boolean
+ max: number
+ compressOptions: {[key: string]: any}
+ uploadOptions: {[key: string]: any}
+ preview: boolean
+ tip: string
+ onClick: (url: string, isFile: boolean) => void
+ beforeUpload: (files: any[]) => Promise
+ onOversize: (fileOvesize: any) => void
+ request: (file: any) => Promise
+ }
+
+ type UploadToAli = Combined<
+ UploadToAliData,
+ UploadToAliMethods,
+ UploadToAliComputed,
+ UploadToAliProps
+ >
+
+ export interface UploadToAliType extends FemessageComponent, UploadToAli {}
+
+ const UploadToAliConstruction: ExtendedVue<
+ Vue,
+ UploadToAliData,
+ UploadToAliMethods,
+ UploadToAliComputed,
+ UploadToAliProps
+ >
+
+ export default UploadToAliConstruction
+}
diff --git a/yarn.lock b/yarn.lock
index 7f81b82..bf405cf 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -758,7 +758,7 @@
exec-sh "^0.3.2"
minimist "^1.2.0"
-"@femessage/github-release-notes@^0.19.0":
+"@femessage/github-release-notes@latest":
version "0.19.0"
resolved "https://registry.npmjs.org/@femessage/github-release-notes/-/github-release-notes-0.19.0.tgz#483767c6a52d3a1086000442580503fed72a0898"
integrity sha512-p97YOnBoLfgiWknF5bzqlUOTHIBcBpI8L7bpekPls3annTV65TGfdkl2ICZZAvhjIcl9usDqGFj6pJWj+R+Rzw==