typescript VScode,NestJS,git子模块typeorm初始化是在子模块而不是主目录中完成的

9fkzdhlc  于 2022-11-26  发布在  TypeScript
关注(0)|答案(1)|浏览(117)

我有一个这样的项目

my_project
|
|
|
|
\----my_submodule
    |
    |
    |
    \----package.json
    \----tsconfig.json
|
|
|
\----package.json
\----tsconfig.json

我的项目/软件包. json和我的项目/我的子模块/软件包. json相同

{
  "name": "my_project",
  "version": "1.0.0",
  "main": "handler.js",
  "scripts": {
    "lint": "eslint . --ext .ts,.tsx",
    "migration:generate": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:generate -p -d src/local-data-source.ts src/migration/migrations",
    "migration:up": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:run -d src/local-data-source.ts",
    "migration:list": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:show -d src/local-data-source.ts",
    "migration:down": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:revert -d src/local-data-source.ts",
    "db:diagram": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm-uml src/ormconfig.json"
  },
  "dependencies": {
    "pg": "^8.8.0",
    "reflect-metadata": "^0.1.13",
    "typeorm": "^0.3.9"
  },
  "devDependencies": {
    "@types/node": "^16.11.10",
    "@typescript-eslint/eslint-plugin": "^3.6.0",
    "@typescript-eslint/parser": "^3.6.0",
    "eslint": "^7.4.0",
    "eslint-config-airbnb-base": "^14.2.0",
    "eslint-import-resolver-alias": "^1.1.2",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-jest": "^23.18.0",
    "eslint-plugin-module-resolver": "^0.17.0",
    "eslint-plugin-prettier": "^3.1.4",
    "ts-node": "10.7.0",
    "tsconfig-paths": "^4.1.0",
    "typescript": "4.5.2",
    "typescript-eslint": "^0.0.1-alpha.0"
  },
  "config": {
    "typeorm": {
      "migrations_path": "src/migration"
    },
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }
}

当我运行npm install时,typeorm安装在my_project/my_submodule
我如何确保它安装在my_project下?另外,对于其他不使用VSCode的团队成员,typeorm安装正确-安装在my_project下,为什么?!
我尝试将rootDir添加到两个目录中,但没有成功

bzzcjhmw

bzzcjhmw1#

我通过在vscode中添加子模块文件夹作为另一个文件夹来解决这个问题。
my_project(这也包含“my_submodule”)my_submodule

相关问题