added postbuild step to copy video chunks to right directory upon build (done hackily)

This commit is contained in:
Warwick 2020-11-18 15:10:29 +00:00
parent 584714b6fe
commit 966e07f0e8
3 changed files with 73 additions and 15 deletions

View file

@ -4,8 +4,8 @@
"description": "Portfolio Site", "description": "Portfolio Site",
"main": "src/index.jsx", "main": "src/index.jsx",
"scripts": { "scripts": {
"start": "parcel index.html", "start": "rm -v dist/* && node postbuild.js && parcel index.html",
"build": "parcel build index.html" "build": "rm -rv dist && parcel build index.html && exec node postbuild.js"
}, },
"author": "", "author": "",
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
@ -13,17 +13,20 @@
"@babel/core": "^7.12.3", "@babel/core": "^7.12.3",
"@babel/plugin-transform-react-jsx": "^7.12.5", "@babel/plugin-transform-react-jsx": "^7.12.5",
"cssnano": "^4.1.10", "cssnano": "^4.1.10",
"parcel-bundler": "^1.12.4" "parcel-bundler": "^1.12.4",
"typescript": "^4.0.5"
}, },
"dependencies": { "dependencies": {
"@material-ui/core": "^4.11.0", "@material-ui/core": "^4.11.0",
"@types/react": "^16.9.56", "@types/react": "^16.9.56",
"fontsource-roboto": "^3.0.3", "fontsource-roboto": "^3.0.3",
"hls.js": "^0.14.16",
"preact": "^10.5.5", "preact": "^10.5.5",
"preact-async-route": "^2.2.1", "preact-async-route": "^2.2.1",
"preact-router": "^3.2.1", "preact-router": "^3.2.1",
"react": "^16.14.0", "react": "^16.14.0",
"react-dom": "^16.14.0" "react-dom": "^16.14.0",
"video.js": "^7.10.2"
}, },
"skipLibCheck": true, "skipLibCheck": true,
"alias": { "alias": {

54
postbuild.js Normal file
View file

@ -0,0 +1,54 @@
const Path = require("path");
const fs = require("fs");
fs.copyFile("./static/video/index0.ts", "./dist/index0.ts", (err) => {
if (err) {
return console.error("Video segments were not copied! \n", err);
} else {
return console.error("Video segments successfully copied! \n");
}
});
fs.copyFile("./static/video/index1.ts", "./dist/index1.ts", (err) => {
if (err) {
return console.error("Video segments were not copied! \n", err);
} else {
return console.error("Video segments successfully copied! \n");
}
});
fs.copyFile("./static/video/index2.ts", "./dist/index2.ts", (err) => {
if (err) {
return console.error("Video segments were not copied! \n", err);
} else {
return console.error("Video segments successfully copied! \n");
}
});
fs.copyFile("./static/video/index3.ts", "./dist/index3.ts", (err) => {
if (err) {
return console.error("Video segments were not copied! \n", err);
} else {
return console.error("Video segments successfully copied! \n");
}
});
fs.copyFile("./static/video/index4.ts", "./dist/index4.ts", (err) => {
if (err) {
return console.error("Video segments were not copied! \n", err);
} else {
return console.error("Video segments successfully copied! \n");
}
});
fs.copyFile("./static/video/index5.ts", "./dist/index5.ts", (err) => {
if (err) {
return console.error("Video segments were not copied! \n", err);
} else {
return console.error("Video segments successfully copied! \n");
}
});
fs.copyFile("./static/video/index6.ts", "./dist/index6.ts", (err) => {
if (err) {
return console.error("Video segments were not copied! \n", err);
} else {
return console.error("Video segments successfully copied! \n");
}
});

View file

@ -8,28 +8,29 @@ import {
Button, Button,
} from "@material-ui/core"; } from "@material-ui/core";
import CV from "../static/cv.pdf"; import CV from "../static/cv.pdf";
import PortfolioVideo from "../static/video/Portfolio.mp4";
import PortfolioTexture from "../static/images/diagmonds-light.png"; import VideoPlayer from "./VideoPlayer.jsx";
class Greeting extends Component { class Greeting extends Component {
render() { render() {
return ( return (
<div> <div>
{/*<div <div
style={{ style={{
position: "absolute", position: "absolute",
width: "100%", width: "100%",
left: "50%", left: "50%",
right: "50%", right: "50%",
top: "50%", top: "25%",
height: "100%", height: "50%",
//objectfit: "cover", objectFit: "cover",
transform: "translate(-50%,-50%)", transform: "translate(-50%,-50%)",
zindex: "-100", zIndex: "-1",
background: `url(${PortfolioTexture})`,
}} }}
/>*/} >
<video <VideoPlayer />
</div>
{/*<video
autoPlay autoPlay
muted muted
loop loop
@ -48,7 +49,7 @@ class Greeting extends Component {
//height="315" //height="315"
> >
<source src={PortfolioVideo} type="video/mp4" /> <source src={PortfolioVideo} type="video/mp4" />
</video> </video>*/}
<Container <Container
maxWidth="sm" maxWidth="sm"
style={{ style={{