Skip to content

Commit

Permalink
Merge branch 'master' into use-cases/data-registry
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeorpinel committed Dec 10, 2019
2 parents 707a507 + f0091fe commit f30c1e7
Show file tree
Hide file tree
Showing 58 changed files with 2,748 additions and 1,518 deletions.
12 changes: 4 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
**IMPORTANT NOTES** (please read, then delete):
Disregard the recommendations below if you use **Edit on Github** button to improve the docs in place.

- Have you followed the guidelines in
[Contributing Documentation](https://dvc.org/doc/user-guide/contributing/docs)?
❗ Please read the guidelines in the [Contributing to the Documentation](https://dvc.org/doc/user-guide/contributing/docs) list if you make any substantial changes to the documentation or JS engine.

- Please use the title to provide a clear one-line present-tense summary of the
changes introduced in the PR. For example: "Introduce the first version of the
collection editor.".
🐛 Please make sure to mention `Fix #issue` (if applicable) in the description of the PR. This enables GitHub to link the PR to the corresponding bug and close it automatically when PR is merged.

- Please make sure to mention "Fix #bugnum" (if applicable) in the description
of the PR. This enables GitHub to link the PR to the corresponding bug.
Thank you for the contribution - we'll try to review and merge it as soon as possible. 🙏
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,51 @@
},
"homepage": "https://github.com/iterative/dvc.org#readme",
"dependencies": {
"axios": "^0.19.0",
"color": "^3.1.2",
"dom-scroll-into-view": "^2.0.1",
"force-ssl-heroku": "^1.0.2",
"github-markdown-css": "^3.0.1",
"isomorphic-fetch": "^2.2.1",
"lodash.includes": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
"lodash.startcase": "^4.4.0",
"lodash.throttle": "^4.1.1",
"next": "^9.0.5",
"lodash.topairs": "^4.3.0",
"next": "^9.1.4",
"perfect-scrollbar": "^1.4.0",
"prop-types": "^15.7.2",
"react": "^16.9.0",
"react": "^16.12.0",
"react-collapse": "^4.0.3",
"react-collapsible": "^2.6.0",
"react-dom": "^16.9.0",
"react-ga": "^2.6.0",
"react-markdown": "^4.1.0",
"react-collapsible": "^2.6.2",
"react-dom": "^16.12.0",
"react-ga": "^2.7.0",
"react-markdown": "^4.2.2",
"react-motion": "^0.5.2",
"react-popover": "^0.5.10",
"react-scroll": "^1.7.13",
"react-slick": "^0.25.2",
"react-syntax-highlighter": "^11.0.2",
"styled-components": "^4.3.2",
"styled-reset": "^3.0.2",
"unist-util-visit": "latest"
"styled-components": "^4.4.1",
"styled-reset": "^4.0.8",
"unist-util-visit": "2.0.1"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/core": "^7.7.4",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"babel-plugin-transform-define": "^1.3.1",
"babel-plugin-transform-define": "^2.0.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"eslint": "^6.4.0",
"eslint-config-prettier": "^6.3.0",
"eslint": "^6.7.2",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.14.3",
"husky": "^3.0.4",
"eslint-plugin-react": "^7.17.0",
"husky": "^3.1.0",
"jest": "^24.9.0",
"lint-staged": "^10.0.0-1",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1"
"micro-cors": "^0.1.1",
"prettier": "^1.19.1",
"pretty-quick": "^2.0.1",
"request": "^2.88.0"
},
"husky": {
"hooks": {
Expand Down
17 changes: 17 additions & 0 deletions pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ export default class Page extends Document {
type="text/css"
href="/static/fonts/fonts.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/3.0.1/github-markdown.min.css"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn/docsearch.min.css"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/css/perfect-scrollbar.min.css"
/>
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn/docsearch.min.js"
/>
{this.props.styleTags}
</Head>
<body>
Expand Down
55 changes: 55 additions & 0 deletions pages/api/comments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* This API endpoint is used by https://blog.dvc.org
* to get comments count for the post, it gets
* discuss.dvc.org topic url as a param and returns
* comments count or error.
*
* It made this way to configure CORS, reduce user's payload
* and to add potential ability to cache comments count
* in the future.
*/

import Cors from 'micro-cors'
import request from 'request'

import { BLOG_URL, FORUM_URL } from '../../src/consts'

const cors = Cors({
allowedMethods: ['GET', 'HEAD'],
origin: BLOG_URL
})

const getCommentCount = (req, res) => {
const {
query: { url }
} = req

if (!url.startsWith(FORUM_URL)) {
res.status(400)

return
}

request(`${url}.json`, (error, response, body) => {
if (error || response.statusCode !== 200) {
res.status(502).json({ error: 'Unexpected response from Forum' })

return
}

const json = JSON.parse(body)

if (!json.posts_count) {
res.status(502).json({ error: 'Unexpected payload from Forum' })

return
}

// post_count return all posts including topic itself
const count = json.posts_count - 1

res.status(200).json({ count })
})
}

export default cors(getCommentCount)
Loading

0 comments on commit f30c1e7

Please sign in to comment.