|
2 | 2 | [![NPM version][npm-image]][npm-url]
|
3 | 3 | [](https://circleci.com/gh/angular-schule/angular-cli-ghpages)
|
4 | 4 |
|
| 5 | +<!-- |
| 6 | +TODO: cool screenshot with animated gif |
5 | 7 | <hr>
|
6 |
| - |
7 |
| - |
| 8 | +  |
| 9 | + --> |
8 | 10 |
|
9 | 11 | <hr>
|
10 | 12 |
|
11 | 13 | Deploy your Angular app to GitHub pages directly from the Angular CLI! 🚀
|
12 |
| -Brought to you by the [angular.schule](https://angular.schule/) team! |
13 |
| - |
14 |
| -## Changelog |
15 |
| - |
16 |
| -A detailed changelog is available in the [releases](https://github.com/angular-schule/angular-cli-ghpages/releases) section. |
17 |
| - |
18 |
| -<!-- |
19 |
| -## Installation & Setup |
20 |
| -
|
21 |
| -This command has the following prerequisites: |
22 |
| -
|
23 |
| -- `Node.js 8.2.0` or higher which brings you `npm 5.2.0` which brings you [`npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) |
24 |
| -- Git 1.7.6 or higher |
25 |
| -- __optional__: Angular project created via [angular-cli](https://github.com/angular/angular-cli) |
26 |
| -
|
27 |
| -To install the command run the following: |
28 |
| -
|
29 |
| -```bash |
30 |
| -npm i angular-cli-ghpages --save-dev |
31 |
| -``` |
32 |
| -
|
33 |
| -Note: you can skip the permanent installation, too. The command `npx` is also able to install `angular-cli-ghpages` on the first usage, if you want. |
34 |
| -
|
35 |
| -## Usage |
36 |
| -
|
37 |
| -Execute `npx angular-cli-ghpages` in order to deploy the project with a build from `dist` folder. |
38 |
| -__Note: you have to create the `dist` folder in before (e.g. `ng build --prod`)__ |
39 |
| -
|
40 |
| -Usage: |
41 |
| -
|
42 |
| -```bash |
43 |
| -ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY_NAME/" |
44 |
| -npx angular-cli-ghpages [OPTIONS] |
45 |
| -``` |
46 |
| -
|
47 |
| -or |
48 |
| -
|
49 |
| -```bash |
50 |
| -ng build --prod --base-href "/REPOSITORY_NAME/" |
51 |
| -npx angular-cli-ghpages [OPTIONS] |
52 |
| -``` |
53 |
| -
|
54 |
| -or (`<base href="/">` stays untouched) |
55 |
| -
|
56 |
| -```bash |
57 |
| -ng build --prod |
58 |
| -npx angular-cli-ghpages [OPTIONS] |
59 |
| -``` |
60 |
| -
|
61 |
| -If you want to push to `gh-pages` on the same repository with your default credentials, then just enter `npx angular-cli-ghpages` without any options. |
62 |
| -
|
63 |
| -
|
64 |
| -### Usage with Angular CLI 6 or higher |
65 |
| -
|
66 |
| -With Angular CLI 6 the build artifacts will be put in a subfolder under `dist`. |
67 |
| -Please take a look at the `dist` folder to see whether there is a subfolder with your project's name or not. |
68 |
| -If yes, you need to specify the deploy directory manually then when using this tool: |
69 |
| -
|
70 |
| -```bash |
71 |
| -npx angular-cli-ghpages --dir=dist/[PROJECTNAME] |
72 |
| -``` |
73 |
| -
|
74 |
| -I most cases, the `[PROJECTNAME]` can be found in the `angular.json` file at `defaultProject`. |
75 |
| -
|
76 |
| -
|
77 |
| -### Usage with Ionic |
78 |
| -
|
79 |
| -You can use the tool with Angular based Ionic projects, too. Instead of the ` dist` folder, the Ionic CLI will create a `www` folder you have to point the tool to. Just use the following commands: |
80 | 14 |
|
81 |
| -```bash |
82 |
| -ionic build --prod -- --base-href=https://USERNAME.github.io/REPOSITORY_NAME/` |
83 |
| -``` |
84 | 15 |
|
85 |
| -```bash |
86 |
| -npx angular-cli-ghpages --dir=www |
87 |
| -``` |
| 16 | +## 📖 Changelog <a name="changelog"></a> |
88 | 17 |
|
| 18 | +A detailed changelog is available in the [releases](https://github.com/angular-schule/angular-cli-ghpages/releases) section. |
89 | 19 |
|
| 20 | +In the past this project was a standalone program. |
| 21 | +This is still possible. |
| 22 | +See the documentation at (https://github.com/angular-schule/angular-cli-ghpages/blob/master/README_standalone.md)[README_standalone]. |
90 | 23 |
|
91 |
| -## Extra |
92 |
| -
|
93 |
| -For your convenience, the command will recognize the [environment variable](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings) `GH_TOKEN` and will replace this pattern in the `--repo` string. Please __do NOT disable the silent mode__ if you have any credentials in the repository URL! Read more about [Github tokens here](https://help.github.com/articles/creating-an-access-token-for-command-line-use/). |
94 |
| -
|
95 |
| -In example, the following command runs [on our Travis-CI](https://travis-ci.org/angular-buch/book-monkey2): |
96 |
| -
|
97 |
| -```bash |
98 |
| -npx angular-cli-ghpages --repo=https://[email protected]/organisation/your-repo.git --name="Displayed Username" [email protected] |
99 |
| -``` |
100 |
| -> You have to treat the GH_TOKEN as secure as a password! |
101 |
| -
|
102 |
| -
|
103 |
| -
|
104 |
| -## Options |
105 |
| -
|
106 |
| -#### <a id="help">--help</a> |
107 |
| - * Example: `npx angular-cli-ghpages --help` |
108 |
| -
|
109 |
| -Output usage information. |
110 |
| -
|
111 |
| -
|
112 |
| -#### <a id="version">--version</a> |
113 |
| - * Example: `npx angular-cli-ghpages --version` |
114 |
| -
|
115 |
| -Output the version number. Please provide the version number on any bug report! |
116 |
| -
|
117 |
| -
|
118 |
| -#### <a id="repo">--repo</a> |
119 |
| - * __optional__ |
120 |
| - * Default: url of the origin remote of the current dir (assumes a git repository) |
121 |
| - * Example: `npx angular-cli-ghpages --repo=https://[email protected]/organisation/your-repo.git` |
122 |
| -
|
123 |
| -By default, __gh-pages__ assumes that the current working directory is a git repository, |
124 |
| -and that you want to push changes to the `origin` remote. |
125 |
| -If instead your files are not in a git repository, or if you want to push to another repository, |
126 |
| -you can provide the repository URL in the `repo` option. |
127 |
| -
|
128 |
| -
|
129 |
| -#### <a id="message">--message</a> |
130 |
| - * __optional__ |
131 |
| - * Default: `Auto-generated commit` |
132 |
| - * Example: `npx angular-cli-ghpages --message="What could possibly go wrong?"` |
133 |
| -
|
134 |
| -The commit message, __must be wrapped in quotes__. |
135 |
| -Some handy additional text is always added, |
136 |
| -if the environment variable `process.env.TRAVIS` exists (for Travis CI). |
137 |
| -
|
138 |
| -
|
139 |
| -#### <a id="branch">--branch</a> |
140 |
| - * __optional__ |
141 |
| - * Default: `gh-pages` |
142 |
| - * Example: `npx angular-cli-ghpages --branch=other-branch` |
143 |
| - |
144 |
| -The name of the branch you'll be pushing to. |
145 |
| -The default uses GitHub's `gh-pages` branch, |
146 |
| -but this can be configured to push to any branch on any remote. |
147 |
| -
|
148 |
| -
|
149 |
| -#### <a id="name">--name & --email</a> |
150 |
| - * __optional__ |
151 |
| - * Default: value of `git config user.name` and `git config user.email` |
152 |
| - * Example: `npx angular-cli-ghpages --name="Displayed Username" [email protected]` |
153 |
| -
|
154 |
| -If you are running the command in a repository without a `user.name` or `user.email` git config properties |
155 |
| -(or on a machine without these global config properties), |
156 |
| -you must provide user info before git allows you to commit. |
157 |
| -In this case provide both `name` and `email` string values to identify the committer. |
158 |
| -
|
159 |
| -
|
160 |
| -#### <a id="no-silent">--no-silent</a> |
161 |
| - * __optional__ |
162 |
| - * Default: silent `true` (boolean) |
163 |
| - * Example: |
164 |
| - * `npx angular-cli-ghpages` -- Logging is in silent mode by default. |
165 |
| - * `npx angular-cli-ghpages --no-silent` -- Logging shows extended information. |
166 |
| -
|
167 |
| -Logging is in silent mode by default. |
168 |
| -In silent mode log messages are suppressed and error messages are sanitized. |
169 |
| -
|
170 |
| -The `--no-silent` option enables extended console logging. |
171 |
| -Keep this untouched if the repository URL or other information passed to git commands is sensitive! |
172 |
| -
|
173 |
| -> WARNING: This option should kept like it is if the repository URL or other information passed to git commands is sensitive and should not be logged (== you have a public build server). By default the silent mode is enabled to avoid sensitive data exposure. |
174 | 24 |
|
| 25 | +## ⚠️ Prerequisites <a name="prerequisites"></a> |
175 | 26 |
|
176 |
| -#### <a id="dir">--dir</a> |
177 |
| - * __optional__ |
178 |
| - * Default: `dist` |
| 27 | +This action has the following prerequisites: |
179 | 28 |
|
180 |
| -Directory for all published sources, relative to the project-root. |
181 |
| -__Starting with Angular CLI 6 the build artifacts will be put in a subfolder under `dist`. |
182 |
| -Please take a look at the `dist` folder to see whether there is a subfolder with your project's name or not.__ |
| 29 | +- Git 1.9 or higher (execute `git --version` to check your version) |
| 30 | +- Angular project created via [Angular CLI](https://github.com/angular/angular-cli) |
183 | 31 |
|
184 |
| -This option can be used to deploy completely different folders, |
185 |
| -which are not related at all to angular. |
186 | 32 |
|
| 33 | +## 🚀 Quick-start <a name="quickstart"></a> |
187 | 34 |
|
| 35 | +1. Install the next version of the Angular CLI (v8.3.0-next.0 or greater) |
| 36 | + and create a new Angular project. |
188 | 37 |
|
189 |
| -#### <a id="no-dotfiles">--no-dotfiles</a> |
190 |
| - * __optional__ |
191 |
| - * Default: dotfiles `true` (boolean) |
192 |
| - * Example: |
193 |
| - * `npx angular-cli-ghpages` -- Dotfiles are included by default. |
194 |
| - * `npx angular-cli-ghpages --no-dotfiles` -- Dotfiles are ignored. |
| 38 | + ```sh |
| 39 | + npm install -g @angular/cli@next |
| 40 | + ng new hello-world --defaults |
| 41 | + cd hello-world |
| 42 | + ``` |
195 | 43 |
|
196 |
| -The command includes dotfiles by default (e.g `.htaccess` will be committed) |
197 |
| -With `--no-dotfiles` files starting with `.` are ignored. |
| 44 | +2. Add `angular-cli-ghpages` to your project. |
198 | 45 |
|
| 46 | + ```sh |
| 47 | + ng add angular-cli-ghpages |
| 48 | + ``` |
199 | 49 |
|
| 50 | +3. Deploy your project to Github pages with all default settings. |
| 51 | + Your project will be automatically build in production mode. |
200 | 52 |
|
201 |
| -#### <a id="dry-run">--dry-run</a> |
202 |
| - * __optional__ |
203 |
| - * Default: `undefined` |
204 |
| - * Example: |
205 |
| - * `npx angular-cli-ghpages` -- Normal behaviour: Changes are applied. |
206 |
| - * `npx angular-cli-ghpages --dry-run` -- No changes are applied at all. |
| 53 | + ```sh |
| 54 | + ng run hello-world:deploy |
| 55 | + ``` |
207 | 56 |
|
208 |
| -Run through without making any changes. This can be very usefull, because it outputs what would happend without doing anything. |
| 57 | +## 🏁 Next milestones <a name="milestones"></a> |
209 | 58 |
|
210 |
| -#### <a id="cname">--cname</a> |
211 |
| - * __optional__ |
212 |
| - * Default: `No CNAME file is generated` |
213 |
| - * Example: |
214 |
| - * `npx angular-cli-ghpages --cname=example.com` |
| 59 | +We are glad that we have an integration into the CLI again. |
| 60 | +But we are looking forward to the following features: |
215 | 61 |
|
216 |
| -A CNAME file will be created enabling you to use a custom domain. [More information on Github Pages using a custom domain](https://help.github.com/articles/using-a-custom-domain-with-github-pages/). |
| 62 | +* an interactive command-line prompt that guides you through the available options and outputs a `angular-cli-ghpages.json` file |
217 | 63 |
|
218 |
| ---> |
| 64 | +We look forward to any help. PRs are welcome! |
219 | 65 |
|
220 |
| -## FAQ |
| 66 | +## ⁉️ FAQ <a name="faq"></a> |
221 | 67 |
|
222 | 68 | Before posting any issue, [please read the FAQ first](https://github.com/angular-schule/angular-cli-ghpages/wiki/FAQ).
|
223 | 69 |
|
|
0 commit comments