From efb3c9e5492801de9591cd676438a2a646e14d2e Mon Sep 17 00:00:00 2001 From: Taimoor Farras Date: Thu, 22 Apr 2021 21:51:54 +0300 Subject: [PATCH 1/6] update docs, deps and fix module name --- .gitignore | 2 +- CHANGELOG.md | 21 ++++++++++++- CONTRIBUTING.md | 2 +- nest-cli.json | 5 --- package.json | 81 +++++++++++++++++++++++++++---------------------- tsconfig.json | 12 +++----- tslint.json | 18 ----------- 7 files changed, 72 insertions(+), 69 deletions(-) delete mode 100644 nest-cli.json delete mode 100644 tslint.json diff --git a/.gitignore b/.gitignore index fd9fe10..646558f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,4 @@ lerna-debug.log* !.vscode/launch.json !.vscode/extensions.json -package-lock.json \ No newline at end of file +package-lock.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 6209b30..eb5fcfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,20 @@ -RELEASE 1.0.0 \ No newline at end of file +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [2.0.0] - 2021-04-22 + +### Fixed + +- Changed name of exported module. Now it's the same in documentation and module: `FirebaseAdminModule` + +### Changed + +- Updated NestJS dependencies +- Updated `firebase-admin` dependecy +- Updated scripts. Now it's using [Nest Cli](https://docs.nestjs.com/cli/overview) + +[2.0.0]: https://github.com/tfarras/nestjs-firebase-admin/releases/tag/2.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4530c64..b2444b5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ ## Code Style -We use [Prettier](https://prettier.io/) and tslint to maintain code style and best practices. +We use [Prettier](https://prettier.io/) and eslint to maintain code style and best practices. Please make sure your PR adheres to the guides by running: ```bash diff --git a/nest-cli.json b/nest-cli.json deleted file mode 100644 index 0dde5f8..0000000 --- a/nest-cli.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "ts", - "collection": "@nestjs/schematics", - "sourceRoot": "src" -} diff --git a/package.json b/package.json index df12531..8a15745 100644 --- a/package.json +++ b/package.json @@ -10,21 +10,15 @@ "dist/**/*", "*.md" ], - "scripts": { - "start:dev": "tsc -w", - "build": "tsc", - "prepare": "npm run build", - "format": "prettier --write \"src/**/*.ts\"", - "lint": "tslint -p tsconfig.json -c tslint.json", - "test": "jest", - "test:watch": "jest --watch", - "test:cov": "jest --coverage", - "test:e2e": "jest --config ./test/jest-e2e.json" - }, + "homepage": "https://github.com/tfarras/nestjs-firebase-admin#readme", "keywords": [ + "node.js", "nestjs", + "nest", + "google", "firebase", "firebase-admin", + "module", "sdk" ], "publishConfig": { @@ -37,33 +31,45 @@ "bugs": { "url": "https://github.com/tfarras/nestjs-firebase-admin/issues" }, - "homepage": "https://github.com/tfarras/nestjs-firebase-admin#readme", - "peerDependencies": { - "@nestjs/common": "^6.0.0", - "firebase-admin": "^8.10.0" + "scripts": { + "prebuild": "rimraf dist", + "build": "nest build", + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "start": "nest start", + "start:dev": "nest start --watch", + "start:debug": "nest start --debug --watch", + "start:prod": "node dist/main", + "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", + "test": "jest", + "test:watch": "jest --watch", + "test:cov": "jest --coverage", + "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", + "test:e2e": "jest --config ./test/jest-e2e.json" }, "dependencies": { - "firebase-admin": "^8.10.0" + "firebase-admin": "^9.6.0" }, "devDependencies": { - "@nestjs/common": "^6.0.0", - "@nestjs/core": "^6.0.0", - "@nestjs/platform-express": "^6.0.0", - "@nestjs/testing": "6.1.1", - "@types/express": "4.16.1", - "@types/jest": "24.0.11", - "@types/node": "11.13.4", - "@types/supertest": "2.0.7", - "rxjs": "^6.5.4", - "jest": "24.7.1", - "prettier": "1.17.0", - "supertest": "4.0.2", - "ts-jest": "24.0.2", - "ts-node": "8.1.0", - "tsc-watch": "2.2.1", - "tsconfig-paths": "3.8.0", - "tslint": "5.16.0", - "typescript": "3.7.2" + "@nestjs/cli": "^7.6.0", + "@nestjs/schematics": "^7.3.0", + "@nestjs/testing": "^7.6.15", + "@types/express": "^4.17.11", + "@types/jest": "^26.0.22", + "@types/node": "^14.14.36", + "@types/supertest": "^2.0.10", + "@typescript-eslint/eslint-plugin": "^4.19.0", + "@typescript-eslint/parser": "^4.19.0", + "eslint": "^7.22.0", + "eslint-config-prettier": "^8.1.0", + "eslint-plugin-prettier": "^3.3.1", + "jest": "^26.6.3", + "prettier": "^2.2.1", + "supertest": "^6.1.3", + "ts-jest": "^26.5.4", + "ts-loader": "^8.0.18", + "ts-node": "^9.1.1", + "tsconfig-paths": "^3.9.0", + "typescript": "^4.2.3" }, "jest": { "moduleFileExtensions": [ @@ -72,11 +78,14 @@ "ts" ], "rootDir": "src", - "testRegex": ".spec.ts$", + "testRegex": ".*\\.spec\\.ts$", "transform": { "^.+\\.(t|j)s$": "ts-jest" }, + "collectCoverageFrom": [ + "**/*.(t|j)s" + ], "coverageDirectory": "../coverage", "testEnvironment": "node" } -} \ No newline at end of file +} diff --git a/tsconfig.json b/tsconfig.json index 9e6f526..bf10a23 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,13 +5,11 @@ "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "target": "es6", - "sourceMap": false, + "allowSyntheticDefaultImports": true, + "target": "es2017", + "sourceMap": true, "outDir": "./dist", - "rootDir": "./src", "baseUrl": "./", - "noLib": false - }, - "include": ["src/**/*.ts"], - "exclude": ["node_modules"] + "incremental": true + } } diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 5651b2f..0000000 --- a/tslint.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "defaultSeverity": "error", - "extends": ["tslint:recommended"], - "jsRules": { - "no-unused-expression": true - }, - "rules": { - "quotemark": [true, "single"], - "member-access": [false], - "ordered-imports": [false], - "max-line-length": [true, 150], - "member-ordering": [false], - "interface-name": [false], - "arrow-parens": false, - "object-literal-sort-keys": false - }, - "rulesDirectory": [] -} From c18bfd645a9473e97550cc72f848ea5c0e86d1a1 Mon Sep 17 00:00:00 2001 From: Taimoor Farras Date: Thu, 22 Apr 2021 21:56:42 +0300 Subject: [PATCH 2/6] 2.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8a15745..00b503b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tfarras/nestjs-firebase-admin", - "version": "1.0.0", + "version": "2.0.0", "description": "NestJS Module for Firebase Admin SDK", "author": "Taimoor Farras ", "readmeFilename": "README.md", From d0fa5d032da3353a9c6df196114aac71ad5bce37 Mon Sep 17 00:00:00 2001 From: Taimoor Farras Date: Thu, 22 Apr 2021 21:57:00 +0300 Subject: [PATCH 3/6] 2.0.1-rc.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 00b503b..624fa04 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tfarras/nestjs-firebase-admin", - "version": "2.0.0", + "version": "2.0.1-rc.0", "description": "NestJS Module for Firebase Admin SDK", "author": "Taimoor Farras ", "readmeFilename": "README.md", From a1b289f40144d194409d89d31b37abd7964fdbb1 Mon Sep 17 00:00:00 2001 From: Taimoor Farras Date: Thu, 22 Apr 2021 22:06:52 +0300 Subject: [PATCH 4/6] 2.0.1-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 624fa04..d840911 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tfarras/nestjs-firebase-admin", - "version": "2.0.1-rc.0", + "version": "2.0.1-rc.1", "description": "NestJS Module for Firebase Admin SDK", "author": "Taimoor Farras ", "readmeFilename": "README.md", From ed4f1698a2f3e030e3945ab37dccb0cfb94c6abe Mon Sep 17 00:00:00 2001 From: Taimoor Farras Date: Thu, 22 Apr 2021 22:09:51 +0300 Subject: [PATCH 5/6] 2.0.1-rc.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d840911..f9093d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tfarras/nestjs-firebase-admin", - "version": "2.0.1-rc.1", + "version": "2.0.1-rc.2", "description": "NestJS Module for Firebase Admin SDK", "author": "Taimoor Farras ", "readmeFilename": "README.md", From dcd2fd36f4ec7a2a0fe02c0cf1d69c9c0057a0e8 Mon Sep 17 00:00:00 2001 From: Taimoor Farras Date: Thu, 22 Apr 2021 22:13:25 +0300 Subject: [PATCH 6/6] rename module --- src/firebase-admin.module.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/firebase-admin.module.ts b/src/firebase-admin.module.ts index 58224fe..b153f64 100644 --- a/src/firebase-admin.module.ts +++ b/src/firebase-admin.module.ts @@ -1,18 +1,22 @@ -import { Global, Module, DynamicModule } from '@nestjs/common'; -import { FirebaseAdminModuleAsyncOptions } from './firebase-admin.interface'; -import { FIREBASE_ADMIN_MODULE_OPTIONS, FIREBASE_ADMIN_INJECT } from './firebase-admin.constant'; -import * as admin from 'firebase-admin'; +import { Global, Module, DynamicModule } from "@nestjs/common"; +import { FirebaseAdminModuleAsyncOptions } from "./firebase-admin.interface"; +import { + FIREBASE_ADMIN_MODULE_OPTIONS, + FIREBASE_ADMIN_INJECT, +} from "./firebase-admin.constant"; +import * as admin from "firebase-admin"; @Global() @Module({}) -export class FirebaseAdminCoreModule { +export class FirebaseAdminModule { static forRoot(options: admin.AppOptions): DynamicModule { const firebaseAdminModuleOptions = { provide: FIREBASE_ADMIN_MODULE_OPTIONS, useValue: options, }; - const app = admin.apps.length === 0 ? admin.initializeApp(options) : admin.apps[0]; + const app = + admin.apps.length === 0 ? admin.initializeApp(options) : admin.apps[0]; const firebaseAuthencationProvider = { provide: FIREBASE_ADMIN_INJECT, @@ -20,7 +24,7 @@ export class FirebaseAdminCoreModule { }; return { - module: FirebaseAdminCoreModule, + module: FirebaseAdminModule, providers: [firebaseAdminModuleOptions, firebaseAuthencationProvider], exports: [firebaseAdminModuleOptions, firebaseAuthencationProvider], }; @@ -36,7 +40,8 @@ export class FirebaseAdminCoreModule { const firebaseAuthencationProvider = { provide: FIREBASE_ADMIN_INJECT, useFactory: (opt: admin.AppOptions) => { - const app = admin.apps.length === 0 ? admin.initializeApp(opt) : admin.apps[0]; + const app = + admin.apps.length === 0 ? admin.initializeApp(opt) : admin.apps[0]; return app; }, @@ -44,7 +49,7 @@ export class FirebaseAdminCoreModule { }; return { - module: FirebaseAdminCoreModule, + module: FirebaseAdminModule, imports: options.imports, providers: [firebaseAdminModuleOptions, firebaseAuthencationProvider], exports: [firebaseAdminModuleOptions, firebaseAuthencationProvider],