tl;dr – execute this:
cd src
npm i
npm run build
npm test
If you want to try the latest package locally without installing it from NPM, use the following instructions. This may be useful when you want to try the latest non-published version of this library or you want to make a contribution.
Follow the instructions for checking and updating the Angular CLI version and then link the package.
This builder requires the method getTargetOptions()
from the Angular DevKit which was introduced here.
All Angular projects with Angular 9 and greater are supposed to be compatible. (Actually it works with some versions of 8.x too, but you want to be up to date anyway, don't you?)
Execute the next three steps, if your test project is still older.
-
Install the latest version of the Angular CLI.
npm install -g @angular/cli
-
Run
ng version
, to make sure you have installed Angular v9.0.0 or greater. -
Update your existing project using the command:
ng update @angular/cli @angular/core
Use the following instructions to make @angular-schule/ngx-deploy-starter
available locally via npm link
.
-
Clone the project
git clone https://github.com/angular-schule/ngx-deploy-starter.git cd ngx-deploy-starter
-
Install the dependencies
cd src npm install
-
Build the project:
npm run build
-
Create a local npm link:
cd dist npm link
Read more about the link
feature in the official NPM documentation.
Once you have completed the previous steps to npm link
the local copy of @angular-schule/ngx-deploy-starter
, follow these steps to use it in a local Angular project.
-
Enter the project directory
cd your-angular-project
-
Add the local version of
@angular-schule/ngx-deploy-starter
.npm link @angular-schule/ngx-deploy-starter
-
Now execute the
ng-add
schematic.ng add @angular-schule/ngx-deploy-starter
-
You can now deploy your angular app to GitHub pages.
ng deploy
Or with the old builder syntax:
ng run your-angular-project:deploy
-
You can remove the link later by running
npm unlink
-
We can debug the deployment with VSCode within
your-angular-project
, too. Go toyour-angular-project/node_modules/@angular-schule/ngx-deploy-starter/deploy/actions.js
and place a breakpoint there. Now you can debug with the followinglaunch.json
file:{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Debug ng deploy", "skipFiles": ["<node_internals>/**"], "program": "${workspaceFolder}/node_modules/@angular/cli/bin/ng", "cwd": "${workspaceFolder}", "sourceMaps": true, "args": ["deploy", "--no-build"] } ] }
Testing is done with Jest. To run the tests:
cd ngx-deploy-starter/src
npm test
To debug your deployer you need to:
-
Place
debugger
statement, where you want your deployer stops. -
Follow the steps of npm link described here. compile, link and install linked in a local project
-
Now, on the project that you linked the deployer, run it on debug mode using:
-
Normal Command Command on Debug Mode ng deploy
node --inspect-brk ./node_modules/@angular/cli/bin/ng deploy
ng add YOUR_DEPLOYER
node --inspect-brk ./node_modules/@angular/cli/bin/ng add YOUR_DEPLOYER
-
-
Use your favorite Inspector Client to debug
This is the standard procedure to debug a NodeJs project. If you need more information you can read the official Docs of NodeJs to learn more about it.
https://nodejs.org/de/docs/guides/debugging-getting-started/
cd ngx-deploy-starter/src
npm run prettier
npm run build
npm run test
npm publish dist --access public
ngx-deploy-starter and angular-cli-ghpages (both developed by Johannes Hoppe) are follow-up projects of the deprecated ngx-gh demo. This project was a follow-up of the deploy schematics from the angularfire project.
To stay in sync with the stuff the Angular team is doing, you might want to keep an eye on the following files: