mirror of
https://github.com/scratchfoundation/gh-pages.git
synced 2025-02-26 14:14:06 -05:00
39 lines
1.2 KiB
JavaScript
Executable file
39 lines
1.2 KiB
JavaScript
Executable file
#!/usr/bin/env node
|
|
|
|
var ghpages = require('../lib/index');
|
|
var program = require('commander');
|
|
var path = require('path');
|
|
|
|
program
|
|
.version(require('../package').version)
|
|
.option('-d, --dist <dist>',
|
|
'base directory for all source files')
|
|
.option('-s, --src <src>',
|
|
'pattern used to select which files should be published', '**/*')
|
|
.option('-r, --repo <repo>',
|
|
'URL of the repository you\'ll be pushing to')
|
|
.option('-b, --branch <branch>',
|
|
'name of the branch you\'ll be pushing to', 'gh-pages')
|
|
.option('-m, --message <message>',
|
|
'commit message', 'Updates')
|
|
.option('-t, --dotfiles', 'Include dotfiles')
|
|
.option('-a, --add', 'Only add, and never remove existing files.')
|
|
.parse(process.argv);
|
|
|
|
ghpages.publish(path.join(process.cwd(), program.dist), {
|
|
repo: program.repo,
|
|
branch: program.branch,
|
|
src: program.src,
|
|
message: program.message,
|
|
dotfiles: !!program.dotfiles,
|
|
add: !!program.add,
|
|
logger: function(message) {
|
|
process.stderr.write(message + '\n');
|
|
}
|
|
}, function(err) {
|
|
if (err) {
|
|
process.stderr.write(err.message + '\n');
|
|
return process.exit(1);
|
|
}
|
|
process.stderr.write('Published\n');
|
|
});
|