|
| 1 | +# ngx-deploy-starter: README for contributors |
| 2 | + |
| 3 | +## How to start <a name="start"></a> |
| 4 | + |
| 5 | +tl;dr – execute this: |
| 6 | + |
| 7 | +``` |
| 8 | +cd src |
| 9 | +npm i |
| 10 | +npm run build |
| 11 | +npm test |
| 12 | +``` |
| 13 | + |
| 14 | + |
| 15 | +## Local development <a name="local-dev"></a> |
| 16 | + |
| 17 | +If you want to try the latest package locally without installing it from NPM, use the following instructions. |
| 18 | +This may be useful when you want to try the latest non-published version of this library or you want to make a contribution. |
| 19 | + |
| 20 | +Follow the instructions for [checking and updating the Angular CLI version](#angular-cli) and then link the package. |
| 21 | + |
| 22 | + |
| 23 | +### 1. Angular CLI <a name="angular-cli"></a> |
| 24 | + |
| 25 | +1. Install the next version of the Angular CLI. |
| 26 | + |
| 27 | + ```sh |
| 28 | + npm install -g @angular/cli@next |
| 29 | + ``` |
| 30 | + |
| 31 | +2. Run `ng version`, make sure you have installed Angular CLI v8.3.0-next.0 or greater. |
| 32 | + |
| 33 | +3. Update your existing project using the command: |
| 34 | + |
| 35 | + ```sh |
| 36 | + ng update @angular/cli @angular/core --next=true |
| 37 | + ``` |
| 38 | + |
| 39 | + |
| 40 | +### 2. npm link |
| 41 | + |
| 42 | +Use the following instructions to make `ngx-deploy-starter` available locally via `npm link`. |
| 43 | + |
| 44 | +1. Clone the project |
| 45 | + |
| 46 | + ```sh |
| 47 | + git clone https://github.com/angular-schule/ngx-deploy-starter.git |
| 48 | + cd ngx-deploy-starter |
| 49 | + ``` |
| 50 | + |
| 51 | +2. Install the dependencies |
| 52 | + |
| 53 | + ```sh |
| 54 | + cd src |
| 55 | + npm install |
| 56 | + ``` |
| 57 | + |
| 58 | +3. Build the project: |
| 59 | + |
| 60 | + ```sh |
| 61 | + npm run build |
| 62 | + ``` |
| 63 | + |
| 64 | +4. Create a local npm link: |
| 65 | + |
| 66 | + ```sh |
| 67 | + cd dist |
| 68 | + npm link |
| 69 | + ``` |
| 70 | + |
| 71 | +Read more about the `link` feature in the [official NPM documentation](https://docs.npmjs.com/cli/link). |
| 72 | + |
| 73 | + |
| 74 | +### 3. Adding to an Angular project -- ng add <a name="local-dev-add"></a> |
| 75 | + |
| 76 | +Once you have completed the previous steps to `npm link` the local copy of `ngx-deploy-starter`, follow these steps to use it in a local Angular project. |
| 77 | + |
| 78 | +1. Enter the project directory |
| 79 | + |
| 80 | + ```sh |
| 81 | + cd your-angular-project |
| 82 | + ``` |
| 83 | + |
| 84 | +2. Add the local version of `ngx-deploy-starter`. |
| 85 | + |
| 86 | + ```sh |
| 87 | + npm link ngx-deploy-starter |
| 88 | + ``` |
| 89 | + |
| 90 | +3. Now execute the `ng-add` schematic. |
| 91 | + |
| 92 | + ```sh |
| 93 | + ng add ngx-deploy-starter |
| 94 | + ``` |
| 95 | + |
| 96 | +4. You can now deploy your angular app to GitHub pages. |
| 97 | + |
| 98 | + ```sh |
| 99 | + ng run your-angular-project:deploy |
| 100 | + ``` |
| 101 | + |
| 102 | +5. You can remove the link later by running `npm unlink` |
| 103 | + |
| 104 | + |
| 105 | +### 4. Testing <a name="testing"></a> |
| 106 | + |
| 107 | +Testing is done with [Jest](https://jestjs.io/). |
| 108 | +To run the tests: |
| 109 | + |
| 110 | +```sh |
| 111 | +cd ngx-deploy-starter/src |
| 112 | +npm test |
| 113 | +``` |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | +## Testing the standalone CLI |
| 120 | + |
| 121 | +To quickly test the file `engine.ts` directly, the standalone mode is the best option. |
| 122 | +Use VSCode and debug the task `Launch Standalone Program`. |
| 123 | + |
| 124 | + |
| 125 | +## Publish to NPM |
| 126 | + |
| 127 | +``` |
| 128 | +cd ngx-deploy-starter/src |
| 129 | +npm run build |
| 130 | +npm run test |
| 131 | +npm publish dist |
| 132 | +npm dist-tag add [email protected] next |
| 133 | +``` |
0 commit comments