Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* 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');
}
}
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!'
);
}
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;
}
}