|
sfcode
An Online Competing and Development Environment
|
Publish files to a gh-pages branch on GitHub (or any other branch anywhere else).
This module requires Git >=1.9.
Calling this function will create a temporary clone of the current repository, create a gh-pages branch if one doesn't already exist, copy over all files from the base path, or only those that match patterns from the optional src configuration, commit all changes, and push to the origin remote.
If a gh-pages branch already exists, it will be updated with all commits from the remote before adding any commits from the provided src files.
Note that any files in the gh-pages branch that are not in the src files will be removed. See the add option if you don't want any of the existing files removed.
stringThe base directory for all source files (those listed in the src config property).
Example use:
The default options work for simple cases. The options described below let you push to alternate branches, customize your commit messages, and more.
string|Array<string>The minimatch pattern or array of patterns used to select which files should be published.
stringThe name of the branch you'll be pushing to. The default uses GitHub's gh-pages branch, but this can be configured to push to any branch on any remote.
Example use of the branch option:
stringThe destination folder within the destination branch. By default, all files are published to the root of the repository.
Example use of the dest option:
booleanfalseInclude dotfiles. By default, files starting with . are ignored unless they are explicitly provided in the src array. If you want to also include dotfiles that otherwise match your src patterns, set dotfiles: true in your options.
Example use of the dotfiles option:
booleanfalseOnly add, and never remove existing files. By default, existing files in the target branch are removed before adding the ones from your src config. If you want the task to add new src files but leave existing ones untouched, set add: true in your options.
Example use of the add option:
stringBy default, gh-pages assumes that the current working directory is a git repository, and that you want to push changes to the origin remote.
If instead your script is not in a git repository, or if you want to push to another repository, you can provide the repository URL in the repo option.
Example use of the repo option:
stringThe name of the remote you'll be pushing to. The default is your ‘'origin’` remote, but this can be configured to push to any remote.
Example use of the remote option:
stringCreate a tag after committing changes on the target branch. By default, no tag is created. To create a tag, provide the tag name as the option value.
stringThe commit message for all commits.
Example use of the message option:
ObjectnullIf you are running the gh-pages task in a repository without a user.name or user.email git config properties (or on a machine without these global config properties), you must provide user info before git allows you to commit. The options.user object accepts name and email string values to identify the committer.
Example use of the user option:
stringRemoves 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:
booleantruePush branch to remote. To commit only (with no push) set to false.
Example use of the push option:
booleantruePush force new commit without parent history.
Example use of the history option:
booleanfalseAvoid showing repository URLs or other information in errors.
Example use of the silent option:
stringYour git executable.
Example use of the git option:
Installing the package creates a gh-pages command line utility. Run gh-pages --help to see a list of supported options.
With a local install of gh-pages, you can set up a package script with something like the following:
And then to publish everything from your dist folder to your gh-pages branch, you'd run this:
To get additional output from the gh-pages script, set NODE_DEBUG=gh-pages. For example:
Note that this plugin requires Git 1.9 or higher (because it uses the --exit-code option for git ls-remote). If you'd like to see this working with earlier versions of Git, please open an issue.
When processing gh-pages module generate file in<tt>.cache/ and if stuck some reason like wrong password it will not automatically cleanup
Run ~node_modules/gh-pages/bin/gh-pages-clean or remove ~node_modules/gh-pages/.cache