angular-cli-ghpages
Advanced tools
Comparing version
73
index.js
@@ -1,9 +0,70 @@ | ||
module.exports = { | ||
name: 'angular-cli-ghpages', | ||
var path = require('path'), | ||
fs = require('fs'), | ||
ghpages = require('gh-pages'), | ||
denodeify = require('denodeify'); | ||
includedCommands: function() { | ||
return { | ||
'ghpages': require('./deploy'), | ||
}; | ||
exports.run = function (options) { | ||
options = options || {}; | ||
if (options.silent === undefined) { | ||
options.silent = true; | ||
} | ||
if (options.dotfiles === undefined) { | ||
options.dotfiles = true; | ||
} | ||
if (options['name'] && options['email']) { | ||
options.user = { | ||
name: options['name'], | ||
email: options['email'] | ||
} | ||
}; | ||
// gh-pages: forwards messages to console | ||
options.logger = function (message) { console.log(message + "\n"); } | ||
var dir = path.join(process.cwd(), options.dir); | ||
if (process.env.TRAVIS) { | ||
options.message += '\n\n' + | ||
'Triggered by commit: https://github.com/' + process.env.TRAVIS_REPO_SLUG + '/commit/' + process.env.TRAVIS_COMMIT + '\n' + | ||
'Travis build: https://travis-ci.org/' + process.env.TRAVIS_REPO_SLUG + '/builds/' + process.env.TRAVIS_BUILD_ID; | ||
} | ||
// for your convenience - here you can hack credentials into the repository URL | ||
if (process.env.GH_TOKEN && options.repo) { | ||
options.repo = options.repo.replace('GH_TOKEN', process.env.GH_TOKEN); | ||
} | ||
// always clean the cache directory. | ||
// avoids "Error: Remote url mismatch." | ||
ghpages.clean(); | ||
var access = publish = denodeify(fs.access); | ||
var publish = denodeify(ghpages.publish); | ||
function go() { | ||
return Promise.resolve(); | ||
} | ||
return go() | ||
.then(function () { | ||
return access(dir, fs.F_OK) | ||
}) | ||
.catch(function (error) { | ||
console.error('Dist folder does not exist. Check the dir --dir parameter or build the project first!\n'); | ||
return Promise.reject(error); | ||
}) | ||
.then(function () { | ||
return publish(dir, options) | ||
}) | ||
.then(function () { | ||
console.log('Successfully published!\n'); | ||
}) | ||
.catch(function (error) { | ||
console.error('An error occurred!\n'); | ||
return Promise.reject(error); | ||
}); | ||
}; |
{ | ||
"name": "angular-cli-ghpages", | ||
"version": "0.3.3", | ||
"description": "Angular CLI addon. Publish to any gh-pages branch on GitHub (or any other branch on any other remote).", | ||
"version": "0.4.0", | ||
"description": "Wrapper around gh-pages, made for angular-cli users. Publish to any gh-pages branch on GitHub (or any other branch on any other remote).", | ||
"main": "index.js", | ||
"bin": { | ||
"angular-cli-ghpages": "bin/angular-cli-ghpages", | ||
"ngh": "bin/angular-cli-ghpages" | ||
}, | ||
"repository": { | ||
@@ -16,26 +21,9 @@ "type": "git", | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "johanneshoppe", | ||
"email": "johannes.hoppe@haushoppe-its.de" | ||
}, | ||
{ | ||
"name": "fmalcher", | ||
"email": "mail@ferdinand-malcher.de" | ||
}, | ||
{ | ||
"name": "d-koppenhagen", | ||
"email": "mail@d-koppenhagen.de" | ||
}, | ||
{ | ||
"name": "gregonnet", | ||
"email": "gregor.woiwode@gmail.com" | ||
} | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"gh-pages": "^0.11.0", | ||
"denodeify": "^1.2.1" | ||
"gh-pages": "~0.12.0", | ||
"denodeify": "~1.2.1", | ||
"commander": "~2.9.0" | ||
}, | ||
"keywords": ["ember-addon", "angular2", "angular-cli", "git", "github pages", "gh-pages", "ghpages", "angular-cli-ghpages", "angular-cli-github-pages"] | ||
"keywords": ["angular2", "angular-cli", "git", "github pages", "gh-pages", "ghpages", "angular-cli-ghpages", "angular-cli-github-pages"] | ||
} |
@@ -10,3 +10,6 @@ # angular-cli-ghpages | ||
Angular CLI addon. Publish to any gh-pages branch on GitHub (or any other branch on any other remote). | ||
This __was__ an angular CLI addon (until they [removed addon support](https://github.com/angular/angular-cli/pull/3695)). | ||
Now it's just a wrapper around [tschaub/gh-pages](https://github.com/tschaub/gh-pages). | ||
Publish to any gh-pages branch on GitHub (or any other branch on any other remote). | ||
Made for Travis-CI. Brought to you by the [angular-buch.com](https://angular-buch.com/) team! | ||
@@ -16,11 +19,9 @@ | ||
This is similar to the normal `github-pages:deploy` command. | ||
This script is similar to the normal `github-pages:deploy` command. | ||
But by design, the command is limited to the `gh-pages` branch of the same repository. | ||
In contrast to this, the [angular-buch/angular-cli-ghpages](https://github.com/angular-buch/angular-cli-ghpages) addon is able to push to any branch on any repository. It's made on top of [tschaub/gh-pages](https://github.com/tschaub/gh-pages). | ||
__This addon works great on [Travis-CI](https://travis-ci.org/).__ No git credentials must be set up in before. Specific environment variables of Travis-CI are evaluated, too. You will like it! | ||
In contrast to this, the [angular-buch/angular-cli-ghpages](https://github.com/angular-buch/angular-cli-ghpages) script is able to push to any branch on any repository. It's made on top of [tschaub/gh-pages](https://github.com/tschaub/gh-pages). | ||
__This script works great on [Travis-CI](https://travis-ci.org/).__ No git credentials must be set up in before. Specific environment variables of Travis-CI are evaluated, too. You will like it! | ||
angular-cli-ghpages was sucessfully tested against __`angular-cli@1.0.0-beta.22-1`__. | ||
## Installation & Setup | ||
@@ -32,3 +33,3 @@ | ||
- Git 1.7.6 or higher | ||
- Angular project created via [angular-cli](https://github.com/angular/angular-cli) | ||
- Optional: Angular project created via [angular-cli](https://github.com/angular/angular-cli) | ||
@@ -38,4 +39,3 @@ To install this addon run the following command: | ||
```sh | ||
cd <your-angular-cli-project> | ||
npm install angular-cli-ghpages --save-dev | ||
npm i -g angular-cli-ghpages | ||
``` | ||
@@ -45,3 +45,3 @@ | ||
Execute `ng ghpages` in order to deploy the project with a build from `dist` folder. | ||
Execute `angular-cli-ghpages` in order to deploy the project with a build from `dist` folder. | ||
Note: you have to create the folder in before (e.g. `ng build --prod`) | ||
@@ -52,5 +52,11 @@ | ||
```sh | ||
ng ghpages [OPTIONS] | ||
angular-cli-ghpages [OPTIONS] | ||
``` | ||
there is also a shorter `ngh` command available | ||
```sh | ||
ngh [OPTIONS] | ||
``` | ||
## Options | ||
@@ -73,3 +79,3 @@ | ||
```sh | ||
ng ghpages --message="What could possibly go wrong?" | ||
angular-cli-ghpages --message="What could possibly go wrong?" | ||
``` | ||
@@ -126,3 +132,3 @@ | ||
```sh | ||
ng ghpages --repo=https://GH_TOKEN@github.com/organisation/your-repo.git --name="Displayed Username" --email=mail@example.orf | ||
angular-cli-ghpages --repo=https://GH_TOKEN@github.com/organisation/your-repo.git --name="Displayed Username" --email=mail@example.orf | ||
``` | ||
@@ -129,0 +135,0 @@ > You have to treat the GH_TOKEN as secure as a password! |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
135
4.65%25808
-5.26%3
50%57
-52.1%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated