Skip to content

Commit

Permalink
chore: optimize npm script
Browse files Browse the repository at this point in the history
  • Loading branch information
kuizuo committed Nov 10, 2023
1 parent 699899d commit 59c875d
Show file tree
Hide file tree
Showing 9 changed files with 1,527 additions and 1,947 deletions.
21 changes: 0 additions & 21 deletions .vscode/launch.json

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
}
34 changes: 0 additions & 34 deletions apps/api/.env.development

This file was deleted.

34 changes: 0 additions & 34 deletions apps/api/.env.production

This file was deleted.

64 changes: 64 additions & 0 deletions apps/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
node_modules
.DS_Store
dist
*-dist
.cache
.history

.turbo
.local

# local env files
.env.*
.eslintcache

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# Editor directories and files
.idea
# .vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
8 changes: 4 additions & 4 deletions apps/api/ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const { cpus } = require('os');
const { cpus } = require('os')

const cpuLen = cpus().length;
const cpuLen = cpus().length

module.exports = {
apps: [
{
name: 'nest-admin',
script: 'index.js',
script: './dist/main.js',
autorestart: true,
exec_mode: 'cluster',
watch: false,
Expand All @@ -19,4 +19,4 @@ module.exports = {
},
},
],
};
}
28 changes: 14 additions & 14 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
{
"name": "api",
"version": "0.2.0",
"version": "0.1.0",
"private": true,
"description": "基于NestJs + TypeScript + TypeORM + Redis + MySql + Vben Admin编写的一款前后端分离的权限管理系统",
"packageManager": "pnpm@8.10.2",
"license": "MIT",
"scripts": {
"prebuild": "rimraf dist",
"build": "pnpm prebuild && nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "NODE_ENV=development nest start",
"start:prod": "NODE_ENV=production node dist/main",
"dev": "NODE_ENV=development nest start --watch",
"dev:debug": "NODE_ENV=development nest start --debug --watch",
"pm2:prod": "pm2 start ecosystem.config.js --env production",
"pm2:dev": "pm2 start ecosystem.config.js --env development",
"pm2:test": "pm2 start ecosystem.config.js --env test",
"build": "nest build",
"dev": "npm run start",
"dev:debug": "npm run start:debug",
"start": "cross-env NODE_ENV=development nest start -w --path tsconfig.json -- ",
"start:debug": "cross-env NODE_ENV=development nest start --debug --watch",
"start:prod": "cross-env NODE_ENV=production node dist/src/main",
"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",
"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",
"doc": "compodoc -p tsconfig.json -s",
"typeorm": "NODE_ENV=development typeorm -d ./dist/config/modules/database.config.js",
"migration:create": "typeorm migration:create",
Expand Down Expand Up @@ -123,6 +120,9 @@
"ts"
],
"rootDir": "src",
"moduleNameMapper": {
"^@/(.*)$": "<rootDir>/$1"
},
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ConfigService } from '@nestjs/config'
import { NestFactory, Reflector } from '@nestjs/core'
import { NestFastifyApplication } from '@nestjs/platform-fastify'

import { useContainer } from 'class-validator';
import { useContainer } from 'class-validator'

import { AppModule } from './app.module'

Expand Down
Loading

0 comments on commit 59c875d

Please sign in to comment.