Skip to content

Commit

Permalink
scripts updated
Browse files Browse the repository at this point in the history
  • Loading branch information
hashirshoaeb committed Aug 28, 2021
1 parent 0c56013 commit bdf7356
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"start": "next start",
"export": "next export",
"predeploy": "npm run build && npm run export && touch ./out/.nojekyll",
"deploy": "node scripts/pages.js https://github.com/hashirshoaeb/hashirshoaeb.github.io.git master",
"deploy": "npm run custom-domain && node scripts/pages.js hashirshoaeb master",
"custom-domain": "node scripts/cname.js hashirshoaeb.com www.hashirshoaeb.com",
"lint": "next lint"
},
Expand All @@ -38,4 +38,4 @@
"gh-pages": "^3.2.3",
"sass": "^1.37.5"
}
}
}
2 changes: 1 addition & 1 deletion scripts/cname.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs')

var args = process.argv.slice(2)
const args = process.argv.slice(2)
const content = args.join('\n')
const filePath = './out/CNAME'

Expand Down
12 changes: 7 additions & 5 deletions scripts/pages.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
const ghpages = require("gh-pages");
const build_path = './out';

var args = process.argv.slice(2);
var repoURL = args[0];
var branch = args[1];
const args = process.argv.slice(2);
const username = args[0];
const repoURL = `https://github.com/${username}/${username}.github.io.git`;
const branch = args[1];

console.log(`Deploying to ${repoURL} branch ${branch}`);

/**
* Deploy the built site to GitHub Pages with custom settings and options
* [username] is the GitHub username of the user who owns the repo
* [repoURL] - The URL of the GitHub repository to deploy to
* [branch] - The branch to deploy to
* [build_path] - The path to the built site
*
* node scripts/pages.js <repoURL> <branch>
* node scripts/pages.js <username> <branch>
* i.e.
* node scripts/pages.js https://github.com/hashirshoaeb/hashirshoaeb.github.io.git master
* node scripts/pages.js hashirshoaeb master
*/
ghpages.publish(
build_path,
Expand Down

0 comments on commit bdf7356

Please sign in to comment.