-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: deploy docs using netlify (#4774)
This adds in the legacy docs into the repo and enables automatic deployment via netlify. The netlify-docs.js script will error out the build on netlify on master if we're not on a tagged commit so that it won't redeploy the docs unless there's a new release. If we're not on master or on master with a tagged commit, it will process with the deploy. Also, this removes the API docs from being published with npm, fixes #4609.
- Loading branch information
Showing
116 changed files
with
53,331 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ | |
!dist/** | ||
!es5/** | ||
!src/css/** | ||
!docs/api/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const sh = require('shelljs'); | ||
|
||
const GIT_CONTAINS = `git tag --contains ${process.env.COMMIT_REF}`; | ||
|
||
const output = sh.exec(GIT_CONTAINS, {async: false, silent:true}).stdout; | ||
|
||
// if we're on master branch and not on a tagged commit, | ||
// error the build so it doesn't redeploy the docs | ||
if (process.env.BRANCH === 'master' && output === '') { | ||
process.exit(1); | ||
|
||
// if we're on any other branch, we can regenerate docs | ||
} else { | ||
// generate the docs | ||
sh.exec('npm run docs:api'); | ||
|
||
// copy the legacy docs over | ||
sh.cp('-R', 'docs/legacy-docs', 'docs/api/docs'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script src="//use.edgefonts.net/source-code-pro.js"></script> <link href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" rel="stylesheet" type="text/css"> <!-- there are many other style for highlighted code here: https://cdnjs.com/libraries/highlight.js --> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/atelier-forest.light.min.css"> <link rel="stylesheet" type="text/css" href="css/api-docs.css"> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script> </head> <body> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script> <script src="js/doc-data.js"></script> <script src="js/api-docs.js"></script> </body> </html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script src="//use.edgefonts.net/source-code-pro.js"></script> <link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' rel='stylesheet' type='text/css'> <!-- there are many other style for highlighted code here: https://cdnjs.com/libraries/highlight.js --> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/atelier-forest.light.min.css"> <link rel="stylesheet" type="text/css" href="css/api-docs.css"> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script> </head> <body> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script> <script src="js/doc-data.js"></script> <script src="js/api-docs.js"></script> </body> </html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title></title> | ||
<style> | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<h4>Check the console for results</h4> | ||
<script src="../js/doc-data.js"></script> | ||
<script src="create-doc-files.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* get a subset of objects in array of objects | ||
* based on some property value | ||
* | ||
* @param {array} targetArray - array to search | ||
* @param {string} objProperty - object property to search | ||
* @param {string|number} value - value of the property to search for | ||
* @return {array} array of objects with matching property value | ||
*/ | ||
function getSubArray(targetArray, objProperty, value) { | ||
var i, totalItems = targetArray.length, idxArr = []; | ||
for (i = 0; i < totalItems; i++) { | ||
if (targetArray[i][objProperty] === value) { | ||
idxArr.push(targetArray[i]); | ||
} | ||
} | ||
return idxArr; | ||
} | ||
|
||
/** | ||
* create the HTML files for the classes | ||
* @param {array} filenameArray - array of the filenames | ||
*/ | ||
function createFiles(filenameArray) { | ||
var i, | ||
iMax = filenameArray.length, | ||
filename, | ||
contentStr = '<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script src="//use.edgefonts.net/source-code-pro.js"></script> <link href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" rel="stylesheet" type="text/css"> <!-- there are many other style for highlighted code here: https://cdnjs.com/libraries/highlight.js --> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/atelier-forest.light.min.css"> <link rel="stylesheet" type="text/css" href="css/api-docs.css"> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script> </head> <body> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script> <script src="js/doc-data.js"></script> <script src="js/api-docs.js"></script> </body> </html>'; | ||
for (i = 0; i < iMax; i++) { | ||
filename = filenameArray[i]; | ||
// create file with name=filename and contents=contentStr | ||
} | ||
} | ||
|
||
function createFilenameArray(classData) { | ||
var filenameArray = [], | ||
i, | ||
iMax = classData.length, | ||
item, | ||
str; | ||
// extract the filenames from the class items | ||
for (i = 0; i < iMax; i++) { | ||
item = classData[i]; | ||
str = item.meta.filename; | ||
str = str.substr(str.lastIndexOf('/') + 1); | ||
str = str.replace('.js', '.html'); | ||
filenameArray.push(str); | ||
} | ||
// videojs is special case | ||
filenameArray.push('video.html'); | ||
filenameArray = filenameArray.sort(); | ||
console.log('filenameArray', filenameArray); | ||
// now create the files | ||
createFiles(filenameArray); | ||
} | ||
/** | ||
* extracts class items from doc data | ||
* @param {array} docData JSON output from JSDoc | ||
*/ | ||
function getClassData(docData) { | ||
var classData = []; | ||
// extract the class items from the doc data | ||
classData = getSubArray(docData, 'kind', 'class'); | ||
// now create the array of filenames | ||
createFilenameArray(classData); | ||
} | ||
|
||
getClassData(docData); |
Oops, something went wrong.