Skip to content

Commit

Permalink
fix: rename library from jwt-auth to ngx-jwt-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
uzenith360 committed Jan 27, 2023
1 parent 4069fec commit 8497419
Show file tree
Hide file tree
Showing 58 changed files with 87 additions and 99 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ngx-jwt-auth
# ngx-ngx-jwt-auth

An Angular JWT authentication library with authentication service, route guard, interceptor and login modal to get your Angular app authentication setup in a breeze 🌬️

Expand Down
48 changes: 24 additions & 24 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"jwt-auth": {
"ngx-jwt-auth": {
"projectType": "library",
"root": "projects/jwt-auth",
"sourceRoot": "projects/jwt-auth/src",
"root": "projects/ngx-jwt-auth",
"sourceRoot": "projects/ngx-jwt-auth/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/jwt-auth/ng-package.json"
"project": "projects/ngx-jwt-auth/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/jwt-auth/tsconfig.lib.prod.json"
"tsConfig": "projects/ngx-jwt-auth/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/jwt-auth/tsconfig.lib.json"
"tsConfig": "projects/ngx-jwt-auth/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "projects/jwt-auth/tsconfig.spec.json",
"tsConfig": "projects/ngx-jwt-auth/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
Expand All @@ -36,30 +36,30 @@
}
}
},
"jwt-auth-example-app": {
"ngx-jwt-auth-example-app": {
"projectType": "application",
"schematics": {},
"root": "projects/jwt-auth-example-app",
"sourceRoot": "projects/jwt-auth-example-app/src",
"root": "projects/ngx-jwt-auth-example-app",
"sourceRoot": "projects/ngx-jwt-auth-example-app/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/jwt-auth-example-app",
"index": "projects/jwt-auth-example-app/src/index.html",
"main": "projects/jwt-auth-example-app/src/main.ts",
"outputPath": "dist/ngx-jwt-auth-example-app",
"index": "projects/ngx-jwt-auth-example-app/src/index.html",
"main": "projects/ngx-jwt-auth-example-app/src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "projects/jwt-auth-example-app/tsconfig.app.json",
"tsConfig": "projects/ngx-jwt-auth-example-app/tsconfig.app.json",
"assets": [
"projects/jwt-auth-example-app/src/favicon.ico",
"projects/jwt-auth-example-app/src/assets"
"projects/ngx-jwt-auth-example-app/src/favicon.ico",
"projects/ngx-jwt-auth-example-app/src/assets"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"projects/jwt-auth-example-app/src/styles.css"
"projects/ngx-jwt-auth-example-app/src/styles.css"
],
"scripts": []
},
Expand Down Expand Up @@ -94,18 +94,18 @@
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "jwt-auth-example-app:build:production"
"browserTarget": "ngx-jwt-auth-example-app:build:production"
},
"development": {
"browserTarget": "jwt-auth-example-app:build:development"
"browserTarget": "ngx-jwt-auth-example-app:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "jwt-auth-example-app:build"
"browserTarget": "ngx-jwt-auth-example-app:build"
}
},
"test": {
Expand All @@ -115,14 +115,14 @@
"zone.js",
"zone.js/testing"
],
"tsConfig": "projects/jwt-auth-example-app/tsconfig.spec.json",
"tsConfig": "projects/ngx-jwt-auth-example-app/tsconfig.spec.json",
"assets": [
"projects/jwt-auth-example-app/src/favicon.ico",
"projects/jwt-auth-example-app/src/assets"
"projects/ngx-jwt-auth-example-app/src/favicon.ico",
"projects/ngx-jwt-auth-example-app/src/assets"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"projects/jwt-auth-example-app/src/styles.css"
"projects/ngx-jwt-auth-example-app/src/styles.css"
],
"scripts": []
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "@uzenith360/ngx-jwt-auth",
"name": "@uzenith360/ngx-ngx-jwt-auth",
"version": "0.0.0",
"description": "An Angular JWT authentication library with authentication service, route guard, interceptor and login modal to get your Angular app authentication setup in a breeze 🌬️",
"scripts": {
"clean": "rm -rf ./dist",
"ng": "ng",
"start": "ng serve",
"build": "npm run clean && ng build jwt-auth",
"build": "npm run clean && ng build ngx-jwt-auth",
"watch": "ng build --watch --configuration development",
"prepack": "npm run build",
"test": "ng test jwt-auth",
"test": "ng test ngx-jwt-auth",
"prepare": "husky install"
},
"repository": {
"type": "git",
"url": "https://github.com/uzenith360/ngx-jwt-auth.git"
"url": "https://github.com/uzenith360/ngx-ngx-jwt-auth.git"
},
"keywords": [
"typescript",
Expand All @@ -23,9 +23,9 @@
"author": "@uzenith360",
"license": "ISC",
"bugs": {
"url": "https://github.com/uzenith360/ngx-jwt-auth/issues"
"url": "https://github.com/uzenith360/ngx-ngx-jwt-auth/issues"
},
"homepage": "https://github.com/uzenith360/ngx-jwt-auth#readme",
"homepage": "https://github.com/uzenith360/ngx-ngx-jwt-auth#readme",
"publishConfig": {
"registry": "https://npm.pkg.github.com/",
"access": "public"
Expand Down
10 changes: 0 additions & 10 deletions projects/jwt-auth-example-app/tailwind.config.js

This file was deleted.

24 changes: 0 additions & 24 deletions projects/jwt-auth/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions projects/jwt-auth/src/style.css

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ describe('AppComponent', () => {
expect(app).toBeTruthy();
});

it(`should have as title 'jwt-auth-example-app'`, () => {
it(`should have as title 'ngx-jwt-auth-example-app'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('jwt-auth-example-app');
expect(app.title).toEqual('ngx-jwt-auth-example-app');
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('jwt-auth-example-app app is running!');
expect(compiled.querySelector('.content span')?.textContent).toContain('ngx-jwt-auth-example-app app is running!');
});
});
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Component } from '@angular/core';
import { AuthManagerService } from 'jwt-auth';
import { AuthManagerService } from 'ngx-jwt-auth';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'jwt-auth-example-app';
title = 'ngx-jwt-auth-example-app';

constructor(private readonly authManagerService: AuthManagerService){
this.init ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { EnvironmentConfig } from 'jwt-auth';
import { JwtAuthModule } from 'jwt-auth';
import { EnvironmentConfig } from 'ngx-jwt-auth';
import { JwtAuthModule } from 'ngx-jwt-auth';

const config: EnvironmentConfig
= {
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions projects/ngx-jwt-auth-example-app/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
content: [
"./projects/ngx-jwt-auth-example-app/src/**/*.{html,ts}",
"./projects/ngx-jwt-auth/src/**/*.{html,ts}",
],
theme: {
extend: {},
},
plugins: [],
}
24 changes: 24 additions & 0 deletions projects/ngx-jwt-auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# JwtAuth

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.0.0.

## Code scaffolding

Run `ng generate component component-name --project ngx-jwt-auth` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-jwt-auth`.
> Note: Don't forget to add `--project ngx-jwt-auth` or else it will be added to the default project in your `angular.json` file.
## Build

Run `ng build ngx-jwt-auth` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build ngx-jwt-auth`, go to the dist folder `cd dist/ngx-jwt-auth` and run `npm publish`.

## Running unit tests

Run `ng test ngx-jwt-auth` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/jwt-auth",
"dest": "../../dist/ngx-jwt-auth",
"lib": {
"entryFile": "src/public-api.ts"
},
"assets": [
"src/styles.css"
]
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{
"name": "jwt-auth",
"name": "ngx-jwt-auth",
"version": "0.0.1",
"exports": {
".": {
"css": "./src/styles.css"
}
},
"peerDependencies": {
"@angular/common": "^15.0.0",
"@angular/core": "^15.0.0",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class AuthManagerService {
private redirectUrl?: string;

constructor(
private JwtAuthService: JwtAuthService,
private jwtAuthService: JwtAuthService,
private authService: AuthService,
private authDialogService: AuthDialogService
) { }
Expand All @@ -28,14 +28,14 @@ export class AuthManagerService {
* Just check if there's auth
*/
private isAuth(): boolean {
return !this.JwtAuthService.check();
return !this.jwtAuthService.check();
}

public auth(email: string, password: string): Observable<{ message: string, jwt: JWT }> {
return this.authService.auth(email, password)
.pipe(
map(({ message, jwt }) => {
this.JwtAuthService.set(jwt);
this.jwtAuthService.set(jwt);

return { message, jwt };
})
Expand All @@ -49,7 +49,7 @@ export class AuthManagerService {
*/
public getAuthAndUser(force: boolean = true, dontCheckAuth: boolean = false): Promise<JWTAndUser> {
if (dontCheckAuth || this.isAuth()) {
const jwtAndUser: JWTAndUser | null = this.JwtAuthService.getJWTAndUser();
const jwtAndUser: JWTAndUser | null = this.jwtAuthService.getJWTAndUser();

if (!!jwtAndUser) {
return Promise.resolve(jwtAndUser);
Expand All @@ -61,7 +61,7 @@ export class AuthManagerService {
this.authDialogService
.open()
.then((jwtAndUser) => {
this.JwtAuthService.set(jwtAndUser.jwt);
this.jwtAuthService.set(jwtAndUser.jwt);

resolve(jwtAndUser);
}).catch((err) => reject(new AuthError(err?.message)));
Expand Down Expand Up @@ -99,7 +99,7 @@ export class AuthManagerService {
return this.authService.logout()
.pipe(
map(({ message }) => {
this.JwtAuthService.clear();
this.jwtAuthService.clear();

return { message };
})
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Public API Surface of jwt-auth
* Public API Surface of ngx-jwt-auth
*/

export * from './lib/environment-config.interface';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./projects/jwt-auth/src/**/*.{html,ts}",
"./projects/ngx-jwt-auth/src/**/*.{html,ts}",
],
theme: {
extend: {},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8497419

Please sign in to comment.