Skip to content

Commit

Permalink
docs(site): add serverless functions
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Aug 3, 2021
1 parent 1de0f56 commit d872ea4
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
release:
if: contains(github.event.head_commit.message, 'chore(versions)')
steps:

- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
Expand All @@ -23,6 +22,7 @@ jobs:
env:
NODE_OPTIONS: --max_old_space_size=4096
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}
ACCESS_KEY_SECRET: ${{ secrets.ACCESS_KEY_SECRET }}
REGISTRY: https://registry.npmjs.org
3 changes: 3 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"untracked",
"Untracking",
"Unmount",
"octokit",
"repos",
"alibaba",
"antd",
"Antd",
"alifd",
Expand Down
21 changes: 21 additions & 0 deletions docs/functions/contributors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Handler } from '@netlify/functions'
import { Octokit } from '@octokit/rest'

const octokit = new Octokit({
baseUrl: 'https://api.github.com',
auth: process.env.GITHUB_TOKEN,
})

export const handler: Handler = async () => {
return {
statusCode: 200,
body: JSON.stringify(
await octokit.repos.listContributors({
owner: 'alibaba',
repo: 'formily',
per_page: 1000,
page: 1,
})
),
}
}
19 changes: 19 additions & 0 deletions docs/site/Contributors.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React, { useEffect, useState } from 'react'

export const Contributors: React.FC = () => {
const [contributors, setContributors] = useState<any[]>()
useEffect(() => {
fetch('./.netlify/functions/contributors')
.then((res) => res.json())
.then(({ data }) => {
setContributors(data)
})
}, [])
return (
<div>
{contributors.map((user, key) => (
<div key={key}></div>
))}
</div>
)
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@testing-library/jest-dom": "^5.0.0",
"@testing-library/react": "^11.2.3",
"@testing-library/vue": "^5.6.2",
"@netlify/functions": "^0.7.2",
"@types/fs-extra": "^8.1.0",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "^24.0.18",
Expand Down
68 changes: 40 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1156,12 +1156,12 @@
resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.4.0.tgz#c3c5ae543c897caa9c2a68630bed355be5f9990f"
integrity sha512-JZButFdZ1+/xAfpguQHoabIXkcqRRKpMrWKBkpEZZyxfY9C1DpADFB8PEqGSTeFr135SaTRfKqGKx5xSCLI7ZQ==

"@designable/core@0.4.21", "@designable/core@^0.4.21":
version "0.4.21"
resolved "https://registry.yarnpkg.com/@designable/core/-/core-0.4.21.tgz#bf42b07f3d2c11f2378fd05316edb336f764c152"
integrity sha512-6Zld3eaE/1PTC+WhHEiKO0zvXc/avTFz+27KoOvYQprox+BaibnFwOyA1qb1zp6qUryJbD2Fgf0mk8tCtclxwA==
"@designable/core@0.4.22", "@designable/core@^0.4.22":
version "0.4.22"
resolved "https://registry.yarnpkg.com/@designable/core/-/core-0.4.22.tgz#805b3e141bf0105457d34cf2311bef89020f9b87"
integrity sha512-GNzomnu7qkVYCWDklOv5it9d08XpNTB0jM3A/eosHF1g953t5OGXQOR5UgEOmD5Z4mVFvQJJ+TPSEmiTMgqcqw==
dependencies:
"@designable/shared" "0.4.21"
"@designable/shared" "0.4.22"
"@formily/json-schema" "^2.0.0-beta.76"
"@formily/path" "^2.0.0-beta.76"
"@formily/reactive" "^2.0.0-beta.76"
Expand All @@ -1178,25 +1178,25 @@
"@formily/reactive" "^2.0.0-beta.50"
"@juggle/resize-observer" "^3.3.1"

"@designable/formily@^0.4.21":
version "0.4.21"
resolved "https://registry.yarnpkg.com/@designable/formily/-/formily-0.4.21.tgz#264641a6d38071a46a0d922af341e17a6436a16d"
integrity sha512-2WbemI1KyDK6+wqRgt7tNyu/v5qbu/NNChj9se3MPZLsfadvVSAalMzO+ZVps91qTOXdf1RhQ4Ve8wyWxq2poA==
"@designable/formily@^0.4.22":
version "0.4.22"
resolved "https://registry.yarnpkg.com/@designable/formily/-/formily-0.4.22.tgz#325e7aa308a1755238d5c8a7fd95d0a6dcc5a0a4"
integrity sha512-jnZkfyf0w1c6iI4yUrr5KCJA+0lUAsxs6Oldgrp8hL/WWh3NLKxtnwelORG9P4GZtqLCvJOgTgA159y8+avAEA==
dependencies:
"@designable/core" "0.4.21"
"@designable/shared" "0.4.21"
"@designable/core" "0.4.22"
"@designable/shared" "0.4.22"
"@formily/core" "^2.0.0-beta.76"
"@formily/json-schema" "^2.0.0-beta.76"

"@designable/react-settings-form@^0.4.21":
version "0.4.21"
resolved "https://registry.yarnpkg.com/@designable/react-settings-form/-/react-settings-form-0.4.21.tgz#fb6f2a6d3638ef9cccb997db8783441ecd5ef672"
integrity sha512-OoD77190ayvycTxKOYTGi4vargI3qsTHG9a22VCTqAi6nl87/TtSmp7Ttrwq3G9qq8C1QUpNuvZTdG0mFNRQPg==
"@designable/react-settings-form@^0.4.22":
version "0.4.22"
resolved "https://registry.yarnpkg.com/@designable/react-settings-form/-/react-settings-form-0.4.22.tgz#e0a9acb8dc041817f249f152e77e898180724db0"
integrity sha512-WWz9Jft2xMjwh9298tV8Url7AWZ/SKHB6TpJCH8r7fNO2Nm8seHrqvaCYqQojxCRC0G0t7NGRzxcWDAQrsojKw==
dependencies:
"@babel/parser" "^7.14.7"
"@designable/core" "0.4.21"
"@designable/react" "0.4.21"
"@designable/shared" "0.4.21"
"@designable/core" "0.4.22"
"@designable/react" "0.4.22"
"@designable/shared" "0.4.22"
"@formily/antd" "^2.0.0-beta.76"
"@formily/core" "^2.0.0-beta.76"
"@formily/react" "^2.0.0-beta.76"
Expand All @@ -1209,13 +1209,13 @@
react-color "^2.19.3"
react-tiny-popover "^6.0.5"

"@designable/react@0.4.21", "@designable/react@^0.4.21":
version "0.4.21"
resolved "https://registry.yarnpkg.com/@designable/react/-/react-0.4.21.tgz#fd21f18451e544d5f3c0bd1b336d8697e311c0bb"
integrity sha512-vQC7jsXPgbCvOxqG7oI3sZ0ioJTvo5AAV+tKaMfSfnqosFGhW60+E34iTDf/UiQ7doETO+hLtwCoPfM8O2m5Gw==
"@designable/react@0.4.22", "@designable/react@^0.4.22":
version "0.4.22"
resolved "https://registry.yarnpkg.com/@designable/react/-/react-0.4.22.tgz#e862ee38694c134ddb800f5edbef53c9f1ff853e"
integrity sha512-+lcIzSy++8rCOtZWbHXWhcAQXHGApSbXAWQD/dRsRaRECtX8Og43Jut5tDiCWDN9e3sS4uvsE1v8IZB/Im5wqA==
dependencies:
"@designable/core" "0.4.21"
"@designable/shared" "0.4.21"
"@designable/core" "0.4.22"
"@designable/shared" "0.4.22"
"@formily/reactive" "^2.0.0-beta.76"
"@formily/reactive-react" "^2.0.0-beta.76"
"@juggle/resize-observer" "^3.3.1"
Expand All @@ -1227,10 +1227,10 @@
dependencies:
requestidlecallback "^0.3.0"

"@designable/shared@0.4.21":
version "0.4.21"
resolved "https://registry.yarnpkg.com/@designable/shared/-/shared-0.4.21.tgz#8c81620ee07a0c9743cba99b483ed633e9581ac7"
integrity sha512-r3sKXBssSlEbor43V3+KpC58f/gFZ59eKoVKgk8vt/KolSpQB4t2FQ37kJD4kmlz1J2bcySmLh95HzjRM1P4PA==
"@designable/shared@0.4.22":
version "0.4.22"
resolved "https://registry.yarnpkg.com/@designable/shared/-/shared-0.4.22.tgz#e0ba9f67bb878d447e88a9d56b1936c74f807c3c"
integrity sha512-2NcSgxm8+tMibC6tOkDPZhJv7yMC9Ruo19HA6B2gAFqrEBxiFkZw8QDgB707X1BdcaU79RVC2Q9H7StY7ZK5xw==
dependencies:
requestidlecallback "^0.3.0"

Expand Down Expand Up @@ -2340,6 +2340,13 @@
call-me-maybe "^1.0.1"
glob-to-regexp "^0.3.0"

"@netlify/functions@^0.7.2":
version "0.7.2"
resolved "https://registry.yarnpkg.com/@netlify/functions/-/functions-0.7.2.tgz#9d39553b94e7aaa86dddf515bdbaed3e89998122"
integrity sha512-xf45ZqQukMxmlkqNMC5BXdFMaVZ8VqF42MV5zA5nKVOh2V0mhYlcbTYlVbS/K2/rtvQ3W8lxxixYl4NT7kq6Bg==
dependencies:
is-promise "^4.0.0"

"@nodelib/fs.scandir@2.1.5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
Expand Down Expand Up @@ -10407,6 +10414,11 @@ is-promise@^2.1.0:
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1"
integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==

is-promise@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3"
integrity sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==

is-redirect@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24"
Expand Down

0 comments on commit d872ea4

Please sign in to comment.