thieryw/gitlanding

homepage field node command appends .git

naterock101 opened this issue · 2 comments

thanks for fixing the other issue with the deploy script so fast!

wanted to let you know that on the current instructions if someone uses the node command to update the "homepage" field in the package.json file it will append .git to it and that will then break the links to the stylesheets, js pages and assets causing a bunch of 404s when they get the project setup at first.

node -e '(() => {require("fs").writeFileSync("package.json",JSON.stringify({...require("./package.json"),"homepage":(()=>{const[r,u]=${require("child_process").execSync("git remote get-url origin")}.replace(/\r?\n$/, "").split("/").reverse();return https://${u}.github.io/${r};})()},null,2));require("fs").appendFileSync(require("path").join(__dirname, "src","react-app-env.d.ts"),declare module "*.mp4" {const _default: string;export default _default;})})()'

Thank you! I'll look into it.

Hello and thank you for opening this issue. I am sorry for not responding sooner but I was dealing with painful health problems.

The reason why this issue occurred is that the command was written with only, https authentication in mind. I have re written and tested it, both with https and SSH and it seems to be working now.

node -e '(()=>{require("fs").writeFileSync("package.json",JSON.stringify({...require("./package.json"),"homepage":(() => {const url = `${require("child_process").execSync("git remote get-url origin")}`;const username = url.match(/(?<=:)(.*)(?=\/)/g); const projectName = url.match(/(?<=\/)(.*)(?=\.)/g); if (username === null || projectName === null) return; return `https://${username}.github.io/${projectName}`;})()}, null, 2));})()'  

I thank you again for bringing this to our attention.