This guide show how the polkadot-angular-identicon
is built for release.
-
Make sure the angular cli is installed or install it with
npm i -g @angular/cli
-
Clone the project
polkadot-angular-identicon
and open it into your favorite IDE. -
Install the project's dependencies for
-
polkadot-angular-identicon
-
polkadot-angular-identicon/project/polkadot-angular-identicon
Under projects the polkadot-angular-identicon
type npm i
From another terminal cd into projects/polkadot-andular-identicon
and type npm i
as well to install the component identicon project's the dependencies
At this point we can build the polkadot-andular-identicon
component. We need to go back to the root polkadot-angular-identicon project in the terminal
Run ng build polkadot-angular-identicon --prod
to build the project. The built artifacts will be stored in the dist/
directory under the folder with the name polkadot-angular-identicon
At this point we have generated files that we can be pulished to npm.
Clone the polkadot-angular-identicon
library project from your IDE if not already done.
- Open the IDE's terminal and type
npm i
to install the root project dependencies - open another terminal from the IDE to install the dependencies of the library itself which is under
projects
folder by navigatingcd project/polkadot-angular-identicon
and typenpm i
At this step all the dependencies are installed for :
-
polkadot-angular-identicon
-
polkadot-angular-identicon/project/polkadot-angular-identicon
.
To run the test make sure we are under polkadot-angular-identicon/project/polkadot-angular-identicon
and type
ng test
command to run the unit tests (Karma
test runner and jasmine
a javascript test framework installed by tdefault when creating the project).
A browser automatically opened under http://localhost:9876/?id=xxxxx
and the results of the tests executed are displayed.
on the terminal side we can see
We might need to stop the test runner server on the terminal.
The business logic of this library is contained in the render-helper.ts
file so unit tests of the business logic for this library is render-helper.spec.ts
.
Also note that the polkadot-web-identicon
is depends on the polkadot-angular-identicon
component so they share the same business logic in the render-helper.ts
then the same unit tests.
Angular is a typescript based framework.
It is worth mentionning that typescript doesn't support .mjs
files extension and the polkadot.js ui shared library tool ships with mjs files extensions.
Also ng-packagr
the library used to build angular libraries also doesn't yet support .mjs files extension
see
Angular and mjs link 1 Angular and mjs link 2
It is for those reason we need to do some modifications in order to use the component in Angular applications.