How to use the gh-pages.clean function in gh-pages

To help you get started, we’ve selected a few gh-pages examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / docsearch / scripts / docs / gh-pages.js View on Github external
/* eslint no-console:0 */
import ghpages from 'gh-pages';
import {join} from 'path';

let basePath = join(__dirname, '../../docs/build');

ghpages.clean();

if (process.env.CI === 'true') {
  ghpages.publish(basePath, {
    repo: 'https://' + process.env.GH_TOKEN + '@github.com/algolia/docsearch.git'
  }, end);
} else {
  ghpages.publish(basePath, end);
}

function end(err) {
  if (err) {
    throw err;
  } else {
    console.log('published gh-pages');
  }
}
github angular-schule / angular-cli-ghpages / src / engine / engine.ts View on Github external
export async function run(
  dir: string,
  options: Schema,
  logger: logging.LoggerApi
) {
  options = prepareOptions(options, logger);

  // this has to occur _after_ the monkeypatch of util.debuglog:
  const ghpages = require('gh-pages');

  // always clean the cache directory.
  // avoids "Error: Remote url mismatch."
  if (options.dryRun) {
    logger.info('Dry-run / SKIPPED: cleaning of the cache directory');
  } else {
    ghpages.clean();
  }

  await checkIfDistFolderExists(dir);
  await createNotFoundPage(dir, options, logger);
  await createCnameFile(dir, options, logger);
  await publishViaGhPages(ghpages, dir, options, logger);

  logger.info(
    '🚀 Successfully published via angular-cli-ghpages! Have a nice day!'
  );
}
github algolia / react-instantsearch / scripts / docs / gh-pages.js View on Github external
import ghpages from 'gh-pages';
import {join} from 'path';

let basePath = join(__dirname, '../../docs/_site');

ghpages.clean();

if (process.env.CI === 'true') {
  ghpages.publish(basePath, {
    repo: 'https://' + process.env.GH_TOKEN + '@github.com/algolia/instantsearch.js.git'
  }, end);
} else {
  ghpages.publish(basePath, end);
}

function end(err) {
  if (err) {
    throw err;
  }
}

gh-pages

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

MIT
Latest version published 2 months ago

Package Health Score

80 / 100
Full package analysis

Popular gh-pages functions