From ff212d19f0b64fbfb4657422453839a29bccb0e2 Mon Sep 17 00:00:00 2001 From: "Chakhsu.Lau" Date: Tue, 12 Dec 2023 11:13:21 +0800 Subject: [PATCH] feat: build to lib --- .github/workflows/tests.yml | 7 ++++ .gitignore | 6 +++ package.json | 13 ++++-- pnpm-lock.yaml | 84 +++++++++++++++++++++++++++++++++++++ tsconfig.json | 2 +- 5 files changed, 107 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9e3b52c..af968dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,16 +22,23 @@ jobs: steps: - name: Checkout master uses: actions/checkout@v4 + - name: Install pnpm uses: pnpm/action-setup@v2 with: version: 8 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'pnpm' + - name: Install Dependencies run: pnpm i + + - name: Build + run: pnpm build + - name: Test run: pnpm test diff --git a/.gitignore b/.gitignore index 571b775..758cbc0 100644 --- a/.gitignore +++ b/.gitignore @@ -118,6 +118,12 @@ typings/ # DynamoDB Local files .dynamodb/ +# TernJS port file +.tern-port + +# Build files +lib/ + ### Vim ### # Swap [._]*.s[a-v][a-z] diff --git a/package.json b/package.json index eed29ef..b8ba33e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpcity", - "version": "1.3.0", + "version": "1.3.1", "description": "A powerful and complete gRPC framework for Node.js", "author": "Chakhsu.Lau", "license": "MIT", @@ -20,14 +20,18 @@ "bugs": { "url": "https://github.com/chakhsu/grpcity/issues" }, - "main": "./types/index.js", - "types": "./types/index.d.ts", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "lib" + ], "engines": { "node": ">=16" }, "scripts": { + "clear": "rimraf lib", "test": "mocha --exit --extension .test.js --recursive test", - "build": "rm -rf types && tsc -P tsconfig.json", + "build": "pnpm clear && tsc -P tsconfig.json", "lint:prettier": "prettier --cache --check --ignore-path .gitignore --ignore-path .prettierignore .", "prettier": "pnpm lint:prettier --write", "prepare": "husky install" @@ -51,6 +55,7 @@ "lint-staged": "^15.1.0", "mocha": "^10.2.0", "prettier": "3.1.0", + "rimraf": "^5.0.5", "typescript": "^5.3.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 29077f2..0568086 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,6 +46,9 @@ devDependencies: prettier: specifier: 3.1.0 version: 3.1.0 + rimraf: + specifier: ^5.0.5 + version: 5.0.5 typescript: specifier: ^5.3.2 version: 5.3.2 @@ -80,6 +83,25 @@ packages: '@hapi/hoek': 9.3.0 dev: false + /@isaacs/cliui@8.0.2: + resolution: { integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== } + engines: { node: '>=12' } + dependencies: + string-width: 5.1.2 + string-width-cjs: /string-width@4.2.3 + strip-ansi: 7.1.0 + strip-ansi-cjs: /strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: /wrap-ansi@7.0.0 + dev: true + + /@pkgjs/parseargs@0.11.0: + resolution: { integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== } + engines: { node: '>=14' } + requiresBuild: true + dev: true + optional: true + /@protobufjs/aspromise@1.1.2: resolution: { integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== } dev: false @@ -435,6 +457,14 @@ packages: hasBin: true dev: true + /foreground-child@3.1.1: + resolution: { integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg== } + engines: { node: '>=14' } + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.1.0 + dev: true + /fs.realpath@1.0.0: resolution: { integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== } dev: true @@ -467,6 +497,18 @@ packages: is-glob: 4.0.3 dev: true + /glob@10.3.10: + resolution: { integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g== } + engines: { node: '>=16 || 14 >=14.17' } + hasBin: true + dependencies: + foreground-child: 3.1.1 + jackspeak: 2.3.6 + minimatch: 9.0.3 + minipass: 7.0.4 + path-scurry: 1.10.1 + dev: true + /glob@7.2.0: resolution: { integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== } dependencies: @@ -562,6 +604,15 @@ packages: resolution: { integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== } dev: true + /jackspeak@2.3.6: + resolution: { integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ== } + engines: { node: '>=14' } + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + dev: true + /joi@17.11.0: resolution: { integrity: sha512-NgB+lZLNoqISVy1rZocE9PZI36bL/77ie924Ri43yEvi9GUUMPeyVIr8KdFTMUlby1p0PBYMk9spIxEUQYqrJQ== } dependencies: @@ -659,6 +710,11 @@ packages: get-func-name: 2.0.2 dev: true + /lru-cache@10.1.0: + resolution: { integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag== } + engines: { node: 14 || >=16.14 } + dev: true + /merge-stream@2.0.0: resolution: { integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== } dev: true @@ -694,6 +750,18 @@ packages: brace-expansion: 2.0.1 dev: true + /minimatch@9.0.3: + resolution: { integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== } + engines: { node: '>=16 || 14 >=14.17' } + dependencies: + brace-expansion: 2.0.1 + dev: true + + /minipass@7.0.4: + resolution: { integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== } + engines: { node: '>=16 || 14 >=14.17' } + dev: true + /mocha@10.2.0: resolution: { integrity: sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== } engines: { node: '>= 14.0.0' } @@ -802,6 +870,14 @@ packages: engines: { node: '>=12' } dev: true + /path-scurry@1.10.1: + resolution: { integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ== } + engines: { node: '>=16 || 14 >=14.17' } + dependencies: + lru-cache: 10.1.0 + minipass: 7.0.4 + dev: true + /pathval@1.1.1: resolution: { integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== } dev: true @@ -871,6 +947,14 @@ packages: resolution: { integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== } dev: true + /rimraf@5.0.5: + resolution: { integrity: sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A== } + engines: { node: '>=14' } + hasBin: true + dependencies: + glob: 10.3.10 + dev: true + /safe-buffer@5.2.1: resolution: { integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== } dev: true diff --git a/tsconfig.json b/tsconfig.json index a7fb047..73dc90b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "@tsconfig/node14/tsconfig.json", "compilerOptions": { - "outDir": "types", + "outDir": "lib", "sourceMap": false, "declaration": true, "stripInternal": true,