-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: generate a test example on netlify on PRs #4912
Changes from 7 commits
98212eb
21f06d6
4d7cea3
c115f17
5a371f6
349f714
24d419a
e9b0fa8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import sh from 'shelljs'; | ||
import klawSync from 'klaw-sync'; | ||
import pkg from '../package.json'; | ||
|
||
const dest = 'docs/api/'; | ||
const vjsFlash = 'node_modules/videojs-flash'; | ||
const vjsSwf = 'node_modules/videojs-swf/'; | ||
const distDest = path.join(dest, 'dist'); | ||
const exampleDest = path.join(dest, 'test-example'); | ||
const vjsFlashDest = path.join(dest, vjsFlash, 'dist'); | ||
const swfDest = path.join(dest, vjsFlash, vjsSwf, 'dist'); | ||
|
||
export function cleanupExample() { | ||
sh.rm('-rf', distDest); | ||
sh.rm('-rf', exampleDest); | ||
sh.rm('-rf', path.join(dest, 'node_modules')); | ||
} | ||
|
||
export default function generateExample({skipBuild} = {}) { | ||
// run the build | ||
if (!skipBuild) { | ||
sh.exec('npm run build'); | ||
} | ||
|
||
// make sure that the example, flash, and swf dests are available | ||
sh.mkdir('-p', exampleDest); | ||
sh.mkdir('-p', vjsFlashDest); | ||
sh.mkdir('-p', swfDest); | ||
|
||
// copy the `dist` dir | ||
sh.cp('-R', 'dist', path.join(dest, 'dist')); | ||
sh.rm(path.join(dest, 'dist', `video-js-${pkg.version}.zip`)); | ||
|
||
// copy videojs-flash | ||
sh.cp(path.join(vjsFlash, 'dist', 'videojs-flash.js'), vjsFlashDest); | ||
// copy videojs-swf | ||
if (fs.existsSync(path.join(vjsFlash, vjsSwf, 'dist', 'video-js.swf'))) { | ||
sh.cp(path.join(vjsFlash, vjsSwf, 'dist', 'video-js.swf'), swfDest); | ||
} else { | ||
sh.cp(path.join(vjsSwf, 'dist', 'video-js.swf'), swfDest); | ||
} | ||
|
||
const files = klawSync('sandbox/').filter((file) => path.extname(file.path) === '.example'); | ||
|
||
// copy the sandbox example files | ||
files.forEach(function(file) { | ||
const p = path.parse(file.path); | ||
sh.cp(file.path, path.join(exampleDest, p.name)); | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,7 +151,6 @@ module.exports = function(grunt) { | |
] | ||
}, | ||
fonts: { cwd: 'node_modules/videojs-font/fonts/', src: ['*'], dest: 'build/temp/font/', expand: true, filter: 'isFile' }, | ||
swf: { cwd: 'node_modules/videojs-swf/dist/', src: 'video-js.swf', dest: 'build/temp/', expand: true, filter: 'isFile' }, | ||
ie8: { cwd: 'node_modules/videojs-ie8/dist/', src: ['**/**'], dest: 'build/temp/ie8/', expand: true, filter: 'isFile' }, | ||
dist: { cwd: 'build/temp/', src: ['**/**', '!test*'], dest: 'dist/', expand: true, filter: 'isFile' }, | ||
a11y: { src: 'sandbox/descriptions.html.example', dest: 'sandbox/descriptions.test-a11y.html' }, // Can only test a file with a .html or .htm extension | ||
|
@@ -449,7 +448,6 @@ module.exports = function(grunt) { | |
'cssmin', | ||
|
||
'copy:fonts', | ||
'copy:swf', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. our switch to node 8/npm 5 meant that packages were flattened, so, the swf snuck back into the dist folder. |
||
'copy:ie8', | ||
'vjslanguages' | ||
]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
const sh = require('shelljs'); | ||
const semver = require('semver'); | ||
const generateExample = require('./generate-example.js').default; | ||
|
||
const GIT_LOG = `git log --format=%B -n 1 ${process.env.COMMIT_REF}`; | ||
const output = sh.exec(GIT_LOG, {async: false, silent:true}).stdout; | ||
|
@@ -16,4 +17,9 @@ if (process.env.BRANCH === 'master' && semver.valid(output.trim()) === null) { | |
|
||
// copy the legacy docs over | ||
sh.cp('-R', 'docs/legacy-docs', 'docs/api/docs'); | ||
|
||
if (process.env.BRANCH !== 'master') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's no need or want to generate this in the master branch currently, I don't think. |
||
// generate the example | ||
generateExample(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<meta charset="utf-8" /> | ||
<title>Video.js Icons Sandbox</title> | ||
|
||
<link href="../build/temp/video-js.css" rel="stylesheet" type="text/css"> | ||
<link href="../build/video-js.css" rel="stylesheet" type="text/css"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this one intentionally using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope. Probably got confused about it, heh. |
||
|
||
<style> | ||
.icon-list li span { font-size: 150% } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need the zip file published here.