1 | # @mello-labs/api-tools
|
2 |
|
3 | ## Installation
|
4 |
|
5 | To install this library, run:
|
6 |
|
7 | ```bash
|
8 | $ npm install @mello-labs/api-tools --save
|
9 | ```
|
10 |
|
11 | ## Consuming your library
|
12 |
|
13 | Once you have published your library to npm, you can import your library in any Angular application by running:
|
14 |
|
15 | ```bash
|
16 | $ npm install @mello-labs/api-tools
|
17 | ```
|
18 |
|
19 | and then from your Angular `AppModule`:
|
20 |
|
21 | ```typescript
|
22 | import { BrowserModule } from '@angular/platform-browser';
|
23 | import { NgModule } from '@angular/core';
|
24 |
|
25 | import { AppComponent } from './app.component';
|
26 |
|
27 | // Import your library
|
28 | import { SampleModule } from '@mello-labs/api-tools';
|
29 |
|
30 | @NgModule({
|
31 | declarations: [
|
32 | AppComponent
|
33 | ],
|
34 | imports: [
|
35 | BrowserModule,
|
36 |
|
37 | // Specify your library as an import
|
38 | LibraryModule
|
39 | ],
|
40 | providers: [],
|
41 | bootstrap: [AppComponent]
|
42 | })
|
43 | export class AppModule { }
|
44 | ```
|
45 |
|
46 | Once your library is imported, you can use its components, directives and pipes in your Angular application:
|
47 |
|
48 | ```xml
|
49 | <!-- You can now use your library component in app.component.html -->
|
50 | <h1>
|
51 | {{title}}
|
52 | </h1>
|
53 | <sampleComponent></sampleComponent>
|
54 | ```
|
55 |
|
56 | ## Development
|
57 |
|
58 | To generate all `*.js`, `*.d.ts` and `*.metadata.json` files:
|
59 |
|
60 | ```bash
|
61 | $ npm run build
|
62 | ```
|
63 |
|
64 | To lint all `*.ts` files:
|
65 |
|
66 | ```bash
|
67 | $ npm run lint
|
68 | ``` |
\ | No newline at end of file |