Skip to content

Commit

Permalink
fix: bad ghpages deployment (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanStandel authored Jun 11, 2022
1 parent 2aaa06b commit c2ae39d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lint:fix": "eslint --fix .",
"start": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"deploy-storybook": "storybook-to-ghpages"
"deploy-storybook": "storybook-to-ghpages && npm run fix-deploy",
"fix-deploy": "node ./scripts/fix-storybook-to-ghpages-deploy.js"
},
"license": "MIT",
"devDependencies": {
Expand Down
18 changes: 18 additions & 0 deletions scripts/fix-storybook-to-ghpages-deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { execSync } = require("child_process");
const { readFileSync, writeFileSync } = require("fs");

try {
execSync("git branch -D gh-pages")
} catch {}
try {
execSync("git pull")
} catch {}
execSync("git checkout gh-pages")

const iframeDotHtml = readFileSync("./iframe.html", { encoding: "utf8" });

writeFileSync("./iframe.html", iframeDotHtml.replace("<script type=\"module\" crossorigin src=\"/assets/", "<script type=\"module\" crossorigin src=\"/solid-joystick/assets/"));

execSync("git commit -am \"fix: automated fix for bad deploy path\"");
execSync("git push");
execSync("git checkout main");

0 comments on commit c2ae39d

Please sign in to comment.