Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tschaub/gh-pages
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.1.1
Choose a base ref
...
head repository: tschaub/gh-pages
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.2.0
Choose a head ref
  • 12 commits
  • 9 files changed
  • 5 contributors

Commits on Oct 4, 2019

  1. Allow an absolute path as dist directory

    Fixes: #317
    okuryu committed Oct 4, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    okuryu Ryuichi Okumura
    Copy the full SHA
    1f0e59f View commit details

Commits on Oct 6, 2019

  1. Added 'remove' documentation to 'readme.md'

    Sergio Abreu García committed Oct 6, 2019
    Copy the full SHA
    a5f6b56 View commit details

Commits on Dec 6, 2019

  1. Use path.resolve() instead

    okuryu committed Dec 6, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    okuryu Ryuichi Okumura
    Copy the full SHA
    1f313c7 View commit details

Commits on Jan 6, 2020

  1. Copy the full SHA
    e73d921 View commit details

Commits on Jan 7, 2020

  1. Merge pull request #277 from dplusic/feature/no-history

    cli: add `--no-history` flag not to preserve deploy history
    tschaub authored Jan 7, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6b87c84 View commit details
  2. Update dev dependencies

    tschaub committed Jan 7, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    tschaub Tim Schaub
    Copy the full SHA
    f6bb57b View commit details
  3. Update dependencies

    tschaub committed Jan 7, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    tschaub Tim Schaub
    Copy the full SHA
    3dcf9ea View commit details
  4. Merge pull request #323 from tschaub/updates

    Update dependencies
    tschaub authored Jan 7, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ff212fe View commit details
  5. Merge pull request #319 from Sag-Dev/master

    Added 'remove' documentation to the readme
    tschaub authored Jan 7, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    169f29b View commit details
  6. Merge pull request #318 from okuryu/dist

    Allow an absolute path as dist directory
    tschaub authored Jan 7, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5bf8204 View commit details
  7. Log changes

    tschaub committed Jan 7, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    tschaub Tim Schaub
    Copy the full SHA
    8bb003c View commit details
  8. 2.2.0

    tschaub committed Jan 7, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    tschaub Tim Schaub
    Copy the full SHA
    a8478a8 View commit details
Showing with 568 additions and 489 deletions.
  1. +6 −1 bin/gh-pages.js
  2. +7 −0 changelog.md
  3. +15 −2 lib/git.js
  4. +9 −1 lib/index.js
  5. +1 −1 lib/util.js
  6. +489 −475 package-lock.json
  7. +6 −8 package.json
  8. +30 −1 readme.md
  9. +5 −0 test/bin/gh-pages.spec.js
7 changes: 6 additions & 1 deletion bin/gh-pages.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ const addr = require('email-addresses');

function publish(config) {
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 => {
if (err) {
return reject(err);
@@ -66,6 +66,10 @@ function main(args) {
ghpages.defaults.only
)
.option('-n, --no-push', 'Commit only (with no push)')
.option(
'-f, --no-history',
'Push force new commit without parent history'
)
.parse(args);

let user;
@@ -95,6 +99,7 @@ function main(args) {
only: program.remove,
remote: program.remote,
push: !!program.push,
history: !!program.history,
user: user
};

7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 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

* [#312](https://github.com/tschaub/gh-pages/pull/312) - Add default for '--git' option ([@tschaub](https://github.com/tschaub))
17 changes: 15 additions & 2 deletions lib/git.js
Original file line number Diff line number Diff line change
@@ -176,10 +176,15 @@ Git.prototype.tag = function(name) {
* Push a branch.
* @param {string} remote Remote alias.
* @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);
};

/**
@@ -212,6 +217,14 @@ Git.prototype.getRemoteUrl = function(remote) {
});
};

/**
* 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.
* @param {string} repo Repository URL.
10 changes: 9 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ exports.defaults = {
src: '**/*',
only: '.',
push: true,
history: true,
message: 'Updates',
silent: false
};
@@ -142,6 +143,13 @@ exports.publish = function publish(basePath, config, callback) {
log('Checking out %s/%s ', options.remote, options.branch);
return git.checkout(options.remote, options.branch);
})
.then(git => {
if (!options.history) {
return git.deleteRef(options.branch);
} else {
return git;
}
})
.then(git => {
if (!options.add) {
log('Removing files');
@@ -193,7 +201,7 @@ exports.publish = function publish(basePath, config, callback) {
.then(git => {
if (options.push) {
log('Pushing');
return git.push(options.remote, options.branch);
return git.push(options.remote, options.branch, !options.history);
} else {
return git;
}
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
const Git = require('./git');
const async = require('async');
const fs = require('graceful-fs');
const fs = require('fs-extra');

/**
* Generate a list of unique directory paths given a list of file paths.
Loading