Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/smikodanic/ngboost

Angular boosting libraries.
https://github.com/smikodanic/ngboost

Last synced: 15 days ago
JSON representation

Angular boosting libraries.

Awesome Lists containing this project

README

        

# Ngboost
> Angular boosting libraries

## List of libraries
- [ngboost-auth](https://www.npmjs.com/package/ngboost-auth) - authentication module
- [ngboost-cookies](https://www.npmjs.com/package/ngboost-cookies) - manipulate with browser cookies

## Angular - create NPM library
SUBJECT: How to pack angular code into library which can be published to NPM.

### Prerequisites:
$ sudo npm install -g @angular/cli
- nodejs v15+

### Procedure:
```bash
$ ng new ngboost --no-create-application
$ cd ngboost
$ ng generate library ngboost-auth
```

The projects/ngboost-auth folder is created.
In the /src/ folder place the angular library code.
In file projects/ngboost-auth/src/public-api.ts define what will be exported, for example:
```javascript
export { AuthService } from './auth.service';
export { JwtTokenInterceptor } from './jwtTokenInterceptor.service';
export { IsLoggedService } from './routeGuards/isLogged.service';
export { HasRoleService } from './routeGuards/hasRole.service';
export { AutologinService } from './routeGuards/autoLogin.service';
```

Now when all code is ready build it with:
```bash
$ ng build ngboost-auth
```

To publish it do:
```bash
$ cd dist/ngboost-auth
$ npm publish
```

### Update to new Angular version
```
// update angular
ng update @angular/core@17 @angular/cli@17

// re-build every project
ng build ngboost-auth
ng build ngboost-cookies

// publish to npm
cd dist/ngboost-auth
npm version minor
npm publish

cd dist/ngboost-cookies
npm version minor
npm publish
```