Skip to content

Commit

Permalink
refactor: build external deps
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Feb 27, 2024
1 parent 484e954 commit dccaa2a
Show file tree
Hide file tree
Showing 17 changed files with 1,864 additions and 1,309 deletions.
92 changes: 46 additions & 46 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,92 +25,92 @@
"scripts": {
"prepare": "corepack enable && husky install",
"prebuild": "rimraf dist",
"build": "nest build",
"dev": "npm run start",
"build": "pnpm run build:external && nest build",
"build:external": "pnpm -C \"packages/external\" run build",
"dev": "pnpm run build:external && npm run start",
"bundle": "rimraf out && pnpm run build && cd dist/src && npx ncc build main.js -o ../../out -m",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "cross-env NODE_ENV=development nest start -w",
"start:debug": "cross-env NODE_ENV=development nest start --debug --watch",
"start:prod": "cross-env NODE_ENV=production node out/index.js",
"start": "pnpm run build:external && cross-env NODE_ENV=development nest start -w",
"start:debug": "pnpm run build:external && cross-env NODE_ENV=development nest start --debug --watch",
"start:prod": "pnpm run build:external && cross-env NODE_ENV=production node out/index.js",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"prod": "cross-env NODE_ENV=production pm2-runtime start ecosystem.config.js",
"prod:pm2": "cross-env NODE_ENV=production pm2 restart ecosystem.config.js",
"prod:stop": "pm2 stop ecosystem.config.js",
"prod:debug": "cross-env NODE_ENV=production nest start --debug --watch",
"test": "vitest",
"test:watch": "vitest --watch",
"test:cov": "vitest --coverage"
"test": "pnpm run build:external && vitest"
},
"dependencies": {
"@nestjs/cache-manager": "2.1.1",
"@nestjs/common": "10.2.10",
"@nestjs/core": "10.2.10",
"@nestjs/cache-manager": "2.2.1",
"@nestjs/common": "10.3.3",
"@nestjs/core": "10.3.3",
"@nestjs/jwt": "10.2.0",
"@nestjs/mapped-types": "^2.0.4",
"@nestjs/mapped-types": "^2.0.5",
"@nestjs/passport": "10.0.3",
"@nestjs/platform-fastify": "10.2.10",
"@nestjs/schedule": "4.0.0",
"@typegoose/auto-increment": "4.0.0",
"@typegoose/typegoose": "12.0.0",
"axios": "1.6.2",
"bcrypt": "5.1.1",
"cache-manager": "5.3.1",
"@nestjs/platform-fastify": "10.3.3",
"@nestjs/schedule": "4.0.1",
"@typegoose/auto-increment": "4.2.0",
"@typegoose/typegoose": "12.2.0",
"axios": "1.6.7",
"bcryptjs": "2.4.3",
"cache-manager": "5.4.0",
"cache-manager-ioredis": "2.1.0",
"class-transformer": "0.5.1",
"class-validator": "0.14.0",
"class-validator": "0.14.1",
"class-validator-jsonschema": "^5.0.0",
"cron": "^3.1.6",
"dayjs": "1.11.10",
"lodash": "*",
"mongoose": "8.0.3",
"mongoose-paginate-v2": "1.7.31",
"nanoid": "^3",
"nestjs-pretty-logger": "0.2.0",
"mongoose": "8.2.0",
"mongoose-paginate-v2": "1.8.0",
"nanoid": "^5.0.6",
"nestjs-pretty-logger": "0.2.1",
"passport": "0.7.0",
"passport-jwt": "4.0.1",
"redis": "4.6.11",
"reflect-metadata": "0.1.14",
"redis": "4.6.13",
"reflect-metadata": "0.2.1",
"rxjs": "7.8.1",
"snakecase-keys": "5.5.0",
"zx-cjs": "7.0.7-0"
"snakecase-keys": "6.0.0",
"@nest-http/external": "workspace:*"
},
"devDependencies": {
"@innei/bump-version": "^1.5.10",
"@innei/eslint-config-ts": "^0.12.0",
"@innei/prettier": "^0.12.0",
"@nestjs/cli": "10.2.1",
"@nestjs/schematics": "10.0.3",
"@nestjs/testing": "10.2.10",
"@swc/cli": "0.1.63",
"@swc/core": "1.3.99",
"@types/bcrypt": "5.0.2",
"@innei/eslint-config-ts": "^0.12.2",
"@innei/prettier": "^0.12.2",
"@nestjs/cli": "10.3.2",
"@nestjs/schematics": "10.1.1",
"@nestjs/testing": "10.3.3",
"@swc/cli": "0.3.9",
"@swc/core": "1.4.2",
"@types/bcryptjs": "2.4.6",
"@types/cache-manager": "4.0.6",
"@types/lodash": "4.14.202",
"@types/node": "20.10.4",
"@types/passport-jwt": "3.0.13",
"@types/supertest": "2.0.16",
"@types/node": "20.11.20",
"@types/passport-jwt": "4.0.1",
"@types/supertest": "6.0.2",
"@types/ua-parser-js": "0.7.39",
"@vercel/ncc": "0.38.1",
"cross-env": "7.0.3",
"eslint": "^8.55.0",
"husky": "8.0.3",
"eslint": "^8.57.0",
"husky": "9.0.11",
"ioredis": "^5.3.2",
"lint-staged": "15.2.0",
"prettier": "3.1.1",
"lint-staged": "15.2.2",
"prettier": "3.2.5",
"rimraf": "5.0.5",
"rollup-plugin-swc": "0.2.1",
"source-map-support": "*",
"ts-loader": "9.5.1",
"tsconfig-paths": "4.2.0",
"typescript": "^5.3.3",
"unplugin-swc": "1.4.4",
"vite": "5.0.2",
"vite": "5.1.4",
"vite-tsconfig-paths": "4.2.2",
"vitest": "0.34.6",
"zx": "7.2.3"
"zx": "7.2.3",
"tsup": "8.0.2"
},
"optionalDependencies": {
"mongodb-memory-server": "9.1.3",
"mongodb-memory-server": "9.1.6",
"redis-memory-server": "0.10.0"
},
"resolutions": {
Expand Down
1 change: 1 addition & 0 deletions packages/external/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
4 changes: 4 additions & 0 deletions packages/external/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * as nanoid from 'nanoid'

export * as zx from 'zx'
export * from 'zx'
16 changes: 16 additions & 0 deletions packages/external/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@nest-http/external",
"type": "module",
"main": "dist/index.cjs",
"scripts": {
"build": "tsup"
},
"devDependencies": {
"nanoid": "5.0.6",
"zx": "7.2.3"
},
"exports": {
".": "./dist/index.cjs",
"./zx-global": "./zx-global.cjs"
}
}
37 changes: 37 additions & 0 deletions packages/external/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"compilerOptions": {
"declaration": true,
"outDir": "./esm",
"baseUrl": ".",
"jsx": "react",
"target": "es2020",
"lib": [
"ESNext",
"DOM",
"DOM.Iterable"
],
"module": "ESNext",
"moduleResolution": "node",
"strict": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"paths": {
"~/*": [
"*"
],
"@core/*": [
"../../apps/core/src/*"
],
}
},
"exclude": [
"esm/*",
"build/*",
"node_modules/*",
"lib/*",
"dist/**"
]
}
9 changes: 9 additions & 0 deletions packages/external/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'tsup'

export default defineConfig({
clean: true,
target: 'es2020',
entry: ['index.ts'],
dts: true,
format: ['cjs'],
})
4 changes: 4 additions & 0 deletions packages/external/zx-global.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// import zx from './dist/index.cjs'
const zx = require('./dist/index.cjs').zx

Object.assign(global, zx)
1 change: 1 addition & 0 deletions packages/external/zx-global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="zx/globals" />

0 comments on commit dccaa2a

Please sign in to comment.