integrated changes from lelandmiller:base-dir
This commit is contained in:
parent
e0f90a8ec2
commit
fde7245554
2 changed files with 24 additions and 2 deletions
|
@ -57,6 +57,7 @@ exports.publish = function publish(basePath, config, callback) {
|
|||
}
|
||||
|
||||
var defaults = {
|
||||
dest: '.',
|
||||
add: false,
|
||||
git: 'git',
|
||||
clone: getCacheDir(),
|
||||
|
@ -168,14 +169,17 @@ exports.publish = function publish(basePath, config, callback) {
|
|||
.then(function() {
|
||||
if (!options.add) {
|
||||
log('Removing files');
|
||||
return git.rm(only.join(' '), options.clone);
|
||||
var outputFiles = only.map(function(file) {
|
||||
return path.join(options.dest, file);
|
||||
});
|
||||
return git.rm(outputFiles.join(' '), options.clone);
|
||||
} else {
|
||||
return Q.resolve();
|
||||
}
|
||||
})
|
||||
.then(function() {
|
||||
log('Copying files');
|
||||
return copy(files, basePath, options.clone);
|
||||
return copy(files, basePath, path.join(options.clone, options.dest));
|
||||
})
|
||||
.then(function() {
|
||||
log('Adding all');
|
||||
|
|
18
readme.md
18
readme.md
|
@ -299,6 +299,24 @@ ghpages.publish(path.join(__dirname, 'build'), {
|
|||
}, callback);
|
||||
```
|
||||
|
||||
#### <a id="optionsdest">options.dest</a>
|
||||
* type: `string`
|
||||
* default: `'.'`
|
||||
|
||||
The destination folder within the destination branch/repository.
|
||||
|
||||
Example use of the `dest` option:
|
||||
|
||||
```js
|
||||
/**
|
||||
* Place content in the static/project subdirectory of the target
|
||||
* branch/repository. If removing files, only remove static/project.
|
||||
*/
|
||||
ghpages.publish(path.join(__dirname, 'build'), {
|
||||
dest: 'static/project'
|
||||
}, callback);
|
||||
```
|
||||
|
||||
## Command Line Utility
|
||||
|
||||
Installing the package creates a `gh-pages` command line utility. Run `gh-pages --help` to see a list of supported options.
|
||||
|
|
Reference in a new issue