Skip to content

Commit

Permalink
Add tsc for build TS code
Browse files Browse the repository at this point in the history
  • Loading branch information
cpfriend1721994 committed Apr 4, 2024
1 parent dc59123 commit 6fb19cb
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ yarn-error.log
/quick-start
/example_dist
/example
sample/**/node_modules

# tests
/benchmarks/memory
Expand All @@ -51,6 +52,5 @@ build/config\.gypi
.npmrc
pnpm-lock.yaml
yarn.lock
packages-lock.json
bun.lockb

package-lock.json
bun.lockb
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ npm i @nnmt/platform-hyper-express


## Usage
Use **HyperExpressAdapter** for NestJS HTTP adapter. Must require **`@nestjs/platform-express`** in dependencies.
Use **HyperExpressAdapter** for NestJS HTTP Adapter. Must require **`@nestjs/platform-express`** in dependencies.
```js
// sample/nest-sample-1/src/main.ts
import { NestFactory } from '@nestjs/core';
import { HyperExpressAdapter } from '@nnmt/platform-hyper-express';
import { AppModule } from './app.module';

async function bootstrap() {
const app = await NestFactory.create(
AppModule,
new HyperExpressAdapter()
);
const app = await NestFactory.create(AppModule, new HyperExpressAdapter());
await app.listen(3000);
}
bootstrap();
```

Or use **`@nnmt/platform-hyper-express`** classes only to optimize hyper-express usage (Experimental).
```js
// sample/nest-sample-2/src/main.ts
import { NestFactory } from '@nestjs/core';
import {
HyperExpressAdapter,
Expand All @@ -57,17 +57,25 @@ import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create<NestHyperExpressApplication>(
AppModule,
new HyperExpressAdapter()
new HyperExpressAdapter(),
);
await app.listen(3000);
}
bootstrap();
```



## Sample
- Sample project are located in **`/sample`** directory.
- Sample project help developers to install/integrate **`platform-hyper-express`** into their NestJS projects.
- Sample project is not included in NPM package's source.



## Encountering Problems?
- **`@nnmt/platform-hyper-express`** is mostly compatible with **`@nestjs/platform-express`** but not **100%** therefore you may encounter some middlewares not working out of the box. In this scenario, you must either write your own polyfill or omit the middleware to continue.
- Currently uWebsockets.js supports only Node.js LTS versions on (glibc) Linux, macOS and Windows, on [**`Tier 1`**](https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list) platforms.
- Currently uWebsockets.js supports only Node.js LTS versions 16, 18 and 20 on (glibc) Linux, macOS and Windows, on [**`Tier 1`**](https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list) platforms.
- The uWebsockets.js version header is disabled by default. You may opt-out of this behavior by setting an environment variable called **`KEEP_UWS_HEADER`** to a truthy value such as **`1`** or **`true`**.


Expand Down
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nnmt/platform-hyper-express",
"version": "0.2.3",
"version": "0.3.0",
"description": "Hyper-express Adapter for NestJS (@nnmt/platform-hyper-express)",
"author": "Nguyen Nhat Minh Tu",
"license": "MIT",
Expand All @@ -18,27 +18,33 @@
"access": "public"
},
"dependencies": {
"@nestjs/common": "^10.3.7",
"@nestjs/core": "^10.3.7",
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"hyper-express": "^6.15.1",
"live-directory": "^3.0.3",
"tslib": "^2.6.2"
},
"devDependencies": {
"@nestjs/testing": "^10.3.7",
"@nestjs/testing": "^10.0.0",
"@types/body-parser": "^1.19.5",
"@types/cors": "^2.8.17",
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"mime": "^4.0.1",
"ts-node": "^10.9.2"
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"typescript": "^5.4.3"
},
"bugs": {
"url": "https://github.com/cpfriend1721994/platform-hyper-express/issues"
},
"main": "index.ts",
"types": "index.d.ts",
"scripts": {
"test": "npm run test"
"test": "jest",
"build": "tsc --build tsconfig.build.json"
},
"keywords": [
"nestjs",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"compilerOptions": {
"composite": true,
"outDir": ".",
"rootDir": ".",
"paths": {}
},
"exclude": ["node_modules", "dist", "test/**/*", "*.spec.ts"],
"exclude": ["node_modules", "dist", "test/**/*", "*.spec.ts", "sample", "tests"],
"references": []
}
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"files": ["index.ts"],
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": false,
Expand All @@ -12,11 +13,13 @@
"sourceMap": true,
"allowJs": false,
"outDir": "dist",
"declaration": true,
"composite": true,
"baseUrl": ".",
"paths": {},
},
"include": ["packages/**/*", "integration/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"],
"include": ["src", "packages/**/*", "integration/**/*"],
"exclude": ["node_modules", "**/*.spec.ts", "sample", "tests"],
"references": [
{
"path": "./tsconfig.build.json"
Expand Down

0 comments on commit 6fb19cb

Please sign in to comment.