Files
cypress/docs/scripts/config.js
Gleb Bahmutov 420c896b3d Docs staging 375 (#391)
* docs: set full url to staging

* docs: test after deploy

* add dot missing in deploy regular expression

* increase docs start timeout

* docs: catch missing css/cypress.css and js/toc.js after deploy

* docs: generate single application.js on staging

* docs: test for magic variable to detect missing js

* docs: test search drop down on intro page

* docs: add e2e test to catch missing sidebar

* docs: split build

* docs: run build file save

* docs: ls public before generating build.json

* docs: generate docs in debug mode

* setup custom linting rules inside themes/cypress/source to keep them ES5

* more eslint wrangling
2017-08-28 22:25:18 -04:00

36 lines
1.2 KiB
JavaScript

'use strict'
/* global hexo */
/* eslint-disable no-console */
const chalk = require('chalk')
// https://github.com/mamboer/hexo-filter-cleanup
// only run the filter_cleanup if we are in
// production mode -- deploying static asset
// this will combine multiple JS files into single "application.js"
// note that --debug mode in hexo disables clean up automatically
if (process.env.NODE_ENV !== 'production' &&
process.env.NODE_ENV !== 'staging') {
console.log('disabling filter cleanup for environment', process.env.NODE_ENV)
hexo.config.filter_cleanup = false
} else {
console.log('NODE_ENV', process.env.NODE_ENV)
console.log('has filter cleanup', hexo.config.filter_cleanup)
}
if (process.env.NODE_ENV === 'staging') {
const url = 'https://docs-staging.cypress.io'
console.log('in environment %s site url is %s', process.env.NODE_ENV, url)
hexo.config.url = url
}
// hexo does this weird thing where it literally sets
// an 'env' property on the 'env' object
// so we take that into account (and any other way its set)
const env = hexo.env.NODE_ENV || hexo.env.env || process.env.NODE_ENV || 'development'
// set this on both our process + hexo
process.env.NODE_ENV = hexo.env.NODE_ENV = env
console.log('NODE_ENV is:', chalk.cyan(env))