NestJS + Yarn2
$ yarn global add @nestjs/cli
$ nest new api
$ cd api
Yarn2
$ yarn set version berry
$ yarn set version stable
$ yarn -v
4.02
$ vi .yarnrc.yml
cacheFolder: ./.yarn/cache
enableGlobalCache: false
enableScripts: false
nodeLinker: pnp
pnpMode: strict
$ yarn add --dev typescript @types/node nodemon
VS Code
$ yarn dlx @yarnpkg/sdks vscode
{
"editor.formatOnSave": true,
"arrowParens": "always",
"bracketSameLine": true,
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"endOfLine": "lf",
"insertPragma": false,
"printWidth": 100,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"disableLanguages": []
}
$ vi .vscode/settings.json
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": ".yarn/sdks",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"eslint.validate": [
"typescript",
"javascript",
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.prettier": true
},
"editor.formatOnSave": true,
}
MonoRepo
nset generate app auth
nest generate app videos
nest generate app storage
nest generate app history
nest generate library common
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "apps/api/src",
"compilerOptions": {
"deleteOutDir": true,
"webpack": false,
"tsConfigPath": "apps/api/tsconfig.app.json"
},
"monorepo": true,
"root": "apps/api",
"projects": {
"api": {
"type": "application",
"root": "apps/api",
"entryFile": "main",
"sourceRoot": "apps/api/src",
"compilerOptions": {
"tsConfigPath": "apps/api/tsconfig.app.json"
}
},
"auth": {
"type": "application",
"root": "apps/auth",
"entryFile": "main",
"sourceRoot": "apps/auth/src",
"compilerOptions": {
"tsConfigPath": "apps/auth/tsconfig.app.json"
}
}
...
}
}