Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,3 @@ themes/cypress/source/fonts/vendor/

cypress/screenshots
cypress/videos

# Dynamically parsed data
source/_data/banners.yml
31 changes: 0 additions & 31 deletions cypress/integration/contentful_banners_spec.js

This file was deleted.

57 changes: 6 additions & 51 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ process.on('unhandledRejection', function (reason, p) {
const Hexo = require('hexo')
const chalk = require('chalk')
const minimist = require('minimist')
const Contentful = require('contentful')
const moment = require('moment')
const yaml = require('js-yaml')
const fs = require('fs')
const { documentToHtmlString } = require('@contentful/rich-text-html-renderer')

// these are the args like --port
const args = minimist(process.argv.slice(2))
Expand Down Expand Up @@ -91,57 +86,17 @@ function initHexo () {
console.log('in environment %s site url is %s', env, url)
hexo.config.url = url

// set this on both our process + Hexo
// set this on both our process + hexo
process.env.NODE_ENV = hexo.env.NODE_ENV = env

console.log('NODE_ENV is:', chalk.cyan(env))

return new Promise((resolve, reject) => {
const space = hexo.env.GATSBY_CONTENTFUL_SPACE_ID || process.env.GATSBY_CONTENTFUL_SPACE_ID
const accessToken = hexo.env.GATSBY_CONTENTFUL_ACCESS_TOKEN || process.env.GATSBY_CONTENTFUL_ACCESS_TOKEN

if (typeof space === 'undefined' || typeof accessToken === 'undefined') {
return reject({
message: 'No Contentful space variables.',
})
}

return Contentful.createClient({ space, accessToken })
.getEntries({ content_type: 'topBanner' })
.then(({ items }) => {
const data = items.reduce((filtered, option) => {
if (moment(option.fields.endDate).isSameOrAfter(moment())) {
filtered.push({ ...option.fields, text: documentToHtmlString(option.fields.text) })
}

return filtered
}, [])

fs.writeFile(
`${__dirname}/source/_data/banners.yml`,
yaml.safeDump(data),
(error) => {
// log if writeFile ends with error, but don't block hexo init process
if (error) {
console.warn(error)

return reject(error)
}

return resolve()
},
)
})
})
// start Hexo
.then(() => hexo.init().then(() => hexo.call(cmd, args)))
.catch((error) => {
// log error object
console.error(error)

// but start Hexo anyway
return hexo.init().then(() => hexo.call(cmd, args))
return hexo.init()
.then(() => {
return hexo.call(cmd, args)
})

}

initHexo()

99 changes: 0 additions & 99 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"cypress": "3.4.1",
"dependency-check": "3.4.1",
"deps-ok": "1.4.1",
"emoji-strip": "1.0.1",
"eslint": "6.1.0",
"eslint-plugin-cypress": "2.6.0",
"eslint-plugin-cypress-dev": "2.1.0",
Expand Down Expand Up @@ -129,9 +128,7 @@
"yamljs": "0.3.0"
},
"dependencies": {
"@contentful/rich-text-html-renderer": "13.1.0",
"check-more-types": "2.24.0",
"contentful": "7.8.2",
"debug": "4.1.1",
"docsearch.js": "2.6.3",
"font-awesome": "4.7.0",
Expand All @@ -145,11 +142,9 @@
"hexo-renderer-marked": "0.3.2",
"hexo-renderer-scss": "1.2.0",
"hexo-server": "0.3.3",
"js-yaml": "3.13.1",
"lazy-ass": "1.6.0",
"lodash": "4.17.15",
"menuspy": "1.3.0",
"moment": "2.24.0",
"roboto-fontface": "0.10.0",
"scrollingelement": "1.5.2",
"yall": "github:malchata/yall.js#1c782f1ab7a0becb1a88fd6f3b260e55d5e213a2"
Expand Down
19 changes: 0 additions & 19 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,6 @@ please see our [Contributing Guideline](/CONTRIBUTING.md).

Cypress is [first time OSS contributor friendly](http://www.firsttimersonly.com/). See [these issues](https://github.com/cypress-io/cypress-documentation/labels/first-timers-only) to contribute in a meaningful way.

### Contentful driven data:

If you need any [Contentful](https://www.contentful.com/) driven data to be parsed before Hexo serve - you need to declare it Circle CI or/and bash. You may need [Contentful](https://www.contentful.com/) environment variables inside your machine or container:

- `GATSBY_CONTENTFUL_SPACE_ID`

[Contentful](https://www.contentful.com/) 12 digit key. You can find it (if you have granted access) in [Contentful](https://www.contentful.com/) acc:

Settings → API keys → Master → Space ID

- `GATSBY_CONTENTFUL_ACCESS_TOKEN`

[Contentful](https://www.contentful.com/) 64 digit token. You can find it (if you have granted access) in [Contentful](https://www.contentful.com/) acc:

Settings → API keys → Master → Content Delivery API - access token

P.S. If you don't have any of this - Hexo will build & serve as usual, but without any
[Contentful](https://www.contentful.com/) driven data.

## Deploying

See our [Deploy Guideline](DEPLOY.md).
Expand Down
5 changes: 0 additions & 5 deletions source/_data/banners.yml

This file was deleted.

2 changes: 1 addition & 1 deletion themes/cypress/layout/api-toc.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="content-wrap" class="{{ page.containerClass }}">
<div id="content-wrap" class="{{ page.containerClass }}">
<div id="content" class="wrapper">
<div id="content-inner">
{{ partial('partial/sidebar') }}
Expand Down
11 changes: 2 additions & 9 deletions themes/cypress/layout/layout.swig
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,11 @@
{{ partial('partial/head') }}
<body>
{{ partial('partial/google-tag-manager-noscript')}}

<div id="container">
{{ partial('partial/header', {}, { cache: true }) }}

<div>
{{ partial('partial/header', { className: 'header-top-hidden' }, { cache: true }) }}
{{ body }}
</div>
{{ partial('partial/header') }}
{{ body }}
</div>

<div id="mobile-nav-dimmer"></div>

{{ partial('partial/mobile_nav') }}
{{ partial('partial/after_footer') }}
</body>
Expand Down
1 change: 0 additions & 1 deletion themes/cypress/layout/partial/after_footer.swig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!-- Scripts -->
<!-- build:js /js/application.js -->
{{ js('js/banners_actualization') }}
{{ js('js/global_variable') }}
{{ js('js/lang_select') }}
{{ js('js/vendor/scrollingelement') }}
Expand Down
13 changes: 0 additions & 13 deletions themes/cypress/layout/partial/banners.swig

This file was deleted.

Loading