Comparing version 2.1.1 to 2.2.0
@@ -11,3 +11,3 @@ #!/usr/bin/env node | ||
return new Promise((resolve, reject) => { | ||
const basePath = path.join(process.cwd(), program.dist); | ||
const basePath = path.resolve(process.cwd(), program.dist); | ||
ghpages.publish(basePath, config, err => { | ||
@@ -70,2 +70,6 @@ if (err) { | ||
.option('-n, --no-push', 'Commit only (with no push)') | ||
.option( | ||
'-f, --no-history', | ||
'Push force new commit without parent history' | ||
) | ||
.parse(args); | ||
@@ -100,2 +104,3 @@ | ||
push: !!program.push, | ||
history: !!program.history, | ||
user: user | ||
@@ -102,0 +107,0 @@ }; |
@@ -0,1 +1,8 @@ | ||
## v2.2.0 | ||
* [#318](https://github.com/tschaub/gh-pages/pull/318) - Allow an absolute path as dist directory ([@okuryu](https://github.com/okuryu)) | ||
* [#319](https://github.com/tschaub/gh-pages/pull/319) - Added 'remove' documentation to the readme ([@Sag-Dev](https://github.com/Sag-Dev)) | ||
* [#323](https://github.com/tschaub/gh-pages/pull/323) - Update dependencies ([@tschaub](https://github.com/tschaub)) | ||
* [#277](https://github.com/tschaub/gh-pages/pull/277) - Add `--no-history` flag not to preserve deploy history ([@dplusic](https://github.com/dplusic)) | ||
## v2.1.1 | ||
@@ -2,0 +9,0 @@ |
@@ -179,6 +179,11 @@ const cp = require('child_process'); | ||
* @param {string} branch Branch name. | ||
* @param {boolean} force Force push. | ||
* @return {Promise} A promise. | ||
*/ | ||
Git.prototype.push = function(remote, branch) { | ||
return this.exec('push', '--tags', remote, branch); | ||
Git.prototype.push = function(remote, branch, force) { | ||
const args = ['push', '--tags', remote, branch]; | ||
if (force) { | ||
args.push('--force'); | ||
} | ||
return this.exec.apply(this, args); | ||
}; | ||
@@ -217,2 +222,10 @@ | ||
/** | ||
* Delete ref to remove branch history | ||
* @param {string} branch | ||
*/ | ||
Git.prototype.deleteRef = function(branch) { | ||
return this.exec('update-ref', '-d', 'refs/heads/' + branch); | ||
}; | ||
/** | ||
* Clone a repo into the given dir if it doesn't already exist. | ||
@@ -219,0 +232,0 @@ * @param {string} repo Repository URL. |
@@ -36,2 +36,3 @@ const Git = require('./git'); | ||
push: true, | ||
history: true, | ||
message: 'Updates', | ||
@@ -147,2 +148,9 @@ silent: false | ||
.then(git => { | ||
if (!options.history) { | ||
return git.deleteRef(options.branch); | ||
} else { | ||
return git; | ||
} | ||
}) | ||
.then(git => { | ||
if (!options.add) { | ||
@@ -198,3 +206,3 @@ log('Removing files'); | ||
log('Pushing'); | ||
return git.push(options.remote, options.branch); | ||
return git.push(options.remote, options.branch, !options.history); | ||
} else { | ||
@@ -201,0 +209,0 @@ return git; |
const path = require('path'); | ||
const Git = require('./git'); | ||
const async = require('async'); | ||
const fs = require('graceful-fs'); | ||
const fs = require('fs-extra'); | ||
@@ -6,0 +6,0 @@ /** |
{ | ||
"name": "gh-pages", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Publish to a gh-pages branch on GitHub (or any other branch on any other remote)", | ||
@@ -37,14 +37,12 @@ "keywords": [ | ||
"filenamify-url": "^1.0.0", | ||
"fs-extra": "^7.0.0", | ||
"globby": "^6.1.0", | ||
"graceful-fs": "^4.1.11", | ||
"rimraf": "^2.6.2" | ||
"fs-extra": "^8.1.0", | ||
"globby": "^6.1.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"dir-compare": "^1.7.3", | ||
"dir-compare": "^1.8.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-tschaub": "^13.1.0", | ||
"mocha": "^6.1.4", | ||
"sinon": "^7.3.2", | ||
"mocha": "^6.2.2", | ||
"sinon": "^8.0.4", | ||
"tmp": "^0.1.0" | ||
@@ -51,0 +49,0 @@ }, |
@@ -230,3 +230,19 @@ | ||
#### <a id="optionsuser">options.remove</a> | ||
* type: `string` | ||
* default: `'.'` | ||
Removes files that match the given pattern (Ignored if used together with | ||
`--add`). By default, `gh-pages` removes everything inside the target branch | ||
auto-generated directory before copying the new files from `dir`. | ||
Example use of the `remove` option: | ||
```js | ||
ghpages.publish('dist', { | ||
remove: "*.json" | ||
}, callback); | ||
``` | ||
#### <a id="optionspush">options.push</a> | ||
@@ -245,2 +261,15 @@ * type: `boolean` | ||
#### <a id="optionshistory">options.history</a> | ||
* type: `boolean` | ||
* default: `true` | ||
Push force new commit without parent history. | ||
Example use of the `history` option: | ||
```js | ||
ghpages.publish('dist', {history: false}, callback); | ||
``` | ||
#### <a id="optionssilent">options.silent</a> | ||
@@ -330,5 +359,5 @@ * type: `boolean` | ||
When processing `gh-pages` module generate file in`.cache/` and if stuck some reason like wrong password | ||
it will not automatically cleanup | ||
it will not automatically cleanup | ||
Run `~node_modules/gh-pages/bin/gh-pages-clean` | ||
or remove `~node_modules/gh-pages/.cache` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45486
6
751
361
3
+ Addedfs-extra@8.1.0(transitive)
- Removedgraceful-fs@^4.1.11
- Removedrimraf@^2.6.2
- Removedfs-extra@7.0.1(transitive)
- Removedrimraf@2.7.1(transitive)
Updatedfs-extra@^8.1.0