Socket
Socket
Sign inDemoInstall

gh-pages

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh-pages

Publish to a gh-pages branch on GitHub (or any other branch on any other remote)


Version published
Weekly downloads
337K
decreased by-0.93%
Maintainers
2
Weekly downloads
 
Created

What is gh-pages?

The gh-pages npm package is a utility for deploying projects to GitHub Pages. It simplifies the process of publishing content to a GitHub repository's gh-pages branch, which is used to serve static sites directly from the repository.

What are gh-pages's main functionalities?

Deploying to GitHub Pages

This feature allows you to deploy the contents of a directory (in this case, 'dist') to the gh-pages branch of your repository. The callback function handles any errors that occur during the deployment process.

const ghpages = require('gh-pages');
ghpages.publish('dist', function(err) {
  if (err) {
    console.error('Deployment failed:', err);
  } else {
    console.log('Deployment successful!');
  }
});

Customizing Deployment

This feature allows you to customize the deployment by specifying options such as the branch to deploy to, the repository URL, and user information for the commit.

const ghpages = require('gh-pages');
ghpages.publish('dist', {
  branch: 'custom-branch',
  repo: 'https://github.com/user/repo.git',
  user: {
    name: 'Your Name',
    email: 'your-email@example.com'
  }
}, function(err) {
  if (err) {
    console.error('Deployment failed:', err);
  } else {
    console.log('Deployment successful!');
  }
});

Cleaning Up Before Deployment

This feature allows you to clean up the local cache before deploying. This can be useful to ensure that no old files are left over from previous deployments.

const ghpages = require('gh-pages');
ghpages.clean();
ghpages.publish('dist', function(err) {
  if (err) {
    console.error('Deployment failed:', err);
  } else {
    console.log('Deployment successful!');
  }
});

Other packages similar to gh-pages

Keywords

FAQs

Package last updated on 18 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc